473,408 Members | 1,749 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,408 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 1839
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...
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?
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.