schema types in DOM interface?

R

Rob

I'm defining my schema, and I set upon the idea of using xs:list for
some situations. However, I don't see how it's helping when accessing
the documents through DOM. I kind of imagine there would be a
getListContent() method or something like that.

Now that I'm thinking about it, there are really no DOM methods that
take Text Content and convert them to simple types. Does EVERYBODY
who uses DOM implement their own "getTextContentAsDouble(node)" (and
Int and String and DoubleList and IntList) methods? Or is there a
piece of the puzzle I'm missing.

Thanks for your patience and help!

Rob
 
M

Martin Honnen

Rob said:
I'm defining my schema, and I set upon the idea of using xs:list for
some situations. However, I don't see how it's helping when accessing
the documents through DOM. I kind of imagine there would be a
getListContent() method or something like that.

Now that I'm thinking about it, there are really no DOM methods that
take Text Content and convert them to simple types. Does EVERYBODY
who uses DOM implement their own "getTextContentAsDouble(node)" (and
Int and String and DoubleList and IntList) methods? Or is there a
piece of the puzzle I'm missing.

The W3C DOM (at least the Core DOM) is not aware of schema types. There
are schema aware data models, for instance the XPathNavigator model in
..NET 2.0 and later is aware of schema types and provides mappings
between XSD schema types and .NET CLR types. So there you find methods
and properties like
<http://msdn2.microsoft.com/en-us/library/System.Xml.XPath.XPathNavigator.ValueAsDouble.aspx>
<http://msdn2.microsoft.com/en-us/library/system.xml.xpath.xpathnavigator.typedvalue.aspx>
where the last property TypedValue according to the documentation "If
the element or attribute's content is a list type, the TypedValue
property returns an array of objects of the most appropriate .NET
Framework Type"

XPathNavigator in the .NET framework can be created for the fast
read-only XPathDocument but as well for the .NET DOM implementation
XmlDocument/XmlNode.
 
J

Joseph Kesselman

DOM Level 3 adds some support for schemas... but yes, the traditional
solution is to retrieve the node value as a string and then convert it
explicitly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top