ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasun Gajasinghe <kasu...@gmail.com>
Subject Re: Attribute-Value Normalization of Axiom
Date Mon, 20 Feb 2012 08:30:57 GMT
On Sun, Feb 19, 2012 at 4:44 PM, Andreas Veithen
<andreas.veithen@gmail.com>wrote:

> The XML spec only describes what an XML parser must do before passing
> an attribute value to the application. However, it doesn't specify how
> an XML serializer should handle an attribute value received from the
> application and that is not normalized. Axiom doesn't specify that
> either. It simply passes the value to the StAX implementation. Your
> example shows that the StAX implementation (Woodstox I guess) chooses
> to serialize the newline character as a character reference (&#xa;).
> Probably the rationale is that this ensures that the receiving
> application gets exactly the same string as the one passed to the
> serializer, i.e. it maximizes the round-trippability for attribute
> values.
>
>
Yes, I understand the value of keeping the it as it is. I was concerned
about axiom vs xml spec. I did some testing, yes parsing works as expected.
Thank you for the clarification.

--Kasun

Andreas
>
> On Sat, Feb 18, 2012 at 14:13, Kasun Gajasinghe <kasunbg@gmail.com> wrote:
> > Hi,
> >
> > I have a question regarding how Axiom normalize attribute values. Say I
> > added an attribute to a document that has a newline character (\n  or
> #xA)
> > in the attribute value to a built OMDocument, and then serialize it. Now
> > doesn't the serialized content supposed to replace the newline character
> by
> > a space character (#x20) as of [1] 3.3 bullet point? Or am I looking at
> two
> > different things? Understanding how axiom behaves in these situations is
> > crucial when it comes to serializing etc.
> >
> > Here's a code snippet of a test I did.
> >
> > documentElement.addAttribute("attrName", " \n attVal     ", null);
> > documentElement.serialize(System.out);
> >
> > The serialized xml contains - attrName=" &#xa; attVal    ". But I think
> it
> > should be " &#x20; attVal    ".
> >
> > [1] http://www.w3.org/TR/REC-xml/#AVNormalize
> >
> > Thanks for any help!
> > --Kasun
> >
> > --
> > ~~~*******'''''''''''''*******~~~
> > Kasun Gajasinghe
> > Software Engineer; WSO2 Inc.; http://wso2.com
> >
> > ,
> > Linked-in: http://lk.linkedin.com/in/gajasinghe
> > blog: http://blog.kasunbg.org
> >
> >
> > twitter: http://twitter.com/kasunbg
> >
>



-- 
~~~*******'''''''''''''*******~~~
*Kasun Gajasinghe*
Software Engineer; WSO2 Inc.; http://wso2.com

,
*Linked-in: *http://lk.linkedin.com/in/gajasinghe*
*
*blog: **http://blog.kasunbg.org* <http://blog.kasunbg.org/>

*
twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>

Mime
View raw message