[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Fixing what's broke
- From: "Pete Cordell" <petexmldev@codalogic.com>
- To: <liam@w3.org>,"rjelliffe" <rjelliffe@allette.com.au>
- Date: Tue, 7 Dec 2010 09:48:17 -0000
----- Original Message From: "Liam R E Quin"
> For </> the problem is usually this: in programming code, you can use
> unit tests to gain confidence in correctness. But metadata cannot be
> executed, so it's often harder to catch errors.
>
> The extra redundancy does seem to help -- if you have an incorrect tag,
> e.g. <author>John Grisham</title>, there's a 50% chance it's the start
> tag and a 50% chance it's the end tag. So with </> for the end tag, you
> only catch half of these errors :-)
I wouldn't argue that end tags are without benefit*, but in data
applications where there is a lot of small elements the end tags just bulk
up the syntax, and (more importantly) make the XML harder to read.
So I'd suggest doing something like:
<Book:Book>
<Book:Author>John Grisham</>
<Book:Title>The Case of the Hidden Claw</>
</Book:Book>
where the short, single valued elements have a truncated end tag, and the
complex element has a normal end tag. An end tag offers little benefit for
the short values, but offers value for the complex types, where the cost of
the end tag name is effectively amortized over the elements contained
within.
Where to use truncated end tags and where not to would be the choice of the
XML generator; human or machine.
__________
* This is especially the case for XML and HTML compared to program code. In
program code we have the option to call methods and functions so our
construct ends are rarely far from their beginnings. That's generally not
an option in XML where there may be many pages within an element (although
things like PHP/ASP can help with HTML).
Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]