Re: Use ampersand character in setText

"Andrea Pacini" <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <ACE3A0BCF6C8470D8400F2EFB7DE5732@pc1>
I am sorry, what I was looking for is :

EntityRef ref = new EntityRef("TrueNorthGuitarsTagline");
ref.setSystemID("tngTagline.xml");

that is the EntityRef.

Sorry again and thanks for your help,

----- Original Message ----- 
From: "Robin Rosenberg" <[email protected]>
To: <[email protected]>
Sent: Friday, December 16, 2011 5:51 PM
Subject: Re: [jdom-interest] Use ampersand character in setText


> Andrea Pacini skrev 2011-12-16 10.43:
>> Hi,
>> according to Jdom FAQ ( http://www.jdom.org/docs/faq.html#a0290 ) , I 
>> tried to write the string
>>
>> &test
>>
>> using this statement:
>>
>> root.setText("\u0026test");
>>
>> where \u0026 is the Unicode code for ampersand character.
>>
>> The output is:
>>
>> &amp;test
>>
>> Where is the error ?
>
> It's in your interpretation/the writing in the FAQ.
>
> It should be more like "Why does setText("&#160;") not output a NO-BREAK 
> SPACE
> character into the XML document".
>
> There is no difference in Java between "&test" and "\u0026test", except 
> that the
> latter is harder to read. Both translates into the exact same bytecode.
>
> The FAQ could be complemented with the corrected call, e.g. 
> setText("\u00a0"); To make
> things more confusing Java uses hexadecimal code units while XML uses 
> decimal code points.
>
> -- robin
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/[email protected] 

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.