XSD tool doesn't generate attributes defined in schema file

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have the following xsd file:

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; UTF-8<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; schema <span style="color:Red; xmlns:xs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/2001/XMLSchema<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; length2<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexContent<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:anyType<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; size<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:integer<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; unit<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:string<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexContent<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; depth<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; length2<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; schema<span style="color:Blue; >
[/code]

If I run the xsd tool to generate class files, i get the following output:

<div style="color:Black;background-color:White; <pre>
<span style="color:Green; //------------------------------------------------------------------------------
<span style="color:Green; // <auto-generated>
<span style="color:Green; // This code was generated by a tool.
<span style="color:Green; // Runtime Version:2.0.50727.4206
<span style="color:Green; //
<span style="color:Green; // Changes to this file may cause incorrect behavior and will be lost if
<span style="color:Green; // the code is regenerated.
<span style="color:Green; // </auto-generated>
<span style="color:Green; //------------------------------------------------------------------------------

<span style="color:Blue; using System.Xml.Serialization;

<span style="color:Green; //
<span style="color:Green; // This source code was auto-generated by xsd, Version=2.0.50727.3038.
<span style="color:Green; //


<span style="color:Gray; /// <span style="color:Gray; <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute(<span style="color:#A31515; "xsd", <span style="color:#A31515; "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(<span style="color:#A31515; "code")]
[System.Xml.Serialization.XmlRootAttribute(<span style="color:#A31515; "depth", Namespace=<span style="color:#A31515; "", IsNullable=<span style="color:Blue; false)]
<span style="color:Blue; public <span style="color:Blue; partial <span style="color:Blue; class length2 {
}

[/code]

My question is: class length2 why doesnt have the two members size and unit?
I used another tool, in a different language to generate code from the above xsd file, and that tool generated the length2 class with the members size and unit.
Am I missing some options for the xsd tool?
Thanks you in advance for your feedbacks!

View the full article
 
Back
Top