Closed nichtich closed 5 years ago
Sorry if im missing something here, but isn't that valid XML? I ran it through some linters and didn't get any errors. However, based on the link you provided I think
echo '{ "1 b=\"c\"": {} }' | ./bin/oq -o xml .
<?xml version="1.0" encoding="UTF-8"?>
<root>
<1 b="c"/>
</root>
should error since a number is not a valid start character.
echo '{ "a b=\"c\"": "" }' | oq -o xml .
<?xml version="1.0" encoding="UTF-8"?>
<root>
<a b="c"></a b="c">
</root>
@nichtich This is actually an issue in Crystal stdlib, I create https://github.com/crystal-lang/crystal/issues/7963 to deal with it and will have a PR for it soon.
In that case there is nothing to do in oq
itself, and will just start working as intended after its merged and the next version of Crystal is released.
EDIT: Examples
echo '{ "1": {} }' | ./bin/oq -o xml .
oq error: Invalid element name: '1'
echo '{ "a b=\"c\"": {} }' | ./bin/oq -o xml .
oq error: Invalid element name: 'a b="c"'
Er, I'll keep this open until its fixed on Crystal's end. Would at least allow building from source to get the feature.
I think this is not intended:
Disallowed XML element and attribute names should result in a error. The format to check against is defined here and discussed here. Note that names starting with
xml:
should also be allowed.