473,612 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 XmlSchemaValida tor.GetExpected Particles() 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 1851
XmlSchemaValida tor.GetExpected Particles() is the right method to use.
XmlSchemaValida tor is a push model validation engine and
GetExpectedPart icles will return expected elements given the current state
of the validator.
Consider the following sequence of calls,
ValidateElement (a)
GetExpectedPart icles() -Should return b since b is the next expected
element as a's first child
ValidateElement (b)
ValidateEndElem ent() -closing b's context
GetExpectedPart icles() -should return c since c is the next expected
sibling

Thanks,
Priya

"merdaf" <me****@walla.c omwrote in message
news:11******** *************@m 38g2000cwc.goog legroups.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 XmlSchemaValida tor.GetExpected Particles() 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
4221
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> > <password>brown</password> > </userlogin> > Above is my schema instance.
5
4725
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 timeInstant or float defined in the xsd namespace: "http://www.w3.org/2000/10/XMLSchema".
2
4267
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 Parser in Java? Any samples demonstrating this concept in XSD is helpful? I need a XML structure something like this below : <forms>
2
2360
by: Matthew | last post by:
I have implemented the xmlSchemaCollection object to cache commonly used schemas, as follows: =============================================================================== public void SchemaValidate(XmlDocument xmlDoc, string schemaURI, string urnNamespace) {
2
1353
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 schemaset objetc, the schema element count is zero – but I was expecting one element in the PSVI. I saved the XML output in the console window to a file, and ran the second code fragment below to load in the XML from the file, and compile the...
0
1794
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 get the following error message: Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com' is not available to be referenced in this schema. Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com'
1
2054
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 in the right direction? Specifically, I am using Actions Pane to assist in creating a WordML document. For elements with enumerated values, I want to provide the user with the list of valid values from the schema. For example, if I have an...
2
5239
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 reformats the XML to another format (still XML, not HTML). This works fine, but whatever I do, I can't get the finally output section to have CDATA elements. I've added a cdata-section-elements tag into the xsl file, but it doesn't seem to have...
1
1680
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 (still an XSLT n00b), but I'm not sure that's the way to go anyway... What I'm trying to accomplish is generation of XML Schema output from a given XML input, with "xs:import" elements in the output with the "namespace" and "schemaLocation"...
0
8105
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8565
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8246
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8415
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7039
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, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6076
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5532
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4109
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.