- From: <jomy@freesurf.ch>
- Date: Fri, 7 Nov 2003 09:01:41 +0100
- To: (unknown charset) xmlschema-dev@w3.org
Hi I am trying to validate the following xml file (SOAP format) ################### <?xml version="1.0" encoding="UTF-8" standalone="no"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.xmethods.net/sd/TemperatureService.wsdl" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Bodyy> <mns:getTemp xmlns:mns="urn:xmethods-Temperature" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <zipcode xsi:type="xsd:int">hallo</zipcode> </mns:getTemp> </SOAP-ENV:Bodyy> </SOAP-ENV:Envelope> ################### eg. check if the range of the parameters are valid --> note the built in error in the 'zipcode' tag. Following features and properties for the parser are set ################### public class ValidatingTest { public static void main( String[] args ) { DOMParser parser = new DOMParser(); Document doc = null; try { parser.setFeature( "http://xml.org/sax/features/validation", true ); parser.setFeature( "http://apache.org/xml/features/validation/schema", true ); } catch ( SAXNotRecognizedException e ) { e.printStackTrace(); } catch ( SAXNotSupportedException e ) { e.printStackTrace(); } try { parser.setProperty( "http://apache.org/xml/properties/schema/external-schemaLocation", "http://schemas.xmlsoap.org/soap/envelope/ " + "envelope.xml " + "http://www.w3.org/1999/XMLSchema " + "XMLSchema1999.xsd" ); } catch ( SAXNotRecognizedException e ) { System.out.print( "Unrecognized property: " ); System.out.println( "http://apache.org/xml/properties/schema/external-schemaLocation" ); } catch ( SAXNotSupportedException e ) { System.out.print( "Unrecognized property: " ); System.out.println( "http://apache.org/xml/properties/schema/external-schemaLocation" ); } try { parser.parse( "SoapClient.xml" ); doc = parser.getDocument(); } catch ( IOException ie ) { System.out.println( "Could not read file." ); } catch (SAXException e ) { System.out.print( "Could not create Document:" ); System.out.println( e.getMessage() ); } catch ( Exception e ) { e.printStackTrace(); } } } ################### If the XMLSchema is defined to xmlns:xsd="http://www.w3.org/2001/XMLSchema" and the Schema-instance is defined to xmlns:xsi="http://www.w3.org/2001/XMLSchama-instance" the parser reports following message ################### [Error] SoapClient.xml:11:47: cvc-datatype-valid.1.2.1: 'hallo' is not a valid value for 'integer'. [Error] SoapClient.xml:11:47: cvc-type.3.1.3: The value 'hallo' of element 'zipcode' is not valid. ################### whereas if the XMLSchema is set to xmlns:xsd=" http://www.w3.org/1999/XMLSchema" or the Schema- instance is defined to xmlns:xsi="http://www.w3.org/1999/XMLSchama-instance" no error is reported. I also want the parser to validate the file with the schema defined by the 'external-schemaLocation' property. The parser reads the external schema defined for http://schemas.xmlsoap.org/soap/envelope/ but not for the XMLSchema!! WHY is this??? should i alter any properties so that the file is validated properly? Thanks is advance, Jomy --- sunrise ADSL Modem, Aufschaltgebühren und Monatsgebühr bis Ende Jahr gratis: http://internet.sunrise.ch/de/internet/int_ads.asp --- sunrise ADSL Modem, Taxe mise en service, Taxe mensuelle jusqu'à la fin de l'année http://internet.sunrise.ch/fr/internet/int_ads.asp --- sunrise ADSL Modem, Tassa unica attivazione, Tasse mensili sino a fine anno http://internet.sunrise.ch/it/internet/int_ads.asp --- sunrise ADSL Modem, activation fees, and monthly fee free until the end of the year: http://internet.sunrise.ch/de/internet/int_ads.asp ---
Received on Friday, 7 November 2003 04:58:51 UTC