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

Re: InnerXml is like printf (WAS: Underwhelmed)


c innerxml
Actually C# makes working with literal strings fairly easy, 

for example:

string myXML =
@"<root id='34'>
   <item cost=""33"">asdfasdf</item>
</root>";

is a valid literal string in C# with embeded new lines.

You do have to but in double "'s for a double quote, but 
other than that it is no so bad to work with. If you are 
working in the VS IDE it will flag missed double "'s so 
they are hard to forget.

Dan

On 22 Sep 2002 at 8:59, Elliotte Rusty Harold wrote:

> On further reflection, I've noticed a new issue with the InnerXML 
> approach. It's ugly as hell.
> 
> Strings in C-like languages (Java, C++, C, and I think C#) just 
> aren't the right containers for lots of literal XML. You can't embed 
> line breaks, double quotes  have to be escaped, and in general it's 
> just a mess.
> 
> There may be a place for an XML processing language that allows 
> literal XML data. Indeed there's one very successful such language 
> that I like quite a lot. Its initials are "X", "S", "L", and "T". But 
> Java/C#/etc. are not such languages. They cannot reasonably embed 
> literal XML code in a clean way.
> 
> About seven years ago I worked with some Informix preprocessor for C 
> that allowed one to embed real SQL code directly in the C program. 
> Then a preprocessor converted this C+SQL file into pure C with the 
> appropriate library calls. That was sort of nice. I could see someone 
> doing something like that for XML and Java. In this case, XML would 
> probably be the host language that included embedded Java/C#, and the 
> preprocessor could generate Java/C# code written to DOM/XOM/JDOM/etc. 
> This would be very interesting if anyone cares to explore it.
> 
> However, I really think InnerXML goes too far from the DOM/JDOM/XOM 
> style (everything's an object) and not far enough into the XSLT style 
> (everything's XML). It ends up stuck in some gray area between the 
> two. It's neither clean nor consistent, and that makes it confusing.
> -- 
> 
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo@m... | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
> |              http://www.cafeconleche.org/books/xian2/              |
> |  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
> |  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
> +----------------------------------+---------------------------------+
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
> 




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.