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

How to get a XmlSchemaObject by it's SchemaTypeName

Jim
Maybe I'm missing something obvious, but I'm stumped
right now. I'm trying to retrieve, in this case, a
XmlSchemaComplexType object (MyElementId) from the myelem
particle. Basically, I would like to retrieve an item
from the schema object based on the objects
QualifiedName/SchemaTypeName. When I traverse the items
defined in the schema object, their QualifiedName objects
are not defined (empty).
So I tried and failed with code similar to:

private XmlSchemaComplexType ProcessParticle(XmlSchema
schema, XmlSchemaParticle myelemParticle)
{
if (myelemParticle is XmlSchemaElement)
{
foreach (XmlSchemaObject o in schema.Items)
{
if (o is XmlSchemaComplexType)
{
// The QualifiedName is not defined for any
object...
// It is reported as empty
if (((XmlSchemaComplexType)o).QualifiedName ==
((XmlSchemaElement)particle).SchemaTypeName)
{
return (XmlSchemaComplexType) o;
}
}
}
return null;
}
}

An example schema is below:

<xs:schema
xmlns:myschema="http://schema.org/schema/myschema.xsd"
targetNamespace="http://schema.org/schema/myschema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType id="MyElementId" name="myelement">
<xs:attribute name="anotherthing" use="optional" />
<xs:attribute name="name" use="required" />
<xs:attribute name="something" use="optional" />
</xs:complexType>
<xs:complexType id="MainElement" name="main">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="myelem"
type="myschema:myelement" />
</xs:sequence>
</xs:sequence>
<xs:attribute name="someattr" use="optional" />
</xs:complexType>
</xs:schema>
Any insight would be helpful.

Thanks

Jim
Nov 15 '05 #1
3 2287
Jim
Any reason this hasn't been answered, seeing as I have an
MSDN universal subscription?

-----Original Message-----
Maybe I'm missing something obvious, but I'm stumped
right now. I'm trying to retrieve, in this case, a
XmlSchemaComplexType object (MyElementId) from the myelemparticle. Basically, I would like to retrieve an item
from the schema object based on the objects
QualifiedName/SchemaTypeName. When I traverse the items
defined in the schema object, their QualifiedName objectsare not defined (empty).
So I tried and failed with code similar to:

private XmlSchemaComplexType ProcessParticle(XmlSchema
schema, XmlSchemaParticle myelemParticle)
{
if (myelemParticle is XmlSchemaElement)
{
foreach (XmlSchemaObject o in schema.Items)
{
if (o is XmlSchemaComplexType)
{
// The QualifiedName is not defined for any
object...
// It is reported as empty
if (((XmlSchemaComplexType)o).QualifiedName ==
((XmlSchemaElement)particle).SchemaTypeName)
{
return (XmlSchemaComplexType) o;
}
}
}
return null;
}
}

An example schema is below:

<xs:schema
xmlns:myschema="http://schema.org/schema/myschema.xsd"
targetNamespace="http://schema.org/schema/myschema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType id="MyElementId" name="myelement">
<xs:attribute name="anotherthing" use="optional" />
<xs:attribute name="name" use="required" />
<xs:attribute name="something" use="optional" />
</xs:complexType>
<xs:complexType id="MainElement" name="main">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="myelem"
type="myschema:myelement" />
</xs:sequence>
</xs:sequence>
<xs:attribute name="someattr" use="optional" />
</xs:complexType>
</xs:schema>
Any insight would be helpful.

Thanks

Jim
.

Nov 15 '05 #2
Jim:

Did you use the "MSDN No-Spam Alias Creation" to register your email?

On Tue, 30 Sep 2003 17:28:11 -0700, "Jim"
<ji********@biacreations.com> wrote:
Any reason this hasn't been answered, seeing as I have an
MSDN universal subscription?


--
Scott
Nov 15 '05 #3
Yes, I have registered it. I just re-registered it, in
case if it didn't work the first time.

Jim
-----Original Message-----
Jim:

Did you use the "MSDN No-Spam Alias Creation" to register your email?
On Tue, 30 Sep 2003 17:28:11 -0700, "Jim"
<ji********@biacreations.com> wrote:
Any reason this hasn't been answered, seeing as I have anMSDN universal subscription?


--
Scott
.

Nov 15 '05 #4

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

Similar topics

1
by: lawrence | last post by:
What is the PHP equivalent of messaging, as in Java?
6
by: Chewy509 | last post by:
Hi Everyone, I'll just start, and say I am not a PHP developer (I'm a sysadmin, who has gotten lumped with a non-working website). But since I like to do this type of stuff, I though I might...
11
by: Paul Neave | last post by:
Hi group, hope you can help. I have a URL on my website that is currently under the directory mysite.com/something/ But I'd like to change the URL to mysite.com/anotherthing/ This is peasy...
3
by: Randell D. | last post by:
Folks, When I read data from my form, I sanitize it before recording it in MySQL. At the moment, the values in $_POST are cleaned and returned in a new array called $formData. I found my...
7
by: Nick Messick | last post by:
I'm trying to modify a banner display function so it can be including on remote websites. If I just include the file from a remote website the code isn't executed before it is put into the page. ...
4
by: Phil Powell | last post by:
create table if not exists nnet_produkt_varegruppe ( nnet_produkt_varegruppe_id int not null auto_increment, primary key(nnet_produkt_varegruppe_id), nnet_produkt_varegruppe_navn varchar(255) not...
6
by: lawrence | last post by:
Most of our designers prefer to work in Dreamweaver. They now, this month, want to produce templates that are valid XHTML 1.0. In Dreamweaver, this is as simple as clicking a button. Up till...
8
by: Nick Messick | last post by:
I have a multi step signup form that I'm building and I have the following question. Should I do it this way: <?php if (blah == 1) { ?><table><td width="100">........etc <?php } else { ?>...
2
by: Phil Powell | last post by:
I have a variable with a value that I've verified countless times by using both echo and print_r; both indicate the variable exists and has a value. The moment I instantiate a class where this...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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.