4 ms·
>> This is equivalent to JSON needing to track {, [, ', and ", among other things. That's just parsing; both JSON and XML need to be parsed. That's not an advan
by axod 17y ago
>> This is equivalent to JSON needing to track {, [, ', and ", among other things. That's just parsing; both JSON and XML need to be parsed. That's not an advantage.
JSON can simply count brackets. That makes for a very simple parser indeed. XML needs to cope with invalid nesting, end tag names not matching start tag names etc. End tag names are just wasted space.
>> This is equivalent to the escape sequences in JSON: http://json.org/string.gif http://json.org/string.gif They also need to be parsed, they do not magically turn into bytes without that.
But those are sane. We all escape double quotes and backslashes in pretty much every programming language. They make sense in a very simple encoding.
Why should I need to replace & with %amp; they seem arbitrary, and the replacements aren't simple. " ?? seriously? you're naming characters with odd abreviations, and then expecting people to remember those? why not just escape them with a prefix such as erm.... "\"
- deleted 17y ago[deleted]
- viraptor 17y ago> XML needs to cope with invalid nesting, end tag names not matching start tag names etc. I think you read a different spec ;) http://www.w3.org/TR/REC-xml/#sec-logical-struct http://www.w3.org/TR/REC-xml/#sec-logical-struct : Well-formedness constraint: Element Type Match The Name in an element's end-tag MUST match the element type in the start-tag. XML parser rejects the document as soon as this occurs. No different than with `{]` in JSON. Changing " into " allows you to go to the next " without worrying about the contents before. The next " is the ending quote. Then you can resolve all the internals lazily... saving on processing time compared to JSON. For example "\"\\\"" will go through many branches and conditions. ""\"" is a simple jump over to the next " character.