xml - XSD Non sense error. The attribute 'filter' is not allowed -


i got next xml:

<!-- language: xml --> <message name="msg1" type="simple">     <doc> message send </doc>     <parameters>         <parameter name="param1" type="byte" filter="2" mask="on">             <fields>                 <field encode="hex">                     <values>                         <value name="indicator" id="0"/>                     </values>                 </field>             </fields>         </parameter>         <parameter name="param2" type="byte" filter="3" mask="on"/>         <parameter name="param3" type="byte"/>     </parameters> </message> 

and xsd file one:

    <xs:element name="message" minoccurs="0" maxoccurs="unbounded">         <xs:complextype>             <xs:choice maxoccurs="unbounded">                 <xs:element ref="doc" minoccurs="0"/>                 <xs:element name="parameters" minoccurs="0">                     <xs:complextype>                         <xs:choice maxoccurs="unbounded">                             <xs:element name="parameter" minoccurs="0" maxoccurs="unbounded">                                 <xs:complextype>                                     <xs:choice maxoccurs="unbounded">                                         <xs:element ref="doc" minoccurs="0"/>                                         <xs:element name="fields" minoccurs="0">                                             <xs:complextype>                                                 <xs:choice maxoccurs="unbounded">                                                     <xs:element name="field" minoccurs="0" maxoccurs="unbounded">                                                         <xs:complextype>                                                             <xs:choice maxoccurs="unbounded">                                                                 <xs:element ref="doc" minoccurs="0"/>                                                                     <xs:element name="values" minoccurs="0">                                                                     <xs:complextype>                                                                         <xs:choice maxoccurs="unbounded">                                                                             <xs:element ref="doc" minoccurs="0"/>                                                                                 <xs:element name="value" minoccurs="1" maxoccurs="unbounded">                                                                                 <xs:complextype>                                                                                     <xs:attribute name="name" type="xs:string" use="required">                                                                                         <xs:annotation>                                                                                             <xs:documentation>name of value</xs:documentation>                                                                                         </xs:annotation>                                                                                     </xs:attribute>                                                                                     <xs:attribute name="id" type="xs:string" use="required">                                                                                         <xs:annotation>                                                                                             <xs:documentation>the value</xs:documentation>                                                                                         </xs:annotation>                                                                                     </xs:attribute>                                                                                 </xs:complextype>                                                                             </xs:element>                                                                         </xs:choice>                                                                     </xs:complextype>                                                                 </xs:element>                                                             </xs:choice>                                                             <xs:attribute name="encode" type="xs:string" default="hex">                                                                 <xs:annotation>                                                                     <xs:documentation>encoding</xs:documentation>                                                                 </xs:annotation>                                                             </xs:attribute>                                                         </xs:complextype>                                                     </xs:element>                                                 </xs:choice>                                             </xs:complextype>                                             <xs:unique name="unique_filed_name">                                                 <xs:selector xpath="field"/>                                                 <xs:field xpath="@name"/>                                             </xs:unique>                                         </xs:element>                                     </xs:choice>                                     <xs:attribute name="name" type="xs:string" use="required"/>                                     <xs:attribute name="type" type="xs:string"/>                                     <xs:attribute name="filter" type="xs:string"/>                                     <xs:attribute name="mask" type="xs:string"/>                                 </xs:complextype>                             </xs:element>                         </xs:choice>                     </xs:complextype>                     <xs:unique name="unique_parameter_name">                         <xs:selector xpath="parameter"/>                         <xs:field xpath="@name"/>                     </xs:unique>                 </xs:element>             </xs:choice>             <xs:attribute name="name">                 <xs:annotation>                     <xs:documentation>unique</xs:documentation>                 </xs:annotation>             </xs:attribute>             <xs:attribute name="type" type="messagetypes" use="required">                 <xs:annotation>                     <xs:documentation>select valid type</xs:documentation>                 </xs:annotation>             </xs:attribute>         </xs:complextype>     </xs:element> 

and got error without sense because added filter xsd:

element 'parameter', attribute 'filter': attribute 'filter' not allowed.

could me on explain me why got error seems difficult solve?

when paste "schema" xs:schema element , run it, get

error @ xs:element on line 3 column 69 of test.xsd:   attribute @minoccurs not allowed on element <xs:element> error @ xs:element on line 3 column 69 of test.xsd:   attribute @maxoccurs not allowed on element <xs:element> 

this suggests xs:element not top-level element, we're not seeing whole picture.

when fix that, lot more errors, these:

on line 6 of test.xsd:   element {doc} referenced, has not been declared on line 77 of test.xsd:   type {messagetypes} referenced, has not been declared 

when fix these errors, instance valid against schema.

i can conclude in cutting down real code section have posted, have inadvertently removed part wrong.

but agree message makes no sense. xsd processor using?


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -