473,421 Members | 1,631 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,421 software developers and data experts.

Get valid elements using XmlSchema - .NET

Hallo all,

I am looking for a funcion in the .Net framework that returns a list of
all the valid elements, for a specific element, accrording to the xml
schema restrictions.

I will try to be more accurate using this example:
if this is the xml
<a>
<b>
</b>
</a>

and this is the xml schema:
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element name="b" type="xs:string"/>
<xs:element name="c" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

I am looking for a function that returns the element 'c' as the only
element valid for element 'a' (and this is true because element 'b' is
already decleared in the xml)

I have used XmlSchemaValidator.GetExpectedParticles() but it doesn't
help - it returns all the possible values regardless to the xml data.
in this case it returns a list with both 'b' and 'c'.

I really appreciate any help in this matter,
Thanks in advance,
Izik Lisbon

Jul 6 '06 #1
1 1841
XmlSchemaValidator.GetExpectedParticles() is the right method to use.
XmlSchemaValidator is a push model validation engine and
GetExpectedParticles will return expected elements given the current state
of the validator.
Consider the following sequence of calls,
ValidateElement(a)
GetExpectedParticles() -Should return b since b is the next expected
element as a's first child
ValidateElement(b)
ValidateEndElement() -closing b's context
GetExpectedParticles() -should return c since c is the next expected
sibling

Thanks,
Priya

"merdaf" <me****@walla.comwrote in message
news:11*********************@m38g2000cwc.googlegro ups.com...
Hallo all,

I am looking for a funcion in the .Net framework that returns a list of
all the valid elements, for a specific element, accrording to the xml
schema restrictions.

I will try to be more accurate using this example:
if this is the xml
<a>
<b>
</b>
</a>

and this is the xml schema:
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element name="b" type="xs:string"/>
<xs:element name="c" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

I am looking for a function that returns the element 'c' as the only
element valid for element 'a' (and this is true because element 'b' is
already decleared in the xml)

I have used XmlSchemaValidator.GetExpectedParticles() but it doesn't
help - it returns all the possible values regardless to the xml data.
in this case it returns a list with both 'b' and 'c'.

I really appreciate any help in this matter,
Thanks in advance,
Izik Lisbon

Jul 6 '06 #2

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

Similar topics

0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
5
by: relaxedrob | last post by:
Hi All! I ran the following w3c example through my WSDL parser (SOA Editor from Cape Clear): http://www.w3.org/TR/wsdl#_rpcexample It told me that there were a bunch of erros about no...
2
by: rankam | last post by:
Hi There, We have a requirement for recursive elements within a XML document? Is it possible to design it through XML Schema? And what are implications using recursive elements when using DOM...
2
by: Matthew | last post by:
I have implemented the xmlSchemaCollection object to cache commonly used schemas, as follows: =============================================================================== public void...
2
by: Steve at Pixelda | last post by:
I accidentally put this on another group - this is the more likley home... The first code fragment creates the simplest of XML Schemas is code. After the “Compile()” method is called on the...
0
by: DotDidIt | last post by:
Hi Everybody! I developed a Web service with IBM RAD v 6.0.1. After creating the WSDL file i have tried to develop a .Net client. But by using wsdl.exe (1.1.4322) to create a .net c# proxy i...
1
by: GU | last post by:
How can one get a list of enumeration values for a given element in an XML schema? I have been looking at the Schema Object Model, but I'm making very little headway. Can anyone give me a nudge...
2
by: Steveino | last post by:
Hello, Just wondering if anyone could shed any light on this, it's probably me just being silly... I have a dataset that I've used to create an XmlDataDocument, in order to apply XSL. The XSL...
1
by: daldridge | last post by:
I have a unique-elements/sorting question (who doesn't?), but haven't yet been able to get appropriate template/select/for-each processing working. I don't fully grok the Muenchian technique yet...
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
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
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
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 projectplanning, 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.