sql - "The markup in the document preceding the root element must be well-formed" error while validating xml -
i'm new xml, pls forgive me dumb question. have such schema
<?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified"> <xs:element name="product"> <xs:complextype> <xs:sequence> <xs:element name= "name" type = "xs:string"/> <xs:element name= "price" type = "xs:decimal"/> <xs:element name= "fish"> <xs:complextype> <xs:sequence> <xs:element name= "type"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="herbivourus"/> <xs:enumeration value="predator"/> <xs:enumeration value="detritophages"/> <xs:enumeration value="omnivourus"/> </xs:restriction> </xs:simpletype> </xs:element> <xs:element name="clown"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="character" > <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="slow"/> <xs:enumeration value="quiet"/> <xs:enumeration value="fearful"/> <xs:enumeration value="motile"/> </xs:restriction> </xs:simpletype> </xs:element> <xs:element name="agressiveness"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="high"/> <xs:enumeration value="medium"/> <xs:enumeration value="low"/> </xs:restriction> </xs:simpletype> </xs:element> <xs:element name="gotspikes" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="lionfish"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="gotspikes" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="triggerfish"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="needshideout" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="trumpetfish"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="gregarious" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="yellow_boxfish"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="gregarious" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="reptile"> <xs:complextype> <xs:sequence> <xs:element name="compatiblewithfish" type= "xs:boolean"/> <xs:element name="needsland" type= "xs:boolean"/> <xs:element name="turtle"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="gregarious" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="decoration"> <xs:complextype> <xs:sequence> <xs:element name="size" type= "xs:int"/> <xs:element name="alga"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="doesgetsoxygen" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="castle"> <xs:complextype> <xs:sequence> <xs:element name="serialversionuid" type="xs:long"/> <xs:element name="ishideout" type="xs:boolean"/> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> </xs:complextype> </xs:element> </xs:schema>
and there xml
<?xml version="1.0" encoding="utf-8"?> xsi:schemalocation="tank.xsd"> <product> <<fish> <clown name = "clown"> <serialversionuid> -7114819146190513293l </serialversionuid> <character>quiet</character> <aggressiveness>low</aggressiveness> <gotspikes>false</gotspikes> <type> herbivourus</type> <price> 51000 </price> </clown> <lionfish> <serialversionuid> 5302423581237004299l </serialversionuid> <price>25000</price> <name> lionfish </name> <type> herbivourus</type> <gotspikes>true</gotspikes> </lionfish> <triggerfish> <serialversionuid> 4102072582518577014l </serialversionuid> <price>27000</price> <name> triggerfish </name> <type> herbivourus</type> <needshideout>true</needshideout> </triggerfish> <trumpetfish> <serialversionuid> -6802935171639886135l </serialversionuid> <price>34500</price> <name> trumpetfish </name> <type> herbivourus</type> <gregarious> true</gregarious> </trumpetfish> <yellow_boxfish> <serialversionuid> 4377441012026861992l </serialversionuid> <price>56900</price> <name> yellow_boxfish </name> <type> herbivourus</type> <gregarious> true</gregarious> </yellow_boxfish> </fish> <reptile> <turtle> <serialversionuid> -3606085842515781016l </serialversionuid> <price>129000</price> <name> turtle </name> <compatiblewithfish> true</compatiblewithfish> <needsland>true</needsland> <gregarious> true </gregarious> </turtle> </reptile> <decoration> <alga> <serialversionuid> -4311096533955485410l </serialversionuid> <price>15000</price> <name> alga </name> <doesgetoxygen> true</doesgetoxygen> </alga> <castle> <serialversionuid> 1l </serialversionuid> <price>110300</price> <name> castle </name> <ishideout> true</ishideout> </castle> </decoration> </product>
also btw have such class hierarchy
- abstract product
- abstract fish
- clown
- lionfish
- triggerfish
- trumpetfish
- yellow_boxfish
- abstract reptile
- turtle
- abstract decoration
- alga
- calstle output of validator "the markup in document preceding root element must well-formed" please point me what's wrong
- abstract fish
p.s. need show in xsd hierarchy of classes , base class product class , childs have field name , price, i'm not sure shows correctly in schema :c , btw im going instantiate classes
because have not configure root element proper config matters
<?xml version="1.0" encoding="utf-8"?> <!doctype struts public "-//apache software foundation//dtd struts configuration 2.1//en" "http://struts.apache.org/dtds/struts-2.1.dtd"> <root> paste code here </root>
so paste code according suggested in example. paste code in root clauses whatever is. , error shorted out.
Comments
Post a Comment