473,388 Members | 963 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,388 software developers and data experts.

Problem with .NET Beta2 upgrade, with XSD traversal (LocalElements issue!!) ...Please help


I had a program in .NET Beta1, where in I was programmatically traversing
the Xml Schema using the given code snippet.

However today with migration to Beta2, I am facing a compilation issue that
LocalElements property on XmlSchemaComplexType not found. I now dont know
how to traverse XSD programmatically!!!
- I have a 4 level heirarchy XSD with a mix and match of complex elements
containing content and attributes both!

Please do help. Our current application BREAKS and I cannot go ahead with
development which is in its important phase, to be delivered by tomorrow!!

I would like to know what way I can traverse an XSD in a generic fashion as
possible, so that I could go to 1st level, 2nd level, 3rd or 4th level with
same peice of foreach code. Some documentation would reallly help. Also why
the LocalElements is not supported, I see its only supported in Compact
XmlReader reader = new XmlTextReader(fileName);
XmlSchemaSet schemaSet = new XmlSchemaSet();
XmlSchema schema = XmlSchema.Read(reader, null);
XmlSchemaObjectEnumerator itr = schema.Items.GetEnumerator();

//schema is added to schemaset
// compile schemaset : some properties are enabled post compilation

// A better way to Traverse the XSD
foreach (XmlSchemaElement parentElem in schema.Elements.Values)
XmlSchemaComplexType ct = parentElem.ElementSchemaType as
if (ct != null)
foreach (XmlSchemaElement childElem in ct.LocalElements.Values)
string str = childElem.Name;
XmlSchemaComplexType ct1 = childElem.ElementSchemaType as
Type type = null;
foreach (XmlSchemaElement gChildElem in ct1.LocalElements.Values)
if (gChildElem != null)
// Inner elements
string str1 = gChildElem.Name;
XmlSchemaComplexType ct2 = gChildElem.ElementSchemaType as
foreach (XmlSchemaElement gGChildElem in ct2.LocalElements.Values)
decimal occurence = gGChildElem.MaxOccurs;
}//if ct !=null


Jul 21 '05 #1
0 1171

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

Similar topics

by: Bill | last post by:
When I compile the following code fragment, the compiler errors saying the variable connection is not initialized. As I understand C#, I thought it would be initialized. Please help me and explain...
by: Nevets Steprock | last post by:
I have been building a website diligently for the past three months and everything has been working well so far. Yesterday, I added a link on my javascript menu. This link is supposed to go to a...
by: Uma Abhyankar | last post by:
Hello, I had a program in .NET Beta1, where in I was programmatically traversing the Xml Schema using the given code snippet. However today with migration to Beta2, I am facing a compilation...
by: Dip | last post by:
Hello Experts, Here is the code to flatten a PC hierarchy into a level based table. It works fine. SELECT t1.TASK_ID AS TASK_LV1, t2.TASK_ID AS TASK_LV2, t3.TASK_ID AS TASK_LV3, t4.TASK_ID AS...
by: jegray | last post by:
I am very much a beginner in dealing with connection statments. I am getting the following error: Microsoft OLE DB Provider for ODBC Drivers error '80004005' Data source name not found and no...
by: nabh4u | last post by:
hi, i have a program where every thing is working properly. i have a vector with some values. i use iterators and delete a specific value in the vector. here the loop runs infinitely only for some...
by: hemendravyas | last post by:
Please help out in following code snippet: For the first time it gives prompt while XmlSchema.Read(). Second time schema_collection_object is not null and so does not enter into this block of...
by: suma | last post by:
hi to all plaese help me i have same problem when download the phpdev and phptriad i cant connect to mysql when click the MyAdmin apear this messege in the page 'Warning: MySQL Connection...
by: hotflash | last post by:
Hi All, There is a field in my MS Access database called WorkDescription and it is set to MEMO. Required: No Allow Zero Length: Yes Indexed: No Unicode Compression: Yes Sometimes if...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
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...
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,...
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...
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...

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.