[jdom-interest] Element.getAttributeValue() escapes backslashes

Jason Hunter jhunter at servlets.com
Mon Aug 21 15:14:42 PDT 2006


No one has ever reported behavior like that on this list.

If that minimal example works for you, but it's failing in a larger 
system, I'm going to guess something other than JDOM in that larger 
system is changing the attribute value.

-jh-

benjamin van der veen wrote:
> Hello,
> 
> I'm using JDOM to parse an element whose attributes contain backslashes.
> 
> It is essentially of this form:
> 
> xml document:
> ---
> <my-document>
> <my-element anAttribute="some text \ some text"/>
> </my-document>
> ---
> 
> 
> When I use JDOM to retrieve the value of 'anAttribute," the output is:
> 
> some text \\ some text
> 
> JDOM is doubling-up on the backslashes. I can't find this behaviour
> documented or observed anywhere on Google or this list.
> 
> I have to admit that my code is way more complex than this example,
> and in fact this example works fine for me (backslashes are not
> escaped). I'm just wondering if anyone has seen this problem before or
> could give me a clue as to what might be happening before I start
> tearing apart several hundred lines of code...
> 
> Thanks,
> benjamin van der veen
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 


More information about the jdom-interest mailing list