Root element is missing

Sep 29, 2010 at 8:35 PM

 

Hi, i'm having the error below when i try to generate using command line.

Thanks for your time and for your contribute!

C:\linqtoxsd.1.1.0.41750-bin>LinqToXsd.exe ServiceSchema.xsd /lib: ServiceSchema
.dll
LinqToXsd: error TX0001: System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.Schema.Parser.StartParsing(XmlReader reader, String targetNames
pace)
   at System.Xml.Schema.Parser.Parse(XmlReader reader, String targetNamespace)
   at System.Xml.Schema.XmlSchemaSet.ParseSchema(String targetNamespace, XmlRead
er reader)
   at System.Xml.Schema.XmlSchemaSet.Add(String targetNamespace, XmlReader schem
aDocument)
   at XObjectsGenerator.XObjectsGenerator.Main(String[] args) in c:\programs\lin
qtoxsd\XObjects\Cmdline\XObjectsGenerator.cs:line 55

 

XDS FIle:

 

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Services">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Service" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="ClientBarcode" type="xs:string">
                                <xs:annotation>
                                    <xs:documentation xml:lang="EN">Unique Client's Service Code</xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="Receiver">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="ReceiverCode" type="xs:string" />
                                        <xs:element name="ReceiverName" type="xs:string" />
                                        <xs:element name="ReceiverAddress" type="xs:string" />
                                        <xs:element name="ReceiverPlace" type="xs:string" />
                                        <xs:element name="ReceiverPostalCode" type="xs:int" />
                                        <xs:element name="ReceiverPostalCodePlace" type="xs:string" />
                                        <xs:element name="ReceiverCountry" type="xs:string">
                                            <xs:annotation>
                                                <xs:documentation xml:lang="EN">ISO 3166-1</xs:documentation>
                                            </xs:annotation>
                                        </xs:element>
                                        <xs:element name="ReceiverContact" type="xs:string" />
                                    </xs:sequence>
                                    <xs:attribute name="ReceiverClientAddressId" type="xs:int" use="optional" />
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="Weight" nillable="true">
                                <xs:simpleType>
                                    <xs:restriction base="xs:decimal">
                                        <xs:minInclusive value="1" />
                                        <xs:totalDigits value="10" />
                                        <xs:fractionDigits value="3" />
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
                            <xs:element name="Amount" nillable="true">
                                <xs:annotation>
                                    <xs:documentation xml:lang="EN">Amount to collect from Receiver</xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                    <xs:restriction base="xs:decimal">
                                        <xs:totalDigits value="10" />
                                        <xs:fractionDigits value="3" />
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
                            <xs:element name="Notes" type="xs:string" />
                            <xs:element name="ShipFromDate" type="xs:dateTime" nillable="true" />
                            <xs:element name="DeliverToDate" type="xs:dateTime" nillable="true" />
                            <xs:element name="DocumentType" type="xs:string" />
                            <xs:element name="DocumentReference">
                                <xs:annotation>
                                    <xs:documentation xml:lang="EN">Service Description</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:simpleContent>
                                        <xs:extension base="xs:string" />
                                    </xs:simpleContent>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="Volume" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="Reference" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
                                        <xs:element name="Weight">
                                            <xs:simpleType>
                                                <xs:restriction base="xs:decimal">
                                                    <xs:minInclusive value="1" />
                                                    <xs:totalDigits value="10" />
                                                    <xs:fractionDigits value="3" />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                        <xs:element name="PhyWidth" nillable="true">
                                            <xs:simpleType>
                                                <xs:restriction base="xs:decimal">
                                                    <xs:totalDigits value="10" />
                                                    <xs:fractionDigits value="3" />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                        <xs:element name="PhyHeight" nillable="true">
                                            <xs:simpleType>
                                                <xs:restriction base="xs:decimal">
                                                    <xs:totalDigits value="10" />
                                                    <xs:fractionDigits value="3" />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                        <xs:element name="PhyDepth" nillable="true">
                                            <xs:simpleType>
                                                <xs:restriction base="xs:decimal">
                                                    <xs:totalDigits value="10" />
                                                    <xs:fractionDigits value="3" />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="InvoicePlanId" type="xs:int" use="optional" />
                        <xs:attribute name="ServiceTypeId" type="xs:int" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Sep 29, 2010 at 10:02 PM

I'm trying now to set it up on VS2008.

I got the sources, build it to a folder, setted the environmental variable, edited the project, aded the xsd and set build action to LinqToXsdSchema and compiled the project.

But i can't find any classes. What i'm i doing wrong here?

Thank you for your time