Still can't see what the problem is, there is no mention of restrictions on
using the xsi:type apart from if declared  as a attributed!



                                                                                       
                             
                          "Anoop Singh"                                                
                             
                          <anoop.singh@w      To:      <[EMAIL PROTECTED]>  
                             
                          ipro.com>           cc:                                      
                             
                                              Subject:      RE: Schema validation 
problem with xsi:type             
                          17/12/2002                                                   
                             
                          12:26                                                        
                             
                                                                                       
                             
                                                                                       
                             




Plz. go thgh the following link

http://www.ccs.neu.edu/research/demeter/DemeterJSR31/implementation/docs/Restrictions


Regds
Anoop Singh

-----Original Message-----
From:     [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent:     Tue 12/17/2002 4:58 PM
To:  [EMAIL PROTECTED]
Cc:
Subject:  Schema validation problem with xsi:type

I have problems when attempting to use the xsi:type parameter in a schema
with Xerces. Here is a sample schema.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <xs:complexType name="_Transaction" abstract="true">
    <xs:sequence>
      <xs:element name="user_id"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="_Transaction_Login">
    <xs:complexContent>
      <xs:extension base="_Transaction">
        <xs:sequence>
           <xs:element name="password"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="_Transaction_Submit">
    <xs:complexContent>
      <xs:extension base="_Transaction">
        <xs:sequence>
           <xs:element name="application_number">
           </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="Request">
  <xs:complexType name="">
    <xs:sequence>
      <xs:element name="Transaction" type="_Transaction"/>
    </xs:sequence>
  </xs:complexType>
  </xs:element>

</xs:schema>

If I validate it with the following XML in XML Spy then it works fine.

<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <Transaction xsi:type="_Transaction_Login">
    <user_id>test</user_id>
    <password>xxx</password>
  </Transaction>
</Request>

Under Xerces it reports the following  error

Parsing error: Document root element "Request", must match DOCTYPE root
"null".
Parsing error: Document is invalid: no grammar found.

The test code I'm using is

               this._parser = new SAXParser();
               this._parser.setFeature
("http://xml.org/sax/features/validation",true);
                         this._parser.setProperty
("
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
",
                    "/test/test3.xsd");
               this._parser.setErrorHandler(this.new B2BSaxHandler());

               String xml = "<Request xmlns:xsi
=\"http://www.w3.org/2001/XMLSchema-instance\";>"+
                    "<Transaction xsi:type=\"_Transaction_Login\">"+
                    "<user_id>test</user_id>"+
                    "<password>xxx</password>"+
                    "</Transaction>"+
                    "</Request>";


               System.out.println(xml);
               StringReader data = new StringReader(xml);
               _parser.parse(new org.xml.sax.InputSource(data));
               _parser.reset();

Any help is appreciated!

Jasbir








(See attached file: InterScan_Disclaimer.txt)

Attachment: InterScan_Disclaimer.txt
Description: Binary data

==================================================

HFC Bank Disclaimer

The information in this Email belongs to HFC Bank plc. It is intended for the use of 
the individual or entity to which it is addressed and may contain information that is 
privileged, confidential and exempt from disclosure under applicable law. If you are 
not the intended recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents of this Email is 
prohibited. If you have received this Email in error, please notify us immediately by 
telephone on 01344 890000 and delete the Email from your system and destroy all copies 
which you have made of the same.  Thank you. 

HFC Bank plc Company Registration Number - 1117305 England 
Registered Office: North Street, Winkfield Berkshire SL4 4TD.

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

Reply via email to