cvc-elt.1.a: kann Nicht suchen Sie die Deklaration des Elements 'Um'
Ich weiß was der Fehler bedeutet, aber soweit ich sehen kann, die Bestellung element ordnungsgemäß im schema deklariert. Ist es etwas zu tun mit der Art, wie erkläre ich meinem schema? Ich bin nicht sicher, wie man über die Festsetzung der Erklärung. Irgendwelche Gedanken?
Meine XML -
<?xml version="1.0" encoding="ISO-8859-1"?>
<Order
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://lolteamrecruiter.com order.xsd">
<Customer id="n12">Aaron Rodgers</Customer>
<Product>
<Name>Old Time Souvenir Football</Name>
<SKU>244</SKU>
<Quantity>12</Quantity>
<Price currency="taco">21.95</Price>
<ShipTo>
<Street>135 Airline Highway</Street>
<City>Green Bay</City> <State>WI</State> <Zip>02882</Zip>
</ShipTo>
</Product>
<Product>
<Name>Official Packer Football</Name>
<SKU>256</SKU>
<Quantity>1</Quantity>
<Price currency="USD">France</Price>
<Discount>.10</Discount>
<ShipTo>
<GiftRecipient>Gertrude Rodgers</GiftRecipient>
<Street>271 Old Homestead Way</Street>
<City>San Francisco</City> <State>CA</State> <Zip>02895</Zip>
</ShipTo>
<GiftMessage>Happy Mothers Day to a great Mom! Love, Aaron</GiftMessage>
</Product>
<Subtotal currency='USD'>263.40</Subtotal>
<Tax rate="7.0"
currency='USD'>18.44</Tax>
<Shipping method="USPS" currency='USD'>8.95</Shipping>
<Total currency='USD' >290.79</Total>
</Order>
Mein XSD -
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Order">
<xs:complexType>
<xs:sequence>
<xs:element name="Customer" type="xs:string">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Product" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="SKU" type="xs:string"/>
<xs:element name="Quantity" type="xs:string"/>
<xs:element name="Price" type="currRestrict">
<xs:complexType>
<xs:attribute name="currency" type="currencyType" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Discount" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ShipTo">
<xs:complexType>
<xs:sequence>
<xs:element name="GiftRecipient" type="xs:string"/>
<xs:element name="street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="State" type="xs:decimal"/>
<xs:element name="Zip" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GiftMessage" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Subtotal" type="xs:decimal">
<xs:complexType>
<xs:attribute name="currency" type="currencyType" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Tax" type="xs:decimal">
<xs:complexType>
<xs:attribute name="currency" type="currencyType" use="required"/>
<xs:attribute name="rate" type="currencyType"/>
</xs:complexType>
</xs:element>
<xs:element name="Shipping" type="xs:string">
<xs:complexType>
<xs:attribute name="currency" type="currencyType" use="required"/>
<xs:attribute name="method" type="methodType" default="UPS"/>
</xs:complexType>
</xs:element>
<xs:element name="Total" type="xs:decimal">
<xs:complexType>
<xs:attribute name="currency" type="currencyType" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="currencyType">
<xs:restriction base="xs:string">
<xs:enumeration value="USD"/>
<xs:enumeration value="CAN"/>
<xs:enumeration value="GBP"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="methodType">
<xs:restriction base="xs:string">
<xs:enumeration value="UPS"/>
<xs:enumeration value="USPS"/>
<xs:enumeration value="Overnight"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="currRestrict">
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:schema>
möglich, Duplikat der cvc-elt.1: Cannot find the declaration of element 'MyElement'
InformationsquelleAutor user2789380 | 2013-09-30
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ihre Instanz-Dokument hat
xmlns="http://www.w3schools.com"
aber das schema hat keinen targetNamespace haben. Daher das schema gibt eine Erklärung, in der das element mit dem NamenOrder
im keine namespace, aber der validator ist auf der Suche nach einer Deklaration aus dem element mit dem NamenOrder
imhttp://www.w3schools.com
namespace.Hinzufügen
targetNamespace="http://www.w3schools.com"
zu denxs:schema
öffnenden tag und fixieren Sie diexsi:schemaLocation
zu entsprechen - es ist derzeit mit den falschen namespace-URI.Den Namensraum der Instanz-Dokument, das targetNamespace der schema-und namespace, die Sie zuordnen, um das schema mit
xsi:schemaLocation
müssen alle gleich sein.Hinzugefügt wurde die targetNamespace-Eröffnung-tag, funktioniert immer noch nicht.
Ich überblickte das schemaLocation-Attribut-mapping auf den ersten Blick - dass muss behoben werden, wie gut.
InformationsquelleAutor Ian Roberts