You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Guy Sharon <gu...@hotmail.com> on 2004/09/07 11:32:12 UTC
Translation of some characters to entities
I am building a DOM tree in the code and one of the elements has a xs:string
type attribute where its value may consist of characters like '>' and '<'.
When I set the attribute's value as follows
element.setAttribute("attr1","g>z and w<f");
The value (for element.getAttribute("attr1");) is actually - "g>z and
w<f"
My question is why does the '>' char not translate to > also? and how do
I get it translated? - the xml file created from the DOM is not valid
without >
Thanks.
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
RE: Translation of some characters to entities
Posted by "F. Andy Seidl" <fa...@myst-technology.com>.
>> My question is why does the '>' char not translate to > also? <<
When serializing XML, translating a '>' is unnecessary because it will not
cause the parser any confusion--not so for '<' or '&' characters.
The value (in the DOM) of the attribute string should be exactly what you
set it to, but it should appear with the '<' translated to an entity when
you serialize the DOM to XML.
-- fas
F. Andy Seidl, Co-founder
MyST Technology Partners
-----Original Message-----
From: Guy Sharon [mailto:guyoser@hotmail.com]
Sent: Tuesday, September 07, 2004 5:32 AM
To: xerces-j-user@xml.apache.org
Subject: Translation of some characters to entities
I am building a DOM tree in the code and one of the elements has a xs:string
type attribute where its value may consist of characters like '>' and '<'.
When I set the attribute's value as follows
element.setAttribute("attr1","g>z and w<f");
The value (for element.getAttribute("attr1");) is actually - "g>z and
w<f"
My question is why does the '>' char not translate to > also? and how do
I get it translated? - the xml file created from the DOM is not valid
without >
Thanks.
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeR
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org