RE: Getting the datatype from XSD

I am having the same problem it seems, and the SOM isn't really helping
me much.  Basically I am using a .NET class called "XPathNavigator"
navigate through the XML instance node by node.  I am able to get the
node name (i.e. the tag name) and the value okay.  But it seems that I
can't get the datatype from my XSD.  Someone also recommended I use the
SOM, but it seems its only useful for iterating over all the elements in
an XSD schema.  

Please refer to the following link for the background:
http://www.gotdotnet.com/Community/MessageBoard/Thread.aspx?id=87271&Pag
e=1#87842

Any help would be appreciated!

-----Original Message-----
From: dbowen@es.com
Date: Tue, 13 Aug 2002 11:43:38 -0600
Message-ID: <AFE3FBA300B6F04282BE07949DB2E123A418F4@torino.corp.es.com>
To: <mikaelj@CAE.COM>, <xmlschema-dev@w3.org>
Subject: RE: Getting the datatype from XSD


With MSXML 4.0, you can use the "SOM" (Schema Object Model) to do this.
Look in the MSXML 4 help under "SOM Developer's Guide" and "SOM
Reference".  I actually wish you could ask the node to give back schema
type information, but they do it a slightly different way (which I've
found doesn't always work).

Here's a little snippet to give you an idea of what's involved:


Set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.4.0")
oSchemaCache.add "urn:a", "a.xsd"

Set oDoc = CreateObject("Msxml2.DOMDocument.4.0")
oDoc.async = false
oDoc.validateOnParse = true
Set oDoc.schemas = oSchemaCache
oDoc.load "a.xml"

...

Set oNode = oDoc.selectSingleNode("/*/*")
Set oSchemaItem = oDoc.namespaces.getDeclaration(oNode)

-Daniel

-----Original Message-----
From: Mikael Joukakelian [mailto:mikaelj@CAE.COM]
Sent: Tuesday, August 13, 2002 8:08 AM
To: 'xmlschema-dev@w3.org'
Subject: Getting the datatype from XSD



Hi,

I have an XSD Schema and an instance of it which I am reading using
MSXML. I
would like to get the dataype (int, max value, ...) of each
element\attribute that I read. This information is found in the Schema
and
there should be a way to retrieve it however the only help I got from
MSXML
told me that I cannot get property information from Schemas (see
below).. 


dataType Property []
Specifies the data type for this node. This property applies to document
type definitions (DTDs) only, not to XML-Data Reduced (XDR) schemas or
XML
Schema definition language (XSD) schemas.

Received on Wednesday, 7 May 2003 15:24:07 UTC