473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Access XmlSchema properties?

I'd like to be able to access the elements in an XSD/XmlSchema object to
determine things like the datatype. Can this be done without explicitly
running validation on a document? Can I programatically access the elements
via an XmlSchema object to determine datatype (or other properties)?

The motivation behind this is that I'm constructing an XML document node by
node and as the values come in, I'd like to check their data type before they
are added and raise an exception at that point as opposed to after the node
has been added and running validation.
Nov 12 '05 #1
2 1290


Chris wrote:
I'd like to be able to access the elements in an XSD/XmlSchema object to
determine things like the datatype. Can this be done without explicitly
running validation on a document? Can I programatically access the elements
via an XmlSchema object to determine datatype (or other properties)?


You can load and compile a schema and it has properties like Elements to
access the elements in the schema
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSchemaXmlSchemaClassElementsTopic.as p>
and the SchemaTypes property for the types in the schema
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSchemaXmlSchemaClassSchemaTypesTopic .asp>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
And I also just realized, since the XSD file is valid XML, I could just load
it as an XML file (not XmlSchema) and access the elements via XPath. Doh.

One of those methods will get me where I want. Thank you.

Chris

"Martin Honnen" wrote:


Chris wrote:
I'd like to be able to access the elements in an XSD/XmlSchema object to
determine things like the datatype. Can this be done without explicitly
running validation on a document? Can I programatically access the elements
via an XmlSchema object to determine datatype (or other properties)?


You can load and compile a schema and it has properties like Elements to
access the elements in the schema
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSchemaXmlSchemaClassElementsTopic.as p>
and the SchemaTypes property for the types in the schema
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSchemaXmlSchemaClassSchemaTypesTopic .asp>

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Barrido | last post by:
Greetings! I have a project that needs to access a web service. My problem is this web service is provided via CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm planning to...
2
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any...
4
by: Stefan Rotter | last post by:
Hi, I'm trying to load a schema into an XmlSchema object with the Read and Compile methods. I use Read with a ValidationEventHandler. No errors occurs but when I look at the XmlSchema properties...
0
by: phancey | last post by:
whoops - I should have posted this to CSharp not ASPNET: Hi, I am using a 3rd party product to create dynamic web service proxies (downloaded from www.thinktecture.com). My problem is that...
4
by: Igor Koretsky | last post by:
Hi. Using VB.Net System.Xml 1.0 SchemaCollection Object I am getting an error when trying to add ‘Schema A’ to the SchemaCollection. Here are my schema files..
5
by: herman404 | last post by:
Hi everyone, I have some code that we need to migrate to SQL Server 2005 from 2000, and I have a webpage that upon viewing, fires a query to the SQL server using ISS and ISAPI. The result set is...
2
by: MyndPhlyp | last post by:
I am attempting to write a DLL to maintain an XML file. It creates its own XSD as an XmlSchema (or even a compiled member of an XmlSchemaSet, if necessary). I don't want to write an XSD to disk....
1
by: Ryan | last post by:
Hello Xml Gurus, I'm trying to build an XML schema in memory using the System.Xml.XmlSchema namespace objects, validate it, and then write it to a file. The problem I'm facing is that...
1
by: gihan | last post by:
Hi, I have a problem accessing remote webservice from my asp code. Instead of returning results, it returns list of web methods it has. Wonder where i'm doing wrong. Also note that, this is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.