Fog Creek Software
Discussion Board




HTTP Posting of XML data

Is it me or is this fantastically powerful?
I have recently become very switched on to XML and I love it.
Anyone else?

XML Geek
Wednesday, September 24, 2003

As you just reacently switched Im betting youve got a ton of good links for the XML noob? I know about the markup stuff, but I dont have a clue about what its good for except tomcats config files.
So, got any good stuff to share?

Eric DeBois
Wednesday, September 24, 2003

One of the things I don't really understand is how to escape XML tags and elements from the data you are trying to wrap around.

There's CDATA to prevents data from been interpreted, but I always wondered how XML parsers handle tags or even CDATA markers embedded within the CDATA.

What are the proper way to escape such data? Am I being overly worried?

Li-fan Chen
Wednesday, September 24, 2003

This guy words it best:

http://archive.develooper.com/perl6-language@perl.org/msg10212.html

Li-fan Chen
Wednesday, September 24, 2003

CData tags or other tags within CData will be ignored by the parser.  That's what CData is saying to the parser, "don't try to parse what's inside of me".

As for good things XML is handy for, its great for any time you're handing off your data to someone else or another system.  That way you can both have your own internal representations of the data and one of you will build a transformation mechanism on the XML (which is relatively easy given the structured layout).

An example of an old layout that could make good use of XML is John Udell's latest piece on ical (that's the calendar layout, not the mac program (although it uses the ical layout)).  By using XML one could embed links and other formatted data within the calendar event.  How handy.

Lou
Wednesday, September 24, 2003

Eric DeBois: If you are doing Windows Software Development, this is all that you should need: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_intro_6g53.asp

Wayne
Wednesday, September 24, 2003

If you dont want to bother with all that CDATA stuff there are five magic tricks you need to encode your data. The danger characters are > & ' " < and these can be escaped like you would do in HTML with named entities (hopefully this site wont actually format these)

And these are: &gt; &lt; &amp; &apos; and &quot;

You can also do character code encoding if you want with &#123; etc.

Hope this helps, I'll have a dig around for some helpful docs and stuff.

XML Geek
Thursday, September 25, 2003

An alternative to having to encode things yourself is to use the MSXML DOM object, and use method/properties to get/set data. This will do the encoding/decoding behind the scenes and there's properties to return the complete XML with all your data encoded.

XML Geek
Thursday, September 25, 2003

Be careful with CDATA though, if you think that the XML you are trying to avoid parsing by putting it in the CDATA could ever contain a CDATA tag itself then you are stuffed. CDATA tags cannot be nested.

Andy Norman
Thursday, September 25, 2003

Oh, and don't assume that you can just put any old data into your CDATA tag. Control characters that are invalid in XML text are just as invalid inside the CDATA tag.

Andy Norman
Thursday, September 25, 2003

Cheers Wayne. I do data modelling and web apps, but Ill read it non the less.

Eric DeBois
Thursday, September 25, 2003

It's been a while since I force myself through a RFC or something like it but this one basically answers what XML SHOULD accept: http://www.w3.org/TR/REC-xml

But basically I'll either gen/catch base32/base64 things or put XML _inside_ of Mime multiparts.

Supposely you can attach attributes that tells a parser that the element text is going to be base64 (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)...

Li-fan chen
Thursday, September 25, 2003

*  Recent Topics

*  Fog Creek Home