cern-sis / issues-inspire

0 stars 0 forks source link

improve author.xml detection in editor #557

Closed michamos closed 2 months ago

michamos commented 2 months ago

author.xml files often start like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE collaborationauthorlist SYSTEM "authors.dtd">
<collaborationauthorlist
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:cal="http://www.slac.stanford.edu/spires/hepnames/authors_xml/">

but currently the <collaborationauthorlist> tag needs to start on the first line for the content to be detected as author.xml. It would be good to extend support for this kind of documents, by searching for the tag among the first few (3?) lines. Alternatively, the browser's XML parsing capabilities could be used to robustly determine the name of the root tag, as demonstrated in https://developer.mozilla.org/en-US/docs/Web/XML/Parsing_and_serializing_XML#parsing_strings_into_dom_trees