W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2003

RE: Getting the datatype from XSD

From: <dbowen@es.com>
Date: Thu, 8 May 2003 13:35:32 -0600
Message-ID: <B47A89AEC4538744B9D94BAD7E78EFC7714241@torino.corp.es.com>
To: <Derrill.Dabkoski@Siebel.com>, <xmlschema-dev@w3.org>
Cc: <mikaelj@CAE.COM>

Since no one else has replied, I'll give it a shot (you may have wanted to start a new thread instead of reply to an old message).

I don't program with .NET currently, but looking at the docs, it looks like you can get the schema type if you use XmlValidatingReader [1], and call "SchemaType" [2].

If you're using MSXML, than the code that I had supplied in that message you quoted should work well (I am currently using the SOM in MSXML with C++, and its working quite well).


[1] <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlvalidatingreaderclasstopic.asp>
[2] <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlvalidatingreaderclassschematypetopic.asp>

-----Original Message-----
From: Derrill Dabkoski [mailto:Derrill.Dabkoski@Siebel.com]
Sent: Wednesday, May 07, 2003 1:23 PM
To: xmlschema-dev@w3.org
Cc: Daniel Bowen; mikaelj@CAE.COM
Subject: 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: 
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)


-----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 

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 Thursday, 8 May 2003 15:37:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:11 UTC