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

Re: Saxon errors

Subject: Re: Saxon errors
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 10 May 2007 11:15:59 +0200
Re:  Saxon errors
Kamal Bhatt wrote:
In your input, change "<" to &lt; and ">" to &gt; .

You cannot use < and > in XML data (unless it is enclosed in CDATA "tags"). Actually, you probably could use < in some circumstances, but it is best to play it safe.



No, the < can never be used unless inside CDATA. But you can use the > safely without escaping. There are only two entities that must always be escaped: &lt; and &amp;. The other default entities, &gt;, &quot; and &apos; sometimes do and sometimes don't need to be used:

<!-- valid xml -->
<input value=" ' " />
<input>>>></input>
<input value=">>>" />
<input value=' " ' />

(to take this to an extreme, note that the string ]]> cannot be used inside CDATA... or... outside CDATA. but all the rest: np)

but the OP had < in an attribute and like you said: that is illegal. In addition, there also appeared a " in the attribute and without changing the surrounding quotes, it should be escaped. The attribute equals the XML declaration string. I think the OP does not want valid XML like this (note the quote change):

<pfarr name='&lt;?xml version="1.0" encoding="iso-8859-1"?>'>

but like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<pfarr name="xyz">
  <pfarr name="dls">

which, interestingly, is precisely the way the XML looked in a post by the same person, at 6 feb 2007 about multiple sorts on element attributes. My guess is, that somehow the source got tangled during these months... ;)

Cheers,
-- Abel Braaksma

Current Thread

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
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.