Conversation
Firefox always serialize XML with '<?xml version="1.0" encoding="UTF-8"?>'
| var rIsNull = /^\s*$/; | ||
| var rIsBool = /^(?:true|false)$/i; | ||
| var rXmlProlog = /^(<\?xml.*?\?>[\n]?)/; | ||
| var rXmlPrologAttributes = /\b(version|encoding|standalone)="([^"]+?)"/g; |
There was a problem hiding this comment.
these attributes could also be quoted in single quotes ' according to the specs
There was a problem hiding this comment.
My mistake... that's easy to fix.
that's ok, because these are the only three allowed pseudo-attributes of the xml declaration (see https://www.w3.org/TR/2004/REC-xml-20040204/#sec-prolog-dtd)
Yeah, that's fine, because the top-most level in the JXON representation cannot currently have any attributes, as it would reference the "parent" of the xml root element. The analogy that this should apply to the pseudo-attributes of the xml document suggests itself. But I think your current implementation is a bit over-complicated, if you ask me. What do you think about the following proposals:
|
|
I will try to fix all points and them submit a new commit. 👍 |
This commit fixes #33 .
The code supports only
version,encodingandstandalonexml prolog attributes (here).The new special attribute (
xmlProlog) is using the defaultattrPrefix, is this ok?I have added two new configs:
Unit test
The new JSON representation from
will be...
{ "a": "foo", "$xmlProlog": { "version":"1.0" } }