Error in xsd validation....

Hi All,

   I am trying to validate a xml file against a xsd file. My code is this :

            DOMParser parser = new DOMParser();
            parser.setFeature("http://xml.org/sax/features/validation", 
true);
            
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
            ErrorChecker errors = new ErrorChecker();
            parser.setErrorHandler(errors);
            parser.parse("Token.xml");
            Document doc = parser.getDocument();

   This works fine and it validates the Token.xml file, which is this :

   <ValidateIdentificationTokenRequest  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
xsi:noNamespaceSchemaLocation="Token.xsd">
      <InputATBFlightCoupon>
          <UnparsedData>BOARDCPN#D8303</UnparsedData>
      </InputATBFlightCoupon>
   </ValidateIdentificationTokenRequest>

   But my problem is, when I input the same xml as a String ;

           String str = "The above mentioned xml";
           parser.parse(str);

   it throws an exception.

java.net.MalformedURLException: no protocol:  
<ValidateIdentificationTokenRequest        
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       
xsi:noNamespaceSchemaLocation="/Token.xsd">
<InputATBFlightCoupon><UnparsedData>BOARDCPN#D8303</UnparsedData>
</InputATBFlightCoupon></ValidateIdentificationTokenRequest>

   at java.net.URL.<init>(URL.java:473)
   at java.net.URL.<init>(URL.java:376)
   at java.net.URL.<init>(URL.java:330)
   at 
org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:719)
   at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity    
(XMLEntityManager.java:666)
   atorg.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource
   (XMLDocumentScannerImpl.java:251)
   at org.apache.xerces.parsers.StandardParserConfiguration
   .setInputSource(StandardParserConfiguration.java:440)
   at org.apache.xerces.parsers.StandardParserConfiguration.parse
   (StandardParserConfiguration.java:520)
   at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
   at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:152)
   at ssd.XMLTest.main(XMLTest.java:37)


   Please be kind enough to help me to solve this problem. Thanks in 
advance.


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Received on Wednesday, 6 February 2002 08:11:51 UTC