Hi Javier,

Order of the elements in your xml is important and it has to comply with the schema you are using.
According to your schema  element "section" should come before "module_type".

Regards,

v

Please respond to xerces-j-user <[EMAIL PROTECTED]>

To:        xerces-j-user <[EMAIL PROTECTED]>
cc:        

Subject:        Help with Schema Validation Behavior


Hi,

I've run into a problem with schema validation. From what I can see, the
validation behavior changes depending on the presence of a particular
element. After parsing a <module> element which a child <section> element
(such as the first one in the example below), it throws a SAXParseException
when it encounters the next <module> element with the following message:

org.xml.sax.SAXParseException: The content of element type "module" must
match
"(vendor,name,symbolic_name,so_name,cmp_rel_path?,dest_path?,bundle_name,vhost_uri?,guid,server_uri,sequence,section?,module_type)"

When there are no <module> elements with <section> children, the validation
works correctly.

This is a fragment of what I am trying to validate:

<module uri="module/mod_jk/752e23b0-0a00-00c9-6430-1d1b9e2893e2">
     <vendor>Covalent</vendor>
     <name>mod_jk</name>
     <symbolic_name>jk_module</symbolic_name>
     <so_name>mod_jk.so</so_name>
     <cmp_rel_path />
     <dest_path />
     <bundle_name>ers-1.0.tar.gz</bundle_name>
     <guid>752e23b0-0a00-00c9-6430-1d1b9e2893e2</guid>
     <server_uri uri="server/covalent-admin-TestServer" />
     <sequence>0</sequence>
     <module_type uri="module/mod_jk" />
     <section uri="752e23b0-0a00-00c9-6430-1d1b28cc4edd">
       <![CDATA[JkMount /jspui ajp13]]>
     </section>
</module>
<module uri="module/mod_rewrite/GUID_REWRITE_SERVER_101">
     <vendor>Covalent</vendor>
     <name>mod_rewrite</name>
     <symbolic_name>rewrite_module</symbolic_name>
     <so_name>mod_rewrite.so</so_name>
     <cmp_rel_path />
     <dest_path />
     <bundle_name>ers-1.0.tar.gz</bundle_name>
     <guid>GUID_REWRITE_SERVER_101</guid>
     <server_uri uri="server/covalent-admin-TestServer" />
     <sequence>0</sequence>
     <module_type uri="module/mod_rewrite" />
</module>

This is the schema section that describes the <module> complex type:

<xsd:complexType name="moduleType">
       <xsd:sequence>
           <xsd:element name="vendor" type="vendorType" />
           <xsd:element name="name" type="nameType" />
           <xsd:element name="symbolic_name" type="symbolic_nameType" />
           <xsd:element name="so_name" type="so_nameType" />
           <xsd:element name="cmp_rel_path" type="cmp_rel_pathType"
minOccurs="0" maxOccurs="1" />
           <xsd:element name="dest_path" type="dest_pathType" minOccurs="0"
maxOccurs="1" />
           <xsd:element name="bundle_name" type="bundle_nameType" />
           <xsd:element name="vhost_uri" type="vhost_uriType" minOccurs="0"
maxOccurs="1" />
           <xsd:element name="guid" type="guidType" />
           <xsd:element name="server_uri" type="server_uriType" />
           <xsd:element name="sequence" type="sequenceType" />
           <xsd:element name="section" minOccurs="0" maxOccurs="1">          
     <xsd:complexType>
                   <xsd:simpleContent>
                       <xsd:extension base="xsd:normalizedString">
                           <xsd:attribute name="uri" type="uriType"/>
                       </xsd:extension>
                   </xsd:simpleContent>
               </xsd:complexType>
           </xsd:element>
           <xsd:element name="module_type" type="module_typeType" />
       </xsd:sequence>
       <xsd:attribute name="uri" type="uriType" />
   </xsd:complexType>

Any help will be greatly appreciated.

Thanks.
javier

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to