views:

43

answers:

0

I've produced a class using the XSD.EXE for an XML web service. My question is how do I include the schema?

Current XML output:

<?xml version="1.0" encoding="utf-8"?>
<dsXmlSummary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tempuri.org/dsXmlSummary.xsd"&gt;
  <admin_reports_xmlReports>
    <emailAddress>[email protected]</emailAddress>
    <city>Redding</city>
    <nameLast>Mark</nameLast>
    <nameFirst>Twain</nameFirst>
    <street>123 main</street>
    <state>CT</state>
    <phone />
    <courseNo>316</courseNo>
  </admin_reports_xmlReports>
</dsXmlSummary>

Desired XML output:

<?xml version="1.0" encoding="utf-8"?>
<dsXmlSummary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tempuri.org/dsXmlSummary.xsd"&gt;
 <xs:schema id="dsXmlSummary" targetNamespace="http://www.tempuri.org/dsXmlSummary.xsd"
    xmlns:mstns="http://www.tempuri.org/dsXmlSummary.xsd" xmlns="http://www.tempuri.org/
dsXmlSummary.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:
schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault=
"qualified">
        <xs:element name="dsXmlSummary" msdata:IsDataSet="true">
            <xs:complexType>
                <xs:choice maxOccurs="unbounded">
                    <xs:element name="admin_reports_xmlReports">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:element name="emailAddress" type="xs:string" minOccurs="0"/>
                                <xs:element name="city" type="xs:string" minOccurs="0"/>
                                <xs:element name="nameLast" type="xs:string" minOccurs="0"/>
                                <xs:element name="nameFirst" type="xs:string" minOccurs="0"/>
                                <xs:element name="nameMiddle" type="xs:string" minOccurs="0"/>
                                <xs:element name="street" type="xs:string" minOccurs="0"/>
                                <xs:element name="state" type="xs:string" minOccurs="0"/>
                                <xs:element name="phone" type="xs:string" minOccurs="0"/>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                </xs:choice>
            </xs:complexType>
        </xs:element>
    </xs:schema>
  <admin_reports_xmlReports>
    <emailAddress>[email protected]</emailAddress>
    <city>Redding</city>
    <nameLast>Mark</nameLast>
    <nameFirst>Twain</nameFirst>
    <street>123 main</street>
    <state>CT</state>
    <phone />
    <courseNo>316</courseNo>
  </admin_reports_xmlReports>
</dsXmlSummary>

I can't find anything on serialization that specifies how to include this in the output.

Related to this