j-users@xerces.apache.org
[Top] [All Lists]

Re: How to disable attribute normalization

Subject: Re: How to disable attribute normalization
From: Michael Glavassevich
Date: Sun, 30 Mar 2008 13:35:57 -0400
Hi Daniel,

"Daniel Yokomizo" <daniel.yokomizo@xxxxxxxxx> wrote on 03/29/2008 04:45:24
PM:

> Hi,
>
>     I'm parsing (disabling validation) a document that declared a DTD
> but I would like to get the raw attribute values instead of the
> normalized values. In particular I need to keep entity references as
> they were written. I came up with this FAQ
> (http://xerces.apache.org/xerces-j/faq-write.html#faq-7) that seems to
> declare that it is impossible (i.e. attribute normalization happens if
> there's a DTD present) and I found the XMLScanner class that, via the
> method scanAttributeValue, does the attribute normalization. I noticed
> that we have a getNonNormalizedValue() method but the SAX parser layer
> uses AttributesProxy which hides the getNonNormalizedValue() method.

That method is part of XNI [1]. If you really need the non-normalized text
you'd need to change your application so that it uses XNI directly (rather
than SAX).

>     Is there any way to configure Xerces to not normalize attribute
> values even when the DTD is declared?

Whether your document has a DTD or not is irrelevant. The FAQ (on the
Xerces 1.x site) you read is wrong. Normalization [2] is required for every
attribute value. You cannot disable this behaviour.

>     Best regards,
>     Daniel Yokomizo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

Thanks.

[1] http://xerces.apache.org/xerces2-j/javadocs/xni/index.html
[2] http://www.w3.org/TR/2006/REC-xml-20060816/#AVNormalize

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>