I know there are probably 13.5 Million of these already, but I wanted to do one myself, okay?
{
name : 'xml_tag_name',
attributes : {
'xml_attribute_name1' : 'XML Attribute value1',
'xml_attribute_name2' : 'XML Attribute value2',
'xml_attribute_name3' : 'XML Attribute value3',
...
},
content : [
{ xml_tags },
{ xml_tags },
...,
'text content'
]
}
A proper JavaScript SyntaxError will be thrown if the XML is not properly formatted.
XMLtoJSON is really focused on data, and not so much the metadata. So I did this:
- All comments are ignored <!-- stuff like this -->
- All declarations are ignored, stuff like <?xml version="1.0" encoding="UTF-8"?>
- All CDATA sections are ignored, stuff like <![CDATA[<greeting>Hello, world!</greeting>]]>
- Newline and Tab characters, like \r \n \t, are blindly removed from everywhere
Copyright © 2024 Matthew LaGrandeur
Released under GPL 3.0
Matthew LaGrandeur |
matt[at]mattlag[dot]com |