[
Lists Home |
Date Index |
Thread Index
]
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/ |
+----------------------------------+---------------------------------+
|