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

Re: XML Redux

  • From: Liam R E Quin <liam@w3.org>
  • To: stephengreenubl@gmail.com
  • Date: Tue, 15 Feb 2011 23:33:31 -0500

Re:  XML Redux
On Tue, 2011-02-15 at 21:21 +0000, Stephen Green wrote:
> I kind of like this idea of a parser 'reverting
> to character data' and what is the alternative
> if you need to remove ampersands from
> some XML (which got in there because no
> code was put in place to stop ampersands
> or less-thans being included in input in a
> web form and the input was subsequently
> turned into XML and stored as text - quite
> a common scenario of course). 

Flog the developer with a wet fish.

We (W3C) had a request to allow NUL in XML 1.1 because of some people
who had garbage in databases like this, and it would be easier for it
"not to be an error."  At some point it's going to be an error.  Do you
want the customer to telephone when they get little rectangles on the
screen, do you want the airline pilot to radio home when the navigation
systems fail?

I also see all to often
    printf("<%s><![CDATA[%s]]></%s>\n", elem, theData, elem);
which produces
   <e><![CDATA[Mr. Green]]></e>
without ever checking whether "theData" contains ]]>...

The reason for this is the lack of widespread APIs that are easy to use
and that automate the escaping,
   printf("%s\n", xmlelement(e, theData));


> It seems
> the problem is that XML parsers fall over
> with such characters 


The theory was always, better that the parser reject it (they don't
"fall over" - it's an intended error condition, not a failure of the
parser) than that the application "fall over"...

>  Treating them as something like
> strings, text or character data which can still
> be extracted seems like a good starting point.

You have to ask what is the consequence of this in the application.

Sometimes it's just fine. For a Web browser it might be OK. For a 'plane
navigation system, or for the pedals and steering wheel in your car,
maybe better to catch the problem in development, maybe better to have
the car detect a problem than go wrong.

For this reason, it's supposed to be the application that says, "carry
on, give me the wrong data" or "do whatever you want to recover, swap
"x" and 'y" coordinates or whatever you happen to find works, I don't
care."

At that point it's not engineering, it's art :-)

Best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.