XML Validation with XSD in java mapping

Hi experts,
I have created an interface to send differents messages between bussines system, the bussiness system receiver is put in the message, to get this value I have a configuration file indicating the path of this field for each message type. In a java mapping I transform the message sent in this structure:
<document>
<message>HERE THE MESSAGE AS STRING</message>
<parameters>
<sender>HERE SENDER BUSSINESS SYSTEM</sender>
<receiver>HERE RECEIVER BUSSINESS SYSTEM</receiver>
</parameters>
</document>
the messaging interface works fine, but now I have to validate the XML vs XSD. I need doing in a java mapping because the messaging interface send the message and a email to sender in error case.
To do this validation I have implemented two java mappings that works fine in my local, the first way is with class Validator of java 5, but my system PI 7.1 return an error with this class. The second way is with SAX parse:
String schema = "XXXXXxsd";
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setNamespaceAware(true);
docBuilderFactory.setValidating(true);
docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema");
InputStream is = this.getClass().getClassLoader().getResourceAsStream(schema);
docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",is);
in my local works fine but in PI always return OK never fail.
For this moment the schema is hardcoded to do proofs, in the future will be loaded from my configuration file.
Any idea?
Thanks in advance
Jose

hi Jose,
PI 7.1 has a built in feature available called XML vaidations ..
your source xml can be validated against a XSD placed at a specific location on the PI server..
validation can be performed at adapter/integration engine
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1?quicklink=index&overridelayout=true

