[
Lists Home |
Date Index |
Thread Index
]
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@metalab.unc.edu | 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>
>
|