Skip to content

Commit

Permalink
Add xml version tag handling for xml files without newlines (#644)
Browse files Browse the repository at this point in the history
XML without line breaks is perfectly valid imho so the importer should handle that.
  • Loading branch information
FelixHeppner authored Jul 2, 2024
1 parent 55aff92 commit e655b01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/frontend/converters/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ function xmlParser(xml: string, removeBreaks: boolean = false) {
let parser = new DOMParser()

// // fix for xml files without any line breaks
// let versionText = xml.indexOf("?>")
// if (versionText > 0 && versionText < 80) xml = xml.slice(versionText, xml.length)
let versionText = xml.indexOf("?>")
if (versionText > 0 && versionText < 80) xml = xml.slice(versionText + 2, xml.length)

// remove first line (standalone attribute): <?xml version="1.0" encoding="UTF-8"?> / <?xml-stylesheet href="stylesheets.css" type="text/css"?>
while (xml.indexOf("<?xml") >= 0) {
Expand Down

0 comments on commit e655b01

Please sign in to comment.