[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to escape &dt=... (org.dom4j.DocumentException)
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[&dt=...]]> represents the string "&dt=...", not "&dt=..." >How can I handle such examples of &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;dt=...: &dt= Text node with: <![CDATA[&amp;dt=]]>: <![CDATA[&dt=]]> </xsl:template> </xsl:stylesheet> T:\ftemp>xslt cdata.xml cdata.xml con Text node with: &dt=...: &dt= Text node with: <![CDATA[&dt=]]>: &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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|