"Furcea Radu" <[EMAIL PROTECTED]> wrote on 11/04/2004 12:10:23 PM:

> Hello,
> I'm quite new at using xerces-c and I have a problem.
> I want to be able to save an xml which contain numeric character references,
> so for example I want to be able to get for an element the value:
> <element1>&#10;</element1>
>
> The problem with this kind of output is that the numeric character reference
> is replaced by the character itself.


These are two ways of expressing the same information [1]. Whether a character appears in an XML document literally or as a character reference, this shouldn't matter to most applications. They'll receive the same character code from the parser.

> If I try to create a TextNode which contain the ascii character with code 10
> then it will be saved like new line.
> If I try to create a text node where I set the numeric character reference
> for Cr, so the value &#10; then it is saved like &amp;#10;

When adding text programmatically to a DOM, the text is not processed as if it were being read by a parser. It is added as-is to the content. So if you create a text node with the value "&#10;" you're literally adding "&#10;" to the content not code point 10.

> I think should be a setting like this somewhere (I'm using
> DOMWriter::writeNode to save the xml) but I didn't find it anywhere. The
> using of Entity can help in this case ?
>
> Any help will be great, thanks,
>
> Radu Furcea
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


[1] http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#infoitem.character

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]

E-mail: [EMAIL PROTECTED]

Reply via email to