Hi all,
Hope no one minds this long message, but I'm puzzled:
---------------
The following is a shortened version of schema located at
http://www.ietf.org/internet-drafts/...h-iodef-10.txt
<xs:schema xmlns="urn:ietf:params:xml:ns:iodef-1.0"
xmlns:iodef="urn:ietf:params:xml:ns:iodef-1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:ietf:params:xml:ns:iodef-1.0"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="IODEF-Document">
<xs:complexType>
<xs:sequence>
<xs:element ref="iodef:Incident" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Incident">
<xs:complexType>
<xs:sequence>
<xs:element ref="iodef:IncidentID"/>
</xs:sequence>
<xs:attribute name="purpose" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="traceback"/>
<xs:enumeration value="mitigation"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="ext-purpose" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="IncidentID" type="iodef:IncidentIDType"/>
<xs:complexType name="IncidentIDType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="instance" type="xs:string" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
I use xsd.exe to generate a C# class file, and the result is something like
so
class IODEFDocument
{
private Incident[] incidents;
[XmlElement("Incident")]
public Incident[] Incident{ get{ return incidents; } set{ incidents =
value; } }
}
class Incident
{
private IncidentIDType incidentIdType;
private IncidentPurpose purposeField;
public IncidentIDType IncidentID{ get{ return incidentIdType; } set{
incidentIdType = value; } }
[XmlAttribute()]
public IncidentPurpose{ get{ return purposeField; } set{ purposeField =
value; } }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
public enum IncidentPurpose {
/// <remarks/>
traceback,
/// <remarks/>
mitigation,
}
I created a web service to serve up an instance of IODEFDocument as defined
by the generated class file.
When I add a reference to this web service, the classes are defined in the
Reference.cs like this (roughly):
public class IODEFDocument
{
public IODEFDocumentIncident[] Incident{ get..; } set{ ...; } }
}
public class IODEFDocumentIncident
{
public IODEFDocumentIncidentPurpose purpose{ get{ ... } set{ ... } }
}
What I'm curious about is why the names of the classes and/or enumerations
keep getting extended.
For instance, this is one of the classes in Reference.cs when the full
schema definition for IODEFDocument is used:
public class IODEFDocumentIncidentEventDataFlowHostSystemNodeAd dress
{
}
Pretty much, you can tell the structure from that name:
class IODEFDocument
{
public Incident Incident;
}
class Incident
{
public EventData EventData;
}
class EventData
{
public Flow Flow;
}
class Flow
{
public Node Node;
}
and so, on down to class Address.
I consumed the service in JBuilder and got the same result for class names.
I'm just looking for an explanation why that happens, and if there is
anything that can be done about it. So that instead of working with an
IODEFDocumentIncidentEventData instance, I just work with EventData
instance.
In the schema for IODEF, just about everything is defined as elements, with
only a select few complexTypes if that makes any difference.
Thanks for any info,
Ron