XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Interesting XML ideas in oBIX

Brian Frank writes:

> The ability to reflect this information from an XML document may 
> seem trite, but it really does help make sense of data encoded in 
> XML.  Knowing that a leaf of a document should be an integer versus 
> arbitrary text helps down stream of the document in all sorts of 
> nifty ways - such as auto-generating user interfaces or plugging 
> into language constructs a programmer can use (I think this is one 
> of the things people like about JSON).  I know you can do this with 
> XML Schema - but it melts your brain and potentially requires 
> additional networking round trips.  With oBIX we require that this 
> level of reflection is embedded in each and every document.

If I understand your requirement correctly, it is already provided for in 
the XML Schema Recommendation, at least insofar as what you wish to type 
are elements, as opposed to attributes.  The xsi:type attribute [1] is 
provided so that you can assert the type of an element in the instance. 
Consider the following two examples, presuming the conventional namespace 
prefix bindings:

        <e xsi:type="xs:integer">123</e>

You have asserted that <e> is an integer.  In particular, you have 
asserted that its type is specifically the integer type specified in the 
XML Schema Recommendation [2].  The W3C controls that type definition, and 
it is unlikely to change.  I think you've achieved what you want.

No, for an interesting comparison, consider:

        <e 
xmlns:noahsnamespace="http://example.org/noahsstuff/noahsnamespace";
           xsi:type="noahsnamespace:sometype">
         123
      </e>

In this case, you've very clearly fixed the expanded [3] name of the type 
as: {http://example.org/noahsstuff/noahsnamespace,sometype},  but the 
definition of that type is dependent on some external specification, quite 
possible an XML Schema. 

So, given that the types that seem to concern you as "leaf" types are very 
much in the spirit of the XML Schema builtins, you can do this today. Note 
that nothing says you have to use the rest of the W3C schema language or 
to perform XSD validation to make this so, though certainly that is the 
normative mechanism provided to check validity.  The correct use of the 
xsi:type attribute is to assert the name of the type for an element.  The 
correct use of the type name xs:integer is per [2].  It is perfectly 
reasonable for you to infer that the instance is claiming <e> is an 
integer in that first example, whether or not you perform XML Schema 
validation.

There is no normative machanism that's completely instance-based for 
attributes, but given the syntax of XML attributes, it's somewhat hard for 
me to imagine a similar mechanism that wouldn't be at least somewhat 
clunky.

BTW:  if this leads to a detailed discussion of XML Schema mechanisms, I 
suggest we move it to schema-dev.  Thanks!

Noah

[1] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/#xsi_type
[2] http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#integer

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS