Click here to Skip to main content
15,880,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

While creating a new XMLSchemaElement, "ref" attribute is being created with an empty string.

Following C# code is being used to create an XML Schema:

XmlSchema xsd = new XmlSchema();
 XmlSchemaElement xsdele = new XmlSchemaElement();
 xsdele.Name = "Feedbacks";
 xsdele.SchemaTypeName = new XmlQualifiedName("string", "");
 //Write the new schema to a file using XmlWriter....

The above code results in the following schema snippet for the above element:
<xs:element name="Feedbacks" ref="" xmlns:xs="#unknown" />

The code works on .NetCF2.0 (without creating "ref" attribute), but the "ref" attribute is being added when ported to .NetCF3.5.

Are we missing something here? Can you pl help?
Appreciate your time.

Updated 2-Sep-11 1:06am
Prerak Patel 2-Sep-11 6:35am    
Use code block for code segments in question.

1 solution

I think it's trying to tell you that for and xs:element element you need to specify either a ref type or a valid xmlns:xs attribute, and you've done neither.
Share this answer
TSKNaidu 2-Sep-11 14:06pm    
The element is not of ref type. Also, the xmlns of "unknown" has been inserted by the code block (when I have not marked up the actual code). Actually, we can see the namespace being set explicitly in the C# code snippet.

Thanks for taking time.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900