Similar Messages

  • XML validation with DTD in java 1.5 not supporting

    Hi,
    I am facing a problem regarding validation of xml file with DTD tag in it.
    I have disabled the parser through setValidating(false) method.
    xml file is not parsed in JRE 1.5.but it is parsed in JRE 1.6.
    Why this is showing such a behavior?
    I have used xerces 2.9.0,xml-api.jar and other jar regarding XML api but still it is giving error.
    please help me.
    please provide a jar file name or its issue resolution in jre 1.5 or 1.4.

    thanks for your prompt reply.
    I required that it should be completely disabled in jre 1.5(jdk1.5 or 1.4).
    I am using DOM Parsing.I have currently disabled with follwowing method,
    builderFactory.setValidating(false);
    builderFactory.setFeature("http://xml.org/sax/features/validation",
         false);
         builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
         builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
         builderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
         builderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
         factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
    in 1.6 it is working fine but I required that i have to disabled it.but it is giving a error in jre1.5.
    Exception in thread "main" java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
    I just want to disable the parsing in jdk version 1.5 or 1.4
    thanks in advance
    anand

  • XML validating with XSD

    Please clarify the following
    1) To validate a XML output with a XSD is it necessary to register the xsd in the database?.
    2) I tried running the below give command to register the .xsd file. It errored out with the below message. Do we need to some additional installation for having dbms_xmlschema in oracle database or am I missing something. My ver of oracle is 9.2.0.6.0.
    ERROR at line 2:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'DBMS_XMLSCHEMA.REGISTERSCHEMA' must be declared
    BEGIN
    DBMS_XMLSchema.registerSchema(
    schemaurl=>'http://ifsddev.na.abc.com/home/vick/105564/batchuserimport.xsd',
    schemadoc=>sys.UriFactory.getUri('/home/vick/105564/batchuserimport.xsd'));
    END;

    1) You could validate XML files against an XSD by using standard Java, PL/SQL, etc. functionality. Just to validate XML you do not need to register the schema in XDB. See e.g. http://www.oracle.com/technology/pub/articles/vohra_xmlschema.html
    2) Also see: DBMS_XMLSCHEMA.REGISTERSCHEMA' must be declared to know whether XML DB has been installed/configured.
    Regards, Ronald

  • XML validation with XSD, Cannot find the declaration of element 'rules'

    i am able to validate xml with XSD, from windows env, but same is not doing with linux, it is throwing error Cannot find the declaration of element 'rules'
    code here is
    validate(String aFilePath, String aSchemaFilePath)
    final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
              final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
              final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
    if(lSchemaFilePath == null){
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
    factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(aSchemaFilePath));
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    mValidator = new ValidationHandler();
    builder.setErrorHandler(mValidator);
    lDocument = builder.parse(aFilePath);
    if(mValidator.mErrorExist){
              }Thanks
    vittal

    here's the sample gml file.
    <?xml version="1.0" encoding="UTF-8"?>
    <ksj:Dataset gml:id="C01_DataSet" xmlns:ksj="http://nlftp.mlit.go.jp/ksj/schemas/ksj-app" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nlftp.mlit.go.jp/ksj/schemas/ksj-app AppSchema-C01-v1_0.xsd">
         <gml:description>CO1 description</gml:description>
         <gml:boundedBy>
              <gml:EnvelopeWithTimePeriod srsName="JGD2000 / (B, L)" frame="GC / JST">
                   <gml:lowerCorner>24.03 122.93</gml:lowerCorner>
                   <gml:upperCorner>45.52 145.82</gml:upperCorner>
                   <gml:beginPosition calendarEraName="Seireki">1965</gml:beginPosition>
                   <gml:endPosition calendarEraName="Seireki">1990</gml:endPosition>
              </gml:EnvelopeWithTimePeriod>
         </gml:boundedBy>
         <gml:Point gml:id="pt_1">          
              <gml:pos>24.33741667 123.73177778</gml:pos>
         </gml:Point>
         <gml:Point gml:id="pt_2">
              <gml:pos>24.33158333 124.10552778</gml:pos>
         </gml:Point>
         <gml:Point gml:id="pt_3">
              <gml:pos>26.28205556 127.73950000</gml:pos>
         </gml:Point>
         <gml:Point gml:id="pt_4">
              <gml:pos>26.23777778 127.96491667</gml:pos>
         </gml:Point>
         <ksj:Tide gml:id="fi_1">
              <ksj:position xlink:href="#pt_1"/>
              <ksj:springTideRange>13</ksj:springTideRange>
              <ksj:neapRange>5</ksj:neapRange>
              <ksj:averageHighTideInterval>69</ksj:averageHighTideInterval>
         </ksj:Tide>
         <ksj:TidalCurrent gml:id="fi_2">
              <ksj:position xlink:href="#pt_2"/>
              <ksj:risingTideCurrent>
                   <ksj:TidalCurrentInfo>
                        <ksj:currentDirection>14</ksj:currentDirection>
                        <ksj:currentSpeed>3</ksj:currentSpeed>
                   </ksj:TidalCurrentInfo>
              </ksj:risingTideCurrent>
              <ksj:fallingTideCurrent>
                   <ksj:TidalCurrentInfo>
                        <ksj:currentDirection>6</ksj:currentDirection>
                        <ksj:currentSpeed>3</ksj:currentSpeed>
                   </ksj:TidalCurrentInfo>
              </ksj:fallingTideCurrent>
         </ksj:TidalCurrent>
         <ksj:Marina gml:id="fi_3">
              <ksj:position xlink:href="#pt_3"/>
              <ksj:name>Marinafi3</ksj:name>
              <ksj:facilityCode>4703</ksj:facilityCode>
              <ksj:administrativeAreaCode codeSpace="AdministrativeAreaCode.xml">47205</ksj:administrativeAreaCode>
              <ksj:establishmentYear>
                   <gml:TimeInstant gml:id="ti_3">
                        <gml:timePosition>1987</gml:timePosition>
                   </gml:TimeInstant>
              </ksj:establishmentYear>
              <ksj:administratorClass>1</ksj:administratorClass>
              <ksj:numberOfKeptShips>
                   <ksj:NumberOfKeptShips>
                        <ksj:max>263</ksj:max>
                        <ksj:now>83</ksj:now>
                   </ksj:NumberOfKeptShips>
              </ksj:numberOfKeptShips>
              <ksj:frequencyOfSailing>900</ksj:frequencyOfSailing>
              <ksj:facilitiesAbove>facilitiesAbove1</ksj:facilitiesAbove>
              <ksj:facilitiesAbove>facilitiesAbove2</ksj:facilitiesAbove>
              <ksj:facilitiesAbove>facilitiesAbove3</ksj:facilitiesAbove>
              <ksj:facilitiesAbove>facilitiesAbove4</ksj:facilitiesAbove>
         </ksj:Marina>
         <ksj:MarinePhenomenonObservationFacilities gml:id="fi_4">
              <ksj:position xlink:href="#pt_4"/>
              <ksj:name>MarineName</ksj:name>
              <ksj:facilityCode>47001</ksj:facilityCode>
              <ksj:administrativeAreaCode codeSpace="AdministrativeAreaCode.xml">47323</ksj:administrativeAreaCode>
              <ksj:establishmentYear>
                   <gml:TimeInstant gml:id="ti_4">
                        <gml:timePosition>1983</gml:timePosition>
                   </gml:TimeInstant>
              </ksj:establishmentYear>
              <ksj:administratorClass>7</ksj:administratorClass>
              <ksj:observationItem>observationItem1</ksj:observationItem>
              <ksj:observationItem>observationItem2</ksj:observationItem>
              <ksj:observationItem>observationItem3</ksj:observationItem>
              <ksj:observationItem>observationItem4</ksj:observationItem>
              <ksj:observationItem>observationItem5</ksj:observationItem>
              <ksj:observationItem>observationItemOthers</ksj:observationItem>
         </ksj:MarinePhenomenonObservationFacilities>
    </ksj:Dataset>

  • Catch all error information while validating xml content with xsd schema

    Hi experts,
    I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below is a part of my java mapping.
    XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
    parser.setFeature( "http://xml.org/sax/features/validation" ,  true);
    parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
    parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); // schema is my schema name
    parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends DefaultHandler
    parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
    // In error handler, I comment all code so as not to throw any exception
    public class ParseErrorHandler extends DefaultHandler
         public void error(SAXParseException e) throws SAXException
              // sSystem.out.println("Error" + e.getMessage());
              // throw e;
         public void fatalError(SAXParseException e)
              // throw e;
              // System.out.println("SAP Fatal Error" + e.getMessage());
    Unfortunately the program always stopped while catching the first error. Check the below log.
    com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    ERRORS :
    cvc-simple-type : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
    cvc-data : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is is not valid with respoct to the corresponding simple type definition.
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is associated with invalid data.
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]/:Header[1]' is not valid with respect to it's complex type definition..
    cvc-element : element information item '/:ShipNotice[1]' is not valid with respect to it's complex type definition..
    -> com.sap.engine.lib.xml.parser.ParserException:
    I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error handler logic? Is there any body can make me get out of this?
    Thanks.

    <h6>Hi experts,
    <h6>
    <h6>I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all <h6>error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below <h6>is a part of my java mapping.
    <h6>XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
    <h6>parser.setFeature( "http://xml.org/sax/features/validation" ,  true);
    <h6>parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
    <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");          <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); <h6>// schema is my schema name
    <h6>parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends Default Handler
    <h6>parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
    <h6>
    <h6>// In error handler, I comment all code so as not to throw any exception
    <h6>public class ParseErrorHandler extends DefaultHandler
    <h6>{
    <h6>     public void error(SAXParseException e) throws SAXException
    <h6>     {
    <h6>          // sSystem.out.println("Error" + e.getMessage());
    <h6>          // throw e;
    <h6>     }
    <h6>
    <h6>     public void fatalError(SAXParseException e)
    <h6>     {
    <h6>          // throw e;
    <h6>          // System.out.println("SAP Fatal Error" + e.getMessage());
    <h6>
    <h6>     }
    <h6>
    <h6>}
    <h6>
    <h6>Unfortunately the program always stopped while catching the first error. Check the below log.
    <h6>
    <h6>com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    <h6>ERRORS :
    <h6>cvc-simple-type : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
    <h6>cvc-data : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is is not valid with respoct to the corresponding simple type definition.
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is associated with invalid data.
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]' <h6>is not valid with respect to it's complex type definition..
    <h6>cvc-element : element information item '/:ShipNotice[1]' is not valid with <h6>respect to it's complex type definition..
    <h6> -> com.sap.engine.lib.xml.parser.ParserException:
    <h6>
    <h6>
    <h6>I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error <h6>handler logic? Is there any body can make me get out of this?
    <h6>Thanks.

  • Xerces for XSD 1.1 Validation not working in Java Mapping

    Hi Experts,
    We are trying to use XSD 1.1 (assertion feature) validation for the XML payload in a Java mapping program. But I am getting the following exception:
    java.lang.IllegalArgumentException: http://www.w3.org/XML/XMLSchema/v1.1 at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:186)
    This is happing for the statement:
    SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1");
    The reason (apparently) is because it is not able to instantiate the class org.apache.xerces.jaxp.validation.XMLSchema11Factory , which is the Xerces implementation of the SchemaFactory class.
    I have tried following things so far -
    1. If I try to validate an xml against an xsd 1.1 schema in a standalone program, it works perfectly fine.
    2. If I try to deploy this whole functionality on to the server through an EAR (like an adapter module), there again it works.
    3. Also tried this before instantiating the SchemaFactory -
    System.setProperty("javax.xml.validation.SchemaFactory:http://www.w3.org/XML/XMLSchema/v1.1","org.apache.xerces.jaxp.validation.XMLSchema11Factory");
    4. I tried by creating the Imported Archive objects for all the Xerces jars that we require for validation, within the same SWCV, namespace. But still I get the same exception as above (IllegalArgumentException)
    5. The link [http://help.sap.com/saphelp_nw70/helpdata/en/b6/8097f5a5edea4f8dfc87ac87082b22/content.htm ] mentions that we need to place all the necessary jars at location <SAP_J2EE_Engine_install_dir>/cluster/server/bin/ext /. But even after placing the jars there, I get the same exception.
    I am not sure how we need to handle this. Has anybody faced a similar situation? Any suggestions?
    Regards,
    Sudheer

    Hi Stefan,
    Thanks for the reply.
    We are on PI 7.1 SP 06. The standard XML tools from jdk supports only XSD 1.0, as far as I know. And XSD 1.0 does not have the Assert feature (also known as, co-occurrence constraint). More details are provided here - [http://www.ibm.com/developerworks/library/x-xml11pt2/]
    To use XSD 1.1, we need a different implementation like Xerces-J. I am not sure how we can use it without external jars. I would like to mention again that I could achieve this by using an adapter module (EAR containing the jars), but I need to do this in Java Mapping (imported archive).
    Do you know how we can achieve this in any other way? Any other suggestions welcome.
    Thanks & Regards,
    Sudheer

  • XML Validation with multiple XSD files (referenced)

    Hello,
    I know that XML validation with version 7.1 is possible now. However I was provided with a set of XSD files that have references to each other and need to be placed in a hierachical file system order so that references can be resolved.
    An element <xsl:include schemaLocation="../../baseSchemas/baseSchema.xsd" /> is used for example. How can I handle that for XSD validation in PI? Can I create the same folder structure or do I need to put all XSD files in one directory and change the import manually?
    But most important question: Is it possible it all to use more than one XSD for schema validation?

    Dear Florian,
    I had encountered such case in a project.
    I was given 3 files. One main file and 2 others called Schema1.xsd and Schema2.xsd.
    This happens because your data type is not in single namespace, but is being referred across namespaces and software components.
    I am assuming that you have read the How to Guide for XML validations on PI 7.1
    Best way to do this quickly is as follows.
    1. Enable XML validation at adapter engine in the sender agreement.
    2. Post a message using HTTP post. (http://sappihttpclient.codeplex.com)
    3. Check communication channel in runtime workbench. There will be an error saying which is missing at what path.
    4. Create the path mentioned and place the file at that path.
    5. Repeat steps 2,3,4 for all the files.
    When you are done with this, you will get a proper validation error in case XML file is not correct. And remember to generate XSD from message type and not data type.
    Regards,
    Vikas
    Edited by: Vikas Aggarwal on Sep 2, 2009 8:45 PM
    Edited by: Vikas Aggarwal on Sep 2, 2009 8:48 PM

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

  • How to validate xml file with XSD schema ??  in JDK1.4.2

    How to validate xml file with XSD schema ?? in JDK1.4.2
    i dont want to use new Xerec Jar ...
    Suggest option ...

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • XML validation against XSD

    Hi,
    Does Oracle 8i (Release 3) support XML validations against XSD? I know Oracle 9i (Release 2) supports XML validations against XSD.
    Also, Does Oracle support XML validations against XDR?
    Any info is appreciated.
    Thanks
    Pavan

    Validate with DOMParser or the SAXParser.

  • How to validate an XML file with XSD Schema on JDK 1.4

    Hi
    I'm looking for samples how to validate xml files with xsd schema using jsdk 1.4
    Thank you.

    This is how.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
    dbfac.setNamespaceAware(true);
    SchemaFactory factory1 = SchemaFactory
                        .newInstance("http://www.w3.org/2001/XMLSchema");
    Schema schema = factory1.newSchema(new File("person.xsd"));
    dbfac.setSchema(schema);
    DocumentBuilder dbparser1 = dbfac.newDocumentBuilder();
    Document doc1 = dbparser1.parse(new File("person.xml"));
    Validator validator1 = schema.newValidator();
    DOMSource dm1 = new DOMSource(doc1);
    DOMResult domresult1 = new DOMResult();
    validator1.validate(dm1, domresult1);

  • Binding Xml file with Xsd Schema

    Hello
    everybody there.
    I am trying to make an application where word files are converted into xml.
    For that i have used org.exolab.castor and org.apache.poi.hwpf.
    Now the problem is that i was able to generate the xml file from word, but when i am binding it with XMLSchema.xsd following error is coming.
    java.lang.IllegalArgumentException: getSimpleType: the simple type 'formChoice' is not a built-in type as defined in XML Schema specification.
         at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1289)
         at org.exolab.castor.xml.schema.Schema.addSimpleType(Schema.java:583)
         at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:643)
         at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:198)
         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
         at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
         at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
         at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:430)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
         at TempHwpf.<init>(TempHwpf.java:35)
         at TempHwpf.main(TempHwpf.java:44)the code for binding my xml file with xsd schema is as under:-
    SourceGenerator sourcegen = new SourceGenerator();
    sourcegen.getVersion();
    System.out.println(sourcegen.getVersion());
    sourcegen.generateSource("XMLSchema.xsd","packagename");I have checked XMLSchema.xsd file, in that formChoice is already defined, than also error is coming.
    can anyone help me out. first i thought that XMLSchema.xsd which i have is not proper, but i downloaded it again from w3c.org,
    than also same error is shown.
    please help me out.
    waiting for reply.
    milind

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • XML Validation with External XSD

    Hi
    I have a xml file having DTD declaration, but my requirment is to validate this xml file with External XSD not with DTD which is declared inside the file.
    on executing java code below it is looking for DTD. how to supress validating against dtd.
    SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setValidating(false);
                   factory.setNamespaceAware(true);
                   SchemaFactory schemaFactory =
                       SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
                   factory.setSchema(schemaFactory.newSchema(
                       new Source[] {new StreamSource("C:\\vittal\\Project\\received\\development-1\\da_xsd\\daAuthoring.xsd")}));
                   SAXParser parser = factory.newSAXParser();
                   XMLReader reader = parser.getXMLReader();
                   reader.setErrorHandler(new LogErrorHandler());
                   reader.parse(new InputSource("C:\\vittal\\Project\\received\\A-ADD\\DAContentExamples_2\\SampleGuidance_1.xml"));error i am getting is License file saxon-license.lic not found. Running in non-schema-aware mode
    java.io.FileNotFoundException: C:\vittal\Project\received\A-ADD\DAContentExamples_2\daAuthoring.dtd (The system cannot find the file specified)

    Hi
    I have a xml file having DTD declaration, but my requirment is to validate this xml file with External XSD not with DTD which is declared inside the file.
    on executing java code below it is looking for DTD. how to supress validating against dtd.
    SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setValidating(false);
                   factory.setNamespaceAware(true);
                   SchemaFactory schemaFactory =
                       SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
                   factory.setSchema(schemaFactory.newSchema(
                       new Source[] {new StreamSource("C:\\vittal\\Project\\received\\development-1\\da_xsd\\daAuthoring.xsd")}));
                   SAXParser parser = factory.newSAXParser();
                   XMLReader reader = parser.getXMLReader();
                   reader.setErrorHandler(new LogErrorHandler());
                   reader.parse(new InputSource("C:\\vittal\\Project\\received\\A-ADD\\DAContentExamples_2\\SampleGuidance_1.xml"));error i am getting is License file saxon-license.lic not found. Running in non-schema-aware mode
    java.io.FileNotFoundException: C:\vittal\Project\received\A-ADD\DAContentExamples_2\daAuthoring.dtd (The system cannot find the file specified)

  • XML Validation with Java

    I have created a XML file with dom4j and the file confirmed to be valid when I read the file with Internet Explorer, a online XML validator and a free XML editor called "CookTop". However, when I attemp to read the XML file during the execution of an ant task I always get the XML parsing exception that one of my tag is not closed. I have even wrapped that test inside the tag as CDATA but that does not help as well. Do any one know what's happening? Here's my environment:
    JDK: 1.4.2_05
    Xerces: 2.6.2
    Ant: 1.5.3
    Thanks so much in advance.
    I've been pumping my head into the wall for hours : p

    Can i know where to download the CookTop?or CookTop2?

  • XML file validation with XSD and loading to database relational table

    Hi all,
    I have some xml files coming to my unix directory. I will be having an XSD for those. My task is to validate those xml against given xsd and load the corresponding data into oracle relational tables with sqlloader only.
    Please help me to accomplish. and let me know the contents of control file ( for SQLLOADER) if i want to load the xml directly to database.
    Unix and/or PLSQL suggestions both are welcome.

    My problem area is loading the XML to Oracle relational tables using sqlloader.
    suppose, the xml is <?xml version="1.0"?>
    <Customers>
    <Customer>
    <CustID>1</CustID>
    <Company>Bell South</Company>
    <City>New York</City>
    </Customer>
    <Customer>
    <CustID>2</CustID>
    <Company>Barnes &amp; Noble</Company>
    <City>New York</City>
    </Customer>
    <Customer>
    <CustID>3</CustID>
    <Company>Comp USA</Company>
    <City>Tampa</City>
    </Customer>
    <Customer>
    <CustID>4</CustID>
    <Company>Borders</Company>
    <City>Charlotte</City>
    </Customer>
    </Customers>
    and I have a relational table
    CREATE TABLE CUSTOMERS
    CUSTID NUMBER,
    COMPANY VARCHAR2(100 BYTE),
    CITY VARCHAR2(100 BYTE)
    how to insert the xml data into the table???
    please help..
    Edited by: nuon on Oct 25, 2010 6:25 AM

Maybe you are looking for

  • How can I install ipad apps on iphone 6 plus?

    How can I install ipad apps on iphone 6 plus?

  • Clean up AQ$_CT_capturename_P table

    I have async distributed hotlog cdc setup on 9.2 databases. There are many changes capture daily on the source database and I notice that the AQ$_CT_capturename_P in the source cdc schema is growing extremely fast. It's at 8GB with 5 millions record

  • Error Activating Projects

    Hi Everyone, Anytime I try and activate any file I receive this error. Repository operation failed Repository request failed. Cause: Repository: User is not authorized to execute specified operation;User 'DEV_2I2WXQMNCDJHDX722VDLI317U' has no authori

  • How do I achieve HDR in Lightroom?

    I've heard that Lightroom enables me to create HDR images by combining the exposures of three separate images.  Having just bought Lightroom, I'm struggling to find out how to do that.  Have I just been misinformed?

  • Cannot send faxes w/ Apple USB modem, can you offer some help please?

    Hi, I am using the Apple USB modem connected to my brand new MacBook and so far could not send any faxes. The modem is working because I was able to receive 1 fax (which I sent to myself from my Nokia 9300i). The monitor tells me that: dialing... ok,