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

Re: XML schema type question


rdf type jeni
Hi Jeff,

> I think one of the reasons this kind of thing is difficult is that
> there is only a way to distinguish between the type of an element
> (including its attributes and outside-the-angle-brackets content)
> and the type of the content alone. If this were possible, then you
> would be able to say that in general, the element foo supported
> attributes a and b, and allowed anyType for content, and a
> particular instance element named foo had content of type
> xsd:boolean. So along with xsi:type it would be nice to have
> xsi:content-type.

Yes, I agree -- the grouping of "all the content and all the
attributes" into a single type can be really annoying. But I think in
other situations you need different "groupings" of what's important --
sometimes, as here, it's a set of attributes; sometimes it's an
attribute and a particular element; sometimes it's a group of
elements. RELAX NG's approach is very powerful because it enables you
to mix-and-match the groups that you want to use with great
flexibility (especially when you use interleave).

> What I wound up doing is cruder -- I used an no-attribute
> intermediate element, as in
>
>   <complexType name="fooType">
>     <sequence>
>        <element name="value" type="anyType"/>
>     </sequence>
>     <attribute name="a" ...>
>     <attribute name="b" ...>
>   </complexType>
>
>   <element name="foo" type="fooType">
>
> and in the instance
>    <foo a="x" b="y"><value xsi:type="xsd:boolean">true</value></foo>
>    <foo a="xx" b="yy">
>        <value xsi:type="someComplexType>
>            <someComplexElt>...</someComplexElt>
>        </value>
>    </foo>

Right, good thinking. But I do dislike having to twist the design of
your markup language in order to use a particular technology with that
markup language (e.g. as here, to enable W3C XML Schema validators to
validate your content; with XLink attributes to enable linking in your
document; with RDF attributes to enable semantic web technologies to
process it). Perhaps something like XVIF [1] but for W3C XML Schema
would enable you to express the document as you wanted, and use a
simple transformation to turn it into something validatable.

Cheers,

Jeni

[1] http://downloads.xmlschemata.org/python/xvif/xvif.html

---
Jeni Tennison
http://www.jenitennison.com/


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.