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

Finding an element by name in a schema

Is there an easy way to find an element by name given a XmlSchema object?
Or do I have to parse the entire schema myself to search for it?

Do I somehow need to use XmlSchemaXPath? If so, how?

Thanks,

-- Greg
Nov 12 '05 #1
2 1110
Maybe I need to be clearer here. Here is a sample schema fragment:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="PRFL_CNFG_ID" type="xs:int" minOccurs="0" />
<xs:element name="PRFL_ID" type="xs:int" minOccurs="0" />
<xs:element name="MDL_ID" type="xs:int" minOccurs="0" />

If I read and compile the schema, how can I easily get the element with the
attribute name="PRFL_ID"? I would hope I could do it without having to
traverse the entire schema...

Can anyone help?

Thanks,

-- Greg

"Greg Allen" <ga****@arrayinc.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
Is there an easy way to find an element by name given a XmlSchema object?
Or do I have to parse the entire schema myself to search for it?

Do I somehow need to use XmlSchemaXPath? If so, how?

Thanks,

-- Greg

Nov 12 '05 #2
You can not find local element declarations in the schema without actually
traversing it. Sorry.

"Greg Allen" <ga****@arrayinc.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Maybe I need to be clearer here. Here is a sample schema fragment:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="PRFL_CNFG_ID" type="xs:int" minOccurs="0" /> <xs:element name="PRFL_ID" type="xs:int" minOccurs="0" />
<xs:element name="MDL_ID" type="xs:int" minOccurs="0" />

If I read and compile the schema, how can I easily get the element with the attribute name="PRFL_ID"? I would hope I could do it without having to
traverse the entire schema...

Can anyone help?

Thanks,

-- Greg

"Greg Allen" <ga****@arrayinc.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
Is there an easy way to find an element by name given a XmlSchema object? Or do I have to parse the entire schema myself to search for it?

Do I somehow need to use XmlSchemaXPath? If so, how?

Thanks,

-- Greg


Nov 12 '05 #3

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

Similar topics

0
by: wooks | last post by:
<?xml version="1.0" ?> - <xsd:schema targetNamespace="urn:faster:userlogin" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:faster:userlogin"> <xsd:include...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
1
by: jrmsmo | last post by:
Hi there, I have an interesting problem that maybe you pros can suggest how I solve. I'm working with a third party program that serializes an XML document (it was obviously not designed with schema...
0
by: Victor Hadianto | last post by:
Hi, Say for example I have this simple XSD: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/po.xsd" xmlns="http://tempuri.org/po.xsd"...
0
by: Victor Hadianto | last post by:
Hi, Say for example I have this simple XSD: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/po.xsd" xmlns="http://tempuri.org/po.xsd"...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
1
by: wayne_bradney | last post by:
I have the following Schema (XMLSchema1.xsd): <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="XMLSchema1" targetNamespace="http://tempuri.org/XMLSchema1.xsd"...
1
by: mflll | last post by:
How does one say in one schema that one wants an element defined in another schema. For example, I want to include in the Employee definition, an Address element defined in the schema...
0
by: icesign | last post by:
I know that the selector of these elements has a scope relative to the element being declared, but maybe there is a way to get beyond bounds of this scope or maybe just a way to extend base element?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.