[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to escape &dt=... (org.dom4j.DocumentException)


dom4j escape
At 2006-04-21 20:07 +0200, lukas.oesterreicher@i... 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@C...
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.