OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] XML schema type question

[ Lists Home | Date Index | Thread Index ]

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.



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

Jeni Tennison


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS