473,394 Members | 2,160 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,394 software developers and data experts.

XmlSchema and types

If I wanted to find the type referenced in this XML's root node, what
object would I use in the SOM?

<xs:schema
xmlns="http://www.w3.org/1999/XSL/Transform"elementFormDefault="qualified"

targetNamespace="http://www.w3.org/1999/XSL/Transform"xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense">

<xs:group name="persongroup">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="birthday" type="xs:date"/>
</xs:sequence>
</xs:group>

<xs:element name="person" type="personinfo"/>

<xs:complexType name="personinfo">
<xs:sequence>
<xs:group ref="persongroup"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

Note that "personinfo" doesn't to live anywhere in the MS SOM (SOM =
System.Xml.Schema.XmlSchema).

Thanks

Nov 12 '05 #1
1 1358
Once you have read a XSD Schema in to the XmlSchema object and called
Compile(), you can access all top level elements through XmlSchema.Elements
collection with contains instance of XmlSchemaElement objects. You can
access all top level types by XmlSchema.SchemaTypes.

If you want the type of a particular element, use the
XmlSchemaElement.ElementType property.

"SideByEach" <kn*****@nb.sympatico.ca> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
If I wanted to find the type referenced in this XML's root node, what
object would I use in the SOM?

<xs:schema
xmlns="http://www.w3.org/1999/XSL/Transform"elementFormDefault="qualified"

targetNamespace="http://www.w3.org/1999/XSL/Transform"xmlns:xs="http://www.w
3.org/2001/XMLSchema"
xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense">

<xs:group name="persongroup">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="birthday" type="xs:date"/>
</xs:sequence>
</xs:group>

<xs:element name="person" type="personinfo"/>

<xs:complexType name="personinfo">
<xs:sequence>
<xs:group ref="persongroup"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

Note that "personinfo" doesn't to live anywhere in the MS SOM (SOM =
System.Xml.Schema.XmlSchema).

Thanks

Nov 12 '05 #2

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

Similar topics

0
by: Eric Promislow | last post by:
Has anyone else run into this? The problem is that I'm loading one schema at a time, to be displayed in a TreeView. Each node in the tree points to an item in the schema via the Tag property. ...
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...
1
by: Eric | last post by:
I have code that creates, names, and adds to the the XmlSchema an XmlSchemaSimpleType. The code then creates an XmlSchemaElement and sets its SchemaType to the above XmlSchemaSimpleType. It works...
3
by: Nathan Wallace | last post by:
Hello, I have 2 schema, for argument sake let's call them child.xsd and parent.xsd. I define all my types in parent.xsd and the child.xsd include the parent.xsd using the following tag: ...
1
by: qdm | last post by:
Below is a snippet that I'm sure is quite familiar to most ... <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" Here, I've given the XMLSchema namespace the prefix 'xsd', and with...
2
by: Chris | last post by:
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...
1
by: Rumen Traykov via .NET 247 | last post by:
Have somebody had already the problem of having to write more than one XmlSchema, where some of these schemas have imports to others and respectively derived types? The imports cannot be resolved...
2
by: doughboy | last post by:
I create a schema in memory and then I can write to a file fine. But as soon as I add an import element I get an error when it goes to write to the file. The error message is: The type...
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.