TransformingRules (Transforming rules of the Parker convention, with some intro...) Wiki page commented on by bjouhier
- This is nice. I have 2 suggestions:
Concerning rule 7, what do you do if there is only a subset of siblings with the same name? For example, Atom <link> elements inside a <feed>. I would encode as an array but use the element name as property name. Something like:
link: [{rel: "first", href: "..."}, {rel: "last", href: "..."}]
Concerning rule 9, why don't you convert the colon to a dollar sign, to get a valid Javascript identifier.
Bruno
This is nice. I have 2 suggestions:
Concerning rule 7, what do you do if there is only a subset of siblings with the same name? For example, Atom <link> elements inside a <feed>. I would encode as an array but use the element name as property name. Something like:
link: [{rel: "first", href: "..."}, {rel: "last", href: "..."}]
Concerning rule 9, why don't you convert the colon to a dollar sign, to get a valid Javascript identifier.
Bruno
issue 11
(Attributes?) commented on by doekman
- OK. Is someone willing to make this change?
You can attach a svn patch (including testcases) to this issue.
OK. Is someone willing to make this change?
You can attach a svn patch (including testcases) to this issue.
Mar 16, 2009
issue 11
(Attributes?) commented on by doekman
- OK. Is anyone willing to make this change?
You can attach a svn patch (including testcases) to this issue.
OK. Is anyone willing to make this change?
You can attach a svn patch (including testcases) to this issue.
Mar 13, 2009
issue 11
(Attributes?) commented on by argentmania
- Can you have xsl who works with attributes...
Can you have xsl who works with attributes...
Mar 05, 2009
issue 11
(Attributes?) commented on by doekman
- According to the XML specification, a tag starts with STag (and via Name to
NameStartChar), which doesn't list a @-sign (
(http://www.w3.org/TR/2008/REC-xml-20081126/#sec-starttags). The XML Namespaces spec
even brings (QName, LocalPart, NCName to NCNameStartChar) it down to a letter or an
underscore
(http://www.w3.org/TR/REC-xml-names/#ns-using).
And also my tool XMLStarlet (http://xmlstar.sourceforge.net/) thinks it is illegal.
Answer to question 1: we can assume a tagname doens't start with a @-sign, so we
don't need to escape it.
According to the XML specification, a tag starts with STag (and via Name to
NameStartChar), which doesn't list a @-sign (
(http://www.w3.org/TR/2008/REC-xml-20081126/#sec-starttags). The XML Namespaces spec
even brings (QName, LocalPart, NCName to NCNameStartChar) it down to a letter or an
underscore
(http://www.w3.org/TR/REC-xml-names/#ns-using).
And also my tool XMLStarlet (http://xmlstar.sourceforge.net/) thinks it is illegal.
Answer to question 1: we can assume a tagname doens't start with a @-sign, so we
don't need to escape it.
Mar 04, 2009
issue 11
(Attributes?) commented on by lorenzo.dalcol
- I tryed with a validator online with this code:
<?xml version="1.0" ?>
<note>
<@test>works</@test>
</note>
at the address: http://www.w3schools.com/Dom/dom_validate.asp
It does NOT validate, so I think it's ok to use @ for attributes.
Note that also XML attributes that start with @ are not validate:
<?xml version="1.0" ?>
<note>
<test @myattr="1">works</test>
</note>
This is NOT validate.
I tryed with a validator online with this code:
<?xml version="1.0" ?>
<note>
<@test>works</@test>
</note>
at the address: http://www.w3schools.com/Dom/dom_validate.asp
It does NOT validate, so I think it's ok to use @ for attributes.
Note that also XML attributes that start with @ are not validate:
<?xml version="1.0" ?>
<note>
<test @myattr="1">works</test>
</note>
This is NOT validate.
Mar 04, 2009
issue 11
(Attributes?) Status changed by doekman
- I think the @-solution is nice enough to implement it.
Question 1: can an XML-element's name start with an @-sign? If yes, do we need to
escape it?
Question 2: Is backward compatibility needed?
Status:
I think the @-solution is nice enough to implement it.
Question 1: can an XML-element's name start with an @-sign? If yes, do we need to
escape it?
Question 2: Is backward compatibility needed?
Status:
Mar 04, 2009
issue 11
(Attributes?) commented on by lorenzo.dalcol
- I think the @ solution is the best.
it's really simple to recognize and useful.
I think the @ solution is the best.
it's really simple to recognize and useful.
Mar 04, 2009
issue 11
(Attributes?) commented on by RonB1963
- A better solution in my opinion would be to use the @-character in the first value
as a prefix. This is also the way that IBM generates it's JSON.
JSON doesn't support atttributes, only value pairs.
{root : ["@id": "2", "@agenzia":"Trieste", "@bank_id": "1"....]}
A better solution in my opinion would be to use the @-character in the first value
as a prefix. This is also the way that IBM generates it's JSON.
JSON doesn't support atttributes, only value pairs.
{root : ["@id": "2", "@agenzia":"Trieste", "@bank_id": "1"....]}
Jan 22, 2009
issue 11
(Attributes?) commented on by m...@amundsen.com
- this is a great library, but the lack of support for attributes is a bummer.
one possible solution would be to generate an {attributes:{"name":"value",...}} child
item for any element that has attributes. this will keep the attributes from
colliding w/ existing elements and keep them in a 'known' place.
please give it a shot as i really like this library.
this is a great library, but the lack of support for attributes is a bummer.
one possible solution would be to generate an {attributes:{"name":"value",...}} child
item for any element that has attributes. this will keep the attributes from
colliding w/ existing elements and keep them in a 'known' place.
please give it a shot as i really like this library.
Older
Sep 09, 2008
issue 11
(Attributes?) reported by lorenzo.dalcol
- Attributes are not converted:
I have this XML:
<root>
<agencies id="2" agenzia="Trieste" bank_id="1" abi="1030" cab="2200" />
..
..
</root>
and receive this JSON:
{"root":[null,null,null,null,null,null,null,null]}
Attributes are not converted:
I have this XML:
<root>
<agencies id="2" agenzia="Trieste" bank_id="1" abi="1030" cab="2200" />
..
..
</root>
and receive this JSON:
{"root":[null,null,null,null,null,null,null,null]}