Unsure of XML and XSD errors when validating -
i having trouble getting files validate.
here errors getting.
-errors in xml document: 9: 23 cvc-complex-type.2.4.d: invalid content found starting element 'boardrelationships'. no child element expected @ point. 25: 23 cvc-complex-type.2.4.d: invalid content found starting element 'boardrelationships'. no child element expected @ point. 40: 23 cvc-complex-type.2.4.d: invalid content found starting element 'boardrelationships'. no child element expected @ point. 54: 23 cvc-complex-type.2.4.d: invalid content found starting element 'boardrelationships'. no child element expected @ point. 67: 23 cvc-complex-type.2.4.d: invalid content found starting element 'boardrelationships'. no child element expected @ point. -errors in file xml-schema: 11: 62 s4s-elt-must-match.1: content of 'name' must match (annotation?, (simpletype | complextype)?, (unique | key | keyref)*)). problem found starting at: element.
i post both xml document code , xsd schema below. i'm new this, i'm not sure i'm doing wrong. have changed formatting of files around still same errors...
<?xml version="1.0"?> <keyexecutives> <keyexecutive> <name> <first>lawrence</first> <middle>edward</middle> <last>page</last> </name> <boardrelationships>22</boardrelationships> <titles> <title>co-founder</title> <title>chief executive officer</title> <title>director</title> <title>member of acquisition committee</title> <title>member of executive committee</title> </titles> <age>42</age> </keyexecutive> <keyexecutive> <name> <first>sergey</first> <middle></middle> <last>brin</last> </name> <boardrelationships>22</boardrelationships> <titles> <title>co-founder</title> <title>director</title> <title>member of acquisition committee</title> <title>member of executive committee</title> </titles> <age>41</age> </keyexecutive> <keyexecutive> <name> <first>eric</first> <middle>e.</middle> <last>schmidt ph.d.</last> </name> <boardrelationships>137</boardrelationships> <titles> <title>executive chairman</title> <title>chairman of executive committee</title> <title>chairman of acquisition committee</title> </titles> <age>60</age> </keyexecutive> <keyexecutive> <name> <first>ruth</first> <middle>m.</middle> <last>porat</last> </name> <boardrelationships>10</boardrelationships> <titles> <title>chief financial officer</title> <title>senior vice president</title> </titles> <age>58</age> </keyexecutive> <keyexecutive> <name> <first>meir</first> <middle></middle> <last>brand</last> <?xml version="1.0"?> <!-- xsd schema complex_apoole33_it_must_validate.xml --> <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema"> <xsd:element name="keyexecutives"> <xsd:complextype> <xsd:sequence> <xsd:element name="keyexecutive" maxoccurs="unbounded"> <xsd:complextype> <xsd:sequence> <xsd:element name="name"> <xsd:element name="first" type="xsd:string"/> <xsd:element name="middle" type="xsd:string" minoccurs="0"/> <xsd:element name="last" type="xsd:string"/> <xsd:element name="boardrelationships" type="xsd:integer" minoccurs="0"/> <xsd:complextype> <xsd:sequence> <xsd:element name="titles"> <xsd:element name="title" type="xsd:string" maxoccurs="unbounded"/> <xsd:element name="age" type="xsd:integer" minoccurs="0"/> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:schema>
with below (numerous structural) fixes xsd (and elimination of cut-off elements xml), xml validate against xsd:
xml
<?xml version="1.0"?> <keyexecutives> <keyexecutive> <name> <first>lawrence</first> <middle>edward</middle> <last>page</last> </name> <boardrelationships>22</boardrelationships> <titles> <title>co-founder</title> <title>chief executive officer</title> <title>director</title> <title>member of acquisition committee</title> <title>member of executive committee</title> </titles> <age>42</age> </keyexecutive> <keyexecutive> <name> <first>sergey</first> <middle></middle> <last>brin</last> </name> <boardrelationships>22</boardrelationships> <titles> <title>co-founder</title> <title>director</title> <title>member of acquisition committee</title> <title>member of executive committee</title> </titles> <age>41</age> </keyexecutive> <keyexecutive> <name> <first>eric</first> <middle>e.</middle> <last>schmidt ph.d.</last> </name> <boardrelationships>137</boardrelationships> <titles> <title>executive chairman</title> <title>chairman of executive committee</title> <title>chairman of acquisition committee</title> </titles> <age>60</age> </keyexecutive> <keyexecutive> <name> <first>ruth</first> <middle>m.</middle> <last>porat</last> </name> <boardrelationships>10</boardrelationships> <titles> <title>chief financial officer</title> <title>senior vice president</title> </titles> <age>58</age> </keyexecutive> </keyexecutives>
xsd
<?xml version="1.0"?> <!-- xsd schema complex_apoole33_it_must_validate.xml --> <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema"> <xsd:element name="keyexecutives"> <xsd:complextype> <xsd:sequence> <xsd:element name="keyexecutive" maxoccurs="unbounded"> <xsd:complextype> <xsd:sequence> <xsd:element name="name"> <xsd:complextype> <xsd:sequence> <xsd:element name="first" type="xsd:string"/> <xsd:element name="middle" type="xsd:string" minoccurs="0"/> <xsd:element name="last" type="xsd:string"/> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="boardrelationships" type="xsd:integer" minoccurs="0"/> <xsd:element name="titles"> <xsd:complextype> <xsd:sequence> <xsd:element name="title" type="xsd:string" maxoccurs="unbounded"/> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="age" type="xsd:integer" minoccurs="0"/> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:schema>
Comments
Post a Comment