Re: [xml-dev] Mixed content in data-binding (Was: Re: [xml-dev] Interesting pair of comments

From
Pete Cordell <>
To
Michael Kay <>, 'Peter Gerstbach' <>, 'XML-dev' <>
Date
2005-07-15T09:26:56Z
ID
<008701c5891f$6fcd6390$b700a8c0@RW>
Thread
Re: [xml-dev] Mixed content in data-binding (Was: Re: [xml-dev] Interesting pair of comments
Original Message From: "Michael Kay"
> There are also applications of mixed content that don't fall into the
> classic "marked-up text" model. For example, it can be used to record
> "properties of properties", as in
>
> <email><last-modified>2005-02-02</last-modified></email>
...
> But it's an area where the XML Schema spec didn't carry through its design
> principle that elements should be able to do anything that attributes can
> do: if last-modified were an attribute then I could constrain the email
> address with a pattern facet.
...
> Michael Kay
> http://www.saxonica.com/

Thanks for the example Michael.  As I think you infer, XSD itself doesn't 
really support this either.  For example, if <email> was marked as mixed, 
the following would also be legal wouldn't it?:

<email><last-modified>2005-02-02</last-modified>What's 
this?</email>

Also, it is only implied, perhaps through documentation, that the first 
CDATA event is the actual e-mail address value.  To capture it precisely, an 
(abridged) schema would have to look something like:

<xs:element name=email><xs:ct>
    <xs:sequence>
        <xs:CDATA identifyingName=email><!-- new construct -->
        <xs:element name=last-modified ...
...

That said, I do find what you suggest aesthetically pleasing and I agree 
that tools could do better here!

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
                         for XML to C++ data binding visit
                         http://www.tech-know-ware.com/lmx
                         (or http://www.xml2cpp.com)
=============================================