OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] How to escape &dt=... (org.dom4j.DocumentException)

[ Lists Home | Date Index | Thread Index ]

At 2006-04-21 20:07 +0200, lukas.oesterreicher@inode.at wrote:
>I have the following problem:
>
>One of my xml nodes contains an url that contains the text &dt=...

Which represents the text string "&dt=..." ... it does not represent 
an entity reference.

>When I try to parse this via DocumentHelper.parseText I get the 
>following exception:
>org.dom4j.DocumentException: Error on line 21 of document  : The 
>reference to entity "dt" must end with the ';' delimiter. Nested 
>exception: The reference to entity "dt" must end with the ';' delimiter.

Which processor are you using?

An example below uses Saxon with its XML processor.

>This ofcourse is fixed when I enclose this in <[CDATA[...]]>

So you are talking about a text node ... but <![CDATA[&amp;dt=...]]> 
represents the string "&amp;dt=...", not "&dt=..."

>How can I handle such examples of &amp;dt= ?

I'm not sure what you mean by "handle" ... that string represents 
"&dt=" and enclosing it in a CDATA section does not give you the same string.

I hope this and the code below helps clarify what you are expressing 
with your syntax.

. . . . . . . . Ken

T:\ftemp>type cdata.xml
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 version="1.0">

<xsl:output method="text"/>

<xsl:template match="/">
Text node with:  &amp;amp;dt=...:  &amp;dt=
Text node with:  &lt;![CDATA[&amp;amp;dt=]]&gt;: <![CDATA[&amp;dt=]]>
</xsl:template>

</xsl:stylesheet>
T:\ftemp>xslt cdata.xml cdata.xml con

Text node with:  &amp;dt=...:  &dt=
Text node with:  <![CDATA[&amp;dt=]]>: &amp;dt=

T:\ftemp>

--
Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XSLT/XSL-FO training:    Minneapolis, MN 2006-07-31/08-04
Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25
Also for XSLT/XSL-FO training:    Copenhagen,Denmark 2006-05-08/11
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS