W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2002

RE: Getting the datatype from XSD

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>

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 Tuesday, 13 August 2002 13:44:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT