xsd:anyAttribute and processContents="lax": valid if a declaration exists : anyAttribute « XML Schema « XML






xsd:anyAttribute and processContents="lax": valid if a declaration exists


File: Data.xml

<?xml version="1.0"?>
<person xmlns="http://www.java2s.com"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.java2s.com Schema.xsd"
        id1="id1"
        id2="id2"
        id3="id3"
        id4="id4"
        >
 
  <firstname>
  </firstname>
  <lastname/>
</person>


File: Schema.xsd

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.java2s.com"
            xmlns="http://www.java2s.com"
            elementFormDefault="qualified">
    <xsd:element name="person">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="firstname" type="xsd:string"/>
          <xsd:element name="lastname" type="xsd:string"/>
        </xsd:sequence>
        <xsd:anyAttribute processContents="lax"/>
      </xsd:complexType>
    </xsd:element>

</xsd:schema>

 








Related examples in the same category

1.xsd:anyAttribute and processContents="skip": it only needs top be well-formed