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

XmlSchema classes help needed

Hi All,

I am having hard time figuring out how to programmatically construct a
schema with following comple type:

<xs:complexType name="A">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="B" type="B" />
<xs:element minOccurs="1" maxOccurs="1" name="C" type="C" />
</xs:sequence>
<xs:anyAttribute>
</xs:complexType>

Specifically I can not find any way to insert the
"XmlSchemaAnyAttribute" instance into the complex type I have. Any
help would be appreciated.

The code I have looks something like:

.....

XmlSchemaComplexType xmlElementType = new XmlSchemaComplexType();
xmlElementType.Name = "A";

// Add nested elements
XmlSchemaSequence xmlNestedSequence = new XmlSchemaSequence();
xmlElementType.Particle = xmlNestedSequence;

XmlSchemaElement nestedElement;

nestedElement = new XmlSchemaElement();
nestedElement.Name = "B";
nestedElement.SchemaTypeName = new XmlQualifiedName("B");
nestedElement.MinOccurs = 1;
nestedElement.MaxOccurs = 1;

xmlNestedSequence.Items.Add(nestedElement);

nestedElement = new XmlSchemaElement();
nestedElement.Name = "C";
nestedElement.SchemaTypeName = new XmlQualifiedName("C");
nestedElement.MinOccurs = 1;
nestedElement.MaxOccurs = 1;

xmlNestedSequence.Items.Add(nestedElement);

.....
Nov 12 '05 #1
1 1083
Doesnt this work for you?
XmlSchemaAnyAttribute any = new XmlSchemaAnyAttribute();

xmlElementType.AnyAttribute = any;

-Zafar

"Alex" <a7*****@hotmail.com> wrote in message
news:d3**************************@posting.google.c om...
Hi All,

I am having hard time figuring out how to programmatically construct a
schema with following comple type:

<xs:complexType name="A">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="B" type="B" />
<xs:element minOccurs="1" maxOccurs="1" name="C" type="C" />
</xs:sequence>
<xs:anyAttribute>
</xs:complexType>

Specifically I can not find any way to insert the
"XmlSchemaAnyAttribute" instance into the complex type I have. Any
help would be appreciated.

The code I have looks something like:

....

XmlSchemaComplexType xmlElementType = new XmlSchemaComplexType();
xmlElementType.Name = "A";

// Add nested elements
XmlSchemaSequence xmlNestedSequence = new XmlSchemaSequence();
xmlElementType.Particle = xmlNestedSequence;

XmlSchemaElement nestedElement;

nestedElement = new XmlSchemaElement();
nestedElement.Name = "B";
nestedElement.SchemaTypeName = new XmlQualifiedName("B");
nestedElement.MinOccurs = 1;
nestedElement.MaxOccurs = 1;

xmlNestedSequence.Items.Add(nestedElement);

nestedElement = new XmlSchemaElement();
nestedElement.Name = "C";
nestedElement.SchemaTypeName = new XmlQualifiedName("C");
nestedElement.MinOccurs = 1;
nestedElement.MaxOccurs = 1;

xmlNestedSequence.Items.Add(nestedElement);

....

Nov 12 '05 #2

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

Similar topics

3
by: Russell Lear | last post by:
I need to be able to unmarshall data from an XML file into (instances of) appropriate Python classes . I don't have control over the schema used. I'd like the Python classes to use lists for...
0
by: BODIN | last post by:
I have an XML document, which is actually physically stored in 2 separated files. doc1.xml and doc2.xml I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two physical files, and use...
2
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any...
4
by: Eric | last post by:
I am building an XML Schema with the SOM in .NET and would like to add a non-native attribute to one of my elements. Does anyone know how to do this? (Whithout rendering the schema to an...
4
by: Stefan Rotter | last post by:
Hi, I'm trying to load a schema into an XmlSchema object with the Read and Compile methods. I use Read with a ValidationEventHandler. No errors occurs but when I look at the XmlSchema properties...
2
by: Alex Shirshov | last post by:
Hello, All! It seems the bug (http://groups.google.com/groups?hl=ru&lr=&ie=UTF-8&threadm=a53b01c28a00%242 08bc860%2439ef2ecf%40TKMSFTNGXA08&rnum=8&prev=/groups%3Fq%3DschemaLocation%2...
4
by: Igor Koretsky | last post by:
Hi. Using VB.Net System.Xml 1.0 SchemaCollection Object I am getting an error when trying to add ‘Schema A’ to the SchemaCollection. Here are my schema files..
1
by: Ryan | last post by:
Hello Xml Gurus, I'm trying to build an XML schema in memory using the System.Xml.XmlSchema namespace objects, validate it, and then write it to a file. The problem I'm facing is that...
0
by: =?Utf-8?B?Q2FtZWw=?= | last post by:
For anyone who has utilised classes under XSD.exe and CodeDOM (please redirect me to another group perhaps if not here) please any ideas on how to translate the multiple namespaces present within...
0
by: =?Utf-8?B?TGFzdGJ1aWxkZXJz?= | last post by:
Hi all, I have a weird problem which has been causing me a headache for the last two days. I have to dynamicly generate a schema in memory and load it into a dataset in memory to be returned...
0
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: 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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.