You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Robert Koberg <ro...@koberg.com> on 2004/11/05 19:48:27 UTC

XInclude parse="text" producing & # x D ;

Hi,

I am trying to use XInclude to include some text in the XML source used 
in a transformation. If I wrap the text in an element and don't use 
parse="text" all is good.

When I use something like:

<!-- also used US-ASCII and ISO-8859-1 for @encoding -->
<xi:xinclude
   encoding="UTF-8"
   href="something.txt"
   parse="text">
   <xi:fallback/>
</xi:xinclude>

I get a character entity representing line endings (& # x D ;).

Is there some way to avoid this? (I have searched and have not found any 
references to this problem)

thanks,
-Rob

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: XInclude parse="text" producing & # x D ;

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
XML processors transform sequences of #xD #xA and any #xD that is not 
followed by #xA to a single #xA character on input [1]. If the serializer 
doesn't write #xD as a reference then they'll get transformed into #xA 
when the document is read again.

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends

Robert Koberg <ro...@koberg.com> wrote on 11/05/2004 02:41:23 PM:

> Michael Glavassevich wrote:
> 
> > 
> > Hello Rob,
> > 
> > When parse="text" the text from whatever href points to is included 
> > directly. If the text being included contains line breaks they'll end 
up 
> > in the result. A serializer will write these as character references 
so 
> > that they can be round-tripped when the document is read again.
> 
> 
> OK, thanks. But why doesn't it use a numeric entity that can be easily 
> understood?
> 
> Also, the visible line breaks are still there and the entity shows up as 

> well. That is, they are not showing up like:
> 
> String var1=1;& # x D ;String var2=2;
> 
> rather, they show like:
> 
> String var1=1;& # x D ;
> String var2=2;
> 
> I am transforming the source into a JSP (using the JSP XML syntax) and 
> the JSP parser chokes on the undefined entity.
> 
> Oh well, I can just wrap the text in an element.
> 
> thanks,
> -Rob
> 
> 
> > 
> > Robert Koberg <ro...@koberg.com> wrote on 11/05/2004 01:48:27 PM:
> > 
> >  > Hi,
> >  >
> >  > I am trying to use XInclude to include some text in the XML source 
used
> >  > in a transformation. If I wrap the text in an element and don't use
> >  > parse="text" all is good.
> >  >
> >  > When I use something like:
> >  >
> >  > <!-- also used US-ASCII and ISO-8859-1 for @encoding -->
> >  > <xi:xinclude
> >  >    encoding="UTF-8"
> >  >    href="something.txt"
> >  >    parse="text">
> >  >    <xi:fallback/>
> >  > </xi:xinclude>
> >  >
> >  > I get a character entity representing line endings (& # x D ;).
> >  >
> >  > Is there some way to avoid this? (I have searched and have not 
found any
> >  > references to this problem)
> >  >
> >  > thanks,
> >  > -Rob
> >  >
> >  > 
---------------------------------------------------------------------
> >  > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> >  > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >  >
> > 
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@ca.ibm.com
> > E-mail: mrglavas@apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Re: XInclude parse="text" producing & # x D ;

Posted by Robert Koberg <ro...@koberg.com>.
Michael Glavassevich wrote:

> 
> Hello Rob,
> 
> When parse="text" the text from whatever href points to is included 
> directly. If the text being included contains line breaks they'll end up 
> in the result. A serializer will write these as character references so 
> that they can be round-tripped when the document is read again.


OK, thanks. But why doesn't it use a numeric entity that can be easily 
understood?

Also, the visible line breaks are still there and the entity shows up as 
well. That is, they are not showing up like:

String var1=1;& # x D ;String var2=2;

rather, they show like:

String var1=1;& # x D ;
String var2=2;

I am transforming the source into a JSP (using the JSP XML syntax) and 
the JSP parser chokes on the undefined entity.

Oh well, I can just wrap the text in an element.

thanks,
-Rob


> 
> Robert Koberg <ro...@koberg.com> wrote on 11/05/2004 01:48:27 PM:
> 
>  > Hi,
>  >
>  > I am trying to use XInclude to include some text in the XML source used
>  > in a transformation. If I wrap the text in an element and don't use
>  > parse="text" all is good.
>  >
>  > When I use something like:
>  >
>  > <!-- also used US-ASCII and ISO-8859-1 for @encoding -->
>  > <xi:xinclude
>  >    encoding="UTF-8"
>  >    href="something.txt"
>  >    parse="text">
>  >    <xi:fallback/>
>  > </xi:xinclude>
>  >
>  > I get a character entity representing line endings (& # x D ;).
>  >
>  > Is there some way to avoid this? (I have searched and have not found any
>  > references to this problem)
>  >
>  > thanks,
>  > -Rob
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>  > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>  >
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: XInclude parse="text" producing & # x D ;

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hello Rob,

When parse="text" the text from whatever href points to is included 
directly. If the text being included contains line breaks they'll end up 
in the result. A serializer will write these as character references so 
that they can be round-tripped when the document is read again.

Robert Koberg <ro...@koberg.com> wrote on 11/05/2004 01:48:27 PM:

> Hi,
> 
> I am trying to use XInclude to include some text in the XML source used 
> in a transformation. If I wrap the text in an element and don't use 
> parse="text" all is good.
> 
> When I use something like:
> 
> <!-- also used US-ASCII and ISO-8859-1 for @encoding -->
> <xi:xinclude
>    encoding="UTF-8"
>    href="something.txt"
>    parse="text">
>    <xi:fallback/>
> </xi:xinclude>
> 
> I get a character entity representing line endings (& # x D ;).
> 
> Is there some way to avoid this? (I have searched and have not found any 

> references to this problem)
> 
> thanks,
> -Rob
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org