neyestrabelli / xml-formatter

Simple XML Formatter for Atom
MIT License
22 stars 7 forks source link

Formatting xml is destructive #1

Closed bryanrcampbell closed 10 years ago

bryanrcampbell commented 10 years ago

Here's some example (invalid) xml. When formatted, we lose the second CD element. Instead of dropping some of the data, we might want to either show an error or do the best we can.

Example:

<CD>
        <TITLE>Empire Burlesque</TITLE>
        <ARTIST>Bob Dylan</ARTIST>
        <COUNTRY>USA</COUNTRY>
        <COMPANY>Columbia</COMPANY>
        <PRICE>10.90</PRICE>
        <YEAR>1985</YEAR>
    </CD><CD>
        <TITLE>Hide your heart</TITLE>
        <ARTIST>Bonnie Tyler</ARTIST>
        <COUNTRY>UK</COUNTRY>
        <COMPANY>CBS Records</COMPANY>
        <PRICE>9.90</PRICE>
        <YEAR>1988</YEAR>

Actual:

<?xml version="1.0" encoding="UTF-8"?>
<CD>
  <TITLE>Empire Burlesque</TITLE>
  <ARTIST>Bob Dylan</ARTIST>
  <COUNTRY>USA</COUNTRY>
  <COMPANY>Columbia</COMPANY>
  <PRICE>10.90</PRICE>
  <YEAR>1985</YEAR>
</CD>
neyestrabelli commented 10 years ago

Hi @bryanrcampbell I refactor the format code and now working with incomplete xml. Please test the new version