Disable XML Validation  (with default table defined in schema)

Hi,
Is there a way to disable validations when an XML is put into a XMLType table?
I have registered my XML as,
vsql := 'BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => ''ETV_EPG.xsd'',
SCHEMADOC => bfilename(''MYDIR'',''MY_XSD.xsd''),
OWNER => ''EPGMANAGER'',
CSID => nls_charset_id(''AL32UTF8'')
END;';
And my XSD has the following,
<xs:element name="Data" type="ProgramGuide" xdb:defaultTable="MY_TAB" />
which causes any XML file (which adheres to MY_XSD) which I FTP to Oracle be ingested to MY_TAB.
However my XSD has several Key and Keyref elements which causes a lot of validations to take place and slows down the ingest. I want to skip those validations as I am confident that the XML conforms to the schema.
Thanks in advance,
Vishal

user5837642 wrote:
Hi,
Is there a way to disable validations when an XML is put into a XMLType table?
I have registered my XML as,
vsql := 'BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => ''ETV_EPG.xsd'',
SCHEMADOC => bfilename(''MYDIR'',''MY_XSD.xsd''),
OWNER => ''EPGMANAGER'',
CSID => nls_charset_id(''AL32UTF8'')
END;';
And my XSD has the following,
<xs:element name="Data" type="ProgramGuide" xdb:defaultTable="MY_TAB" />
which causes any XML file (which adheres to MY_XSD) which I FTP to Oracle be ingested to MY_TAB.
However my XSD has several Key and Keyref elements which causes a lot of validations to take place and slows down the ingest. I want to skip those validations as I am confident that the XML conforms to the schema.
Are you using Binary storage or Object relational storage? You may want to have a look at this section of the documentation to see if it helps. In particular, you may want to test if using setSchemaValidated() makes any difference.

Similar Messages

  • How to disable xml validation

    I'm trying to write an SVG parser using Xerces. The problem is that when the SVG file contains the doctype tag <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">my program throws the following exception:
    java.net.UnknownHostException: www.w3.org
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
            at java.net.Socket.connect(Socket.java:507)
            at java.net.Socket.connect(Socket.java:457)
    etc.If I remove <!DOCTYPE> tag, it works fine. According to what I read here, it's necessary to disable XML validation. The Xerces API documentation says that there is a method setValidation() in org.apache.xerces.framework.XMLParser but I can't locate it. Moreover, I don't see any org.apache.xerces.framework package in Xerces supplied with NetBeans 5.0 nor in Xerces 2.8.0 downloaded from apache.org (the XMLParser class available to me is located in org.apache.xerces.parsers).
    My question is simple:
    How to disable XML validation if the setValidation() method is not avaliable
    OR
    how to make the setValidation method available to my program?
    I'm really confused :(
    Here is the code:
    package svgviewer;
    import java.io.File;
    import org.w3c.dom.*;
    import org.w3c.dom.traversal.*;
    import org.apache.xerces.parsers.*;
    public class SVGFileParser {
        public void parse(String filename) throws Exception {
            File file = new File(filename);
            DOMParser parser = new DOMParser();
            parser.parse(file.toURL().toString()); //exception is thrown if doctype tag is present in the svg file

    You're solving the wrong problem here. Turning off validation won't help, because DTDs don't only do validation. Even non-validating parsers have to read the DTD in case it contains entity definitions, for example.
    If you want to stop the parser from looking for the DTD then you write a EntityResolver and apply it to the parser. The EntityResolver should be just like the one in the example in the API docs except it should return new InputSource(new StringReader("")).

  • 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

  • Cant load schema-based xml-file to default table via http/ftp

    Hola,
    we are running ORACLE 10.2.0.3.0 with installed XML-DB.
    HTTP- and ftp-listeners where configured successfully, we are able to register a designed XSD-file within XML-DB. Autogen types and tables where set "true" and default table for root object within xsd and several type objects where also created successful.
    Oracle DB is running on a Linux environment, it is possible to establish a WEBDAV-connection to this machine via my Windows client.
    As far as I understood the Oracle examples, there should be some kind of automatism. Putting a valid (and registered via xsi:noNamespaceSchemaLocation=<pointing to xsd-file>) XML file into my WEBDAV folder should create an XML object in the XML repository AND create a dataset in the default table.
    Last thing doesn´t work.
    Any idea?!

    Can you try this simple example
    SQL> set echo on
    SQL> spool testase.log
    SQL> --
    SQL> connect / as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = OTN
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user OTN cascade
    User dropped.
    Elapsed: 00:00:00.18
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to OTN identified by OTN
    Grant succeeded.
    Elapsed: 00:00:00.09
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user OTN default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> -- create or replace directory XMLDIR as '&XMLDIR'
    SQL> -- /
    SQL> var SCHEMAURL    varchar2(256)
    SQL> VAR XMLSCHEMA    CLOB;
    SQL> VAR INSTANCE     CLOB;
    SQL> VAR DOCPATH      VARCHAR2(700)
    SQL> --
    SQL> set define off
    SQL> --
    SQL> alter session set events='31098 trace name context forever'
      2  /
    Session altered.
    Elapsed: 00:00:00.01
    SQL> begin
      2    :SCHEMAURL:= 'http://oradb4.min.local:8080/public/CSBF/xsd/CSBF_Vergabemeldung_Formular.xsd';
      3    :XMLSCHEMA :=
      4  '<?xml version="1.0" encoding="UTF-8"?>
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
      6     <xs:simpleType name="string_5">
      7             <xs:restriction base="xs:string"><xs:maxLength value="5"/></xs:restriction>
      8     </xs:simpleType>
      9     <xs:simpleType name="string_6">
    10             <xs:restriction base="xs:string"><xs:maxLength value="6"/></xs:restriction>
    11     </xs:simpleType>
    12     <xs:simpleType name="string_8">
    13             <xs:restriction base="xs:string"><xs:maxLength value="8"/></xs:restriction>
    14     </xs:simpleType>
    15     <xs:simpleType name="string_20">
    16             <xs:restriction base="xs:string"><xs:maxLength value="20"/></xs:restriction>
    17     </xs:simpleType>
    18     <xs:simpleType name="string_30">
    19             <xs:restriction base="xs:string"><xs:maxLength value="30"/></xs:restriction>
    20     </xs:simpleType>
    21     <xs:simpleType name="string_60">
    22             <xs:restriction base="xs:string"><xs:maxLength value="60"/></xs:restriction>
    23     </xs:simpleType>
    24     <xs:element name="CSBF_Vergabemeldung" xdb:defaultTable="CSBF_VERGABE_INFO_XML">
    25             <xs:complexType>
    26                     <xs:sequence>
    27                             <xs:element name="CSBF_Vergabemeldung_Info">
    28                                     <xs:complexType>
    29                                             <xs:sequence>
    30                                                     <xs:element name="Identnummer" type="string_30"/>
    31                                                     <xs:element name="Version_CSBF_Vergabevermerk_Formular" type="string_30"/>
    32                                                     <xs:element name="Fertigstellung_Vergabevermerk" type="xs:date"/>
    33                                             </xs:sequence>
    34                                     </xs:complexType>
    35                             </xs:element>
    36                             <xs:element name="Strassenbaudienststelle">
    37                                     <xs:complexType>
    38                                             <xs:sequence>
    39                                                     <xs:element name="Kennung" type="string_8"/>
    40                                                     <xs:element name="Strassenbau_Organisation_Bezeichnung" type="string_60"/>
    41                                                     <xs:element name="Adresszeile_2" type="string_60" minOccurs="0"/>
    42                                                     <xs:element name="Adresszeile_3" type="string_60" minOccurs="0"/>
    43                                                     <xs:element name="Adresszeile_4" type="string_60" minOccurs="0"/>
    44                                                     <xs:element name="Strasse" type="string_60"/>
    45                                                     <xs:element name="PLZ" type="string_6"/>
    46                                                     <xs:element name="Ort" type="string_60"/>
    47                                                     <xs:element name="NUTS" type="string_5"/>
    48                                                     <xs:element name="Telefon" type="string_20" minOccurs="0"/>
    49                                                     <xs:element name="Fax" type="string_20" minOccurs="0"/>
    50                                                     <xs:element name="E_Mail" type="string_30"/>
    51                                             </xs:sequence>
    52                                     </xs:complexType>
    53                             </xs:element>
    54                     </xs:sequence>
    55             </xs:complexType>
    56     </xs:element>
    57  </xs:schema>';
    58    :DOCPATH := '/public/CSBF_Vergabemeldung.xml';
    59    :INSTANCE :=
    60  '<?xml version="1.0" encoding="ISO-8859-15"?>
    61  <CSBF_Vergabemeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://oradb4.min.local:8080/public/CSBF/xsd/CSBF
    _Vergabemeldung_Formular.xsd">
    62     <CSBF_Vergabemeldung_Info>
    63             <Identnummer>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Identnummer>
    64             <Version_CSBF_Vergabevermerk_Formular>xxxxxxxxxxxxxxxx</Version_CSBF_Vergabevermerk_Formular>
    65             <Fertigstellung_Vergabevermerk>1900-01-01</Fertigstellung_Vergabevermerk>
    66     </CSBF_Vergabemeldung_Info>
    67     <Strassenbaudienststelle>
    68             <Kennung>xxxxx</Kennung>
    69             <Strassenbau_Organisation_Bezeichnung>xxxxxxx</Strassenbau_Organisation_Bezeichnung>
    70             <Adresszeile_2>xxxxxxxxxxxxx</Adresszeile_2>
    71             <Adresszeile_3>xxxxxxxxxxxxxx</Adresszeile_3>
    72             <Adresszeile_4>xxxxxxxxxxxxxxxxx</Adresszeile_4>
    73             <Strasse>xxxxxxxxxxxxxx</Strasse>
    74             <PLZ>xxxxx</PLZ>
    75             <Ort>xxxxxxxxxxxxxx</Ort>
    76             <NUTS>xxxxx</NUTS>
    77             <Telefon>xxxxxxxxxxx</Telefon>
    78             <Fax>xxxxxxxxxxx</Fax>
    79             <E_Mail>[email protected]</E_Mail>
    80     </Strassenbaudienststelle>
    81  </CSBF_Vergabemeldung>';
    82  end;
    83  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      schemaurl       => :SCHEMAURL,
      5      schemadoc       => :XMLSCHEMA,
      6      local           => TRUE,
      7      genTypes        => TRUE,
      8      genBean         => FALSE,
      9      genTables       => TRUE
    10    );
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.80
    SQL> desc CSBF_VERGABE_INFO_XML
    Name                                                                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://oradb4.min.local:8080/public/CSBF/xsd/CSBF_Vergabemeldung_Formular.xsd" Element "CSBF_Vergabemeldung") STORAGE Object-rel
    ational TYPE "CSBF_Vergabemeldung3270_T"
    SQL> --
    SQL> declare
      2    V_RESULT BOOLEAN;
      3  begin
      4     if dbms_xdb.existsResource(:DOCPATH) then
      5       dbms_xdb.deleteResource(:DOCPATH);
      6    end if;
      7    V_RESULT := DBMS_XDB.CREATERESOURCE(:DOCPATH,:INSTANCE);
      8    COMMIT;
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.79
    SQL> select count(*)
      2    from CSBF_VERGABE_INFO_XML
      3  /
             1
    Elapsed: 00:00:00.15
    SQL> set long 10000 pages 0 lines 160
    SQL> --
    SQL> select object_value
      2    from CSBF_VERGABE_INFO_XML
      3  /
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <CSBF_Vergabemeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://oradb4.min.local:8080/public/CSBF/xsd/CSBF_Verg
    abemeldung_Formular.xsd">
      <CSBF_Vergabemeldung_Info>
        <Identnummer>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Identnummer>
        <Version_CSBF_Vergabevermerk_Formular>xxxxxxxxxxxxxxxx</Version_CSBF_Vergabevermerk_Formular>
        <Fertigstellung_Vergabevermerk>1900-01-01</Fertigstellung_Vergabevermerk>
      </CSBF_Vergabemeldung_Info>
      <Strassenbaudienststelle>
        <Kennung>xxxxx</Kennung>
        <Strassenbau_Organisation_Bezeichnung>xxxxxxx</Strassenbau_Organisation_Bezeichnung>
        <Adresszeile_2>xxxxxxxxxxxxx</Adresszeile_2>
        <Adresszeile_3>xxxxxxxxxxxxxx</Adresszeile_3>
        <Adresszeile_4>xxxxxxxxxxxxxxxxx</Adresszeile_4>
        <Strasse>xxxxxxxxxxxxxx</Strasse>
        <PLZ>xxxxx</PLZ>
        <Ort>xxxxxxxxxxxxxx</Ort>
        <NUTS>xxxxx</NUTS>
        <Telefon>xxxxxxxxxxx</Telefon>
        <Fax>xxxxxxxxxxx</Fax>
        <E_Mail>[email protected]</E_Mail>
      </Strassenbaudienststelle>
    </CSBF_Vergabemeldung>
    Elapsed: 00:00:01.99
    SQL> select xdburitype(:DOCPATH).getXML()
      2    from DUAL
      3  /
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <CSBF_Vergabemeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://oradb4.min.local:8080/public/CSBF/xsd/CSBF_Verg
    abemeldung_Formular.xsd">
      <CSBF_Vergabemeldung_Info>
        <Identnummer>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Identnummer>
        <Version_CSBF_Vergabevermerk_Formular>xxxxxxxxxxxxxxxx</Version_CSBF_Vergabevermerk_Formular>
        <Fertigstellung_Vergabevermerk>1900-01-01</Fertigstellung_Vergabevermerk>
      </CSBF_Vergabemeldung_Info>
      <Strassenbaudienststelle>
        <Kennung>xxxxx</Kennung>
        <Strassenbau_Organisation_Bezeichnung>xxxxxxx</Strassenbau_Organisation_Bezeichnung>
        <Adresszeile_2>xxxxxxxxxxxxx</Adresszeile_2>
        <Adresszeile_3>xxxxxxxxxxxxxx</Adresszeile_3>
        <Adresszeile_4>xxxxxxxxxxxxxxxxx</Adresszeile_4>
        <Strasse>xxxxxxxxxxxxxx</Strasse>
        <PLZ>xxxxx</PLZ>
        <Ort>xxxxxxxxxxxxxx</Ort>
        <NUTS>xxxxx</NUTS>
        <Telefon>xxxxxxxxxxx</Telefon>
        <Fax>xxxxxxxxxxx</Fax>
        <E_Mail>[email protected]</E_Mail>
      </Strassenbaudienststelle>
    </CSBF_Vergabemeldung>
    Elapsed: 00:00:00.11
    SQL>

  • 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 validation with JDOM / JAXP

    Hello,
    I am trying to validate xml file against schema file. I decided to use JDOM and JAXP.
    First question: is it a good choice?
    I did a first attempt but not sure I have understood all what I am doing :(
    First I have create a parser usinf org.jdom.*
    SAXBuilder parser = new SAXBuilderThen I built my document:
    Document doc = parser.build(myFile)These 2 steps are ok. But it does not do validation.
    I saw in the JDOM documentation that I can set a validation flag to true. I did it. First problem, I got the following error from JDOMException: Document is invalid: no grammar found.
    Is there a way to specify to the parser where to find the xsd file?
    As I did not find answer to this question by myself, I tried implementing the Schema class from JAXP:
    SAXBuilder parser = new SAXBuilder;
    Document doc = parser.build(myFile);
    Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaFile);
    ValidatorHandler vh = schema.newValidatorHandler();
    SAXOutputter so = new SAXOutputter(vh);
    so.output(doc);It does the validation against the schema file specified but I am not really sure about what I am doing here. The last 2 commands are not clear to me :(
    Then in my schema file, I have elements that have default value. I expected the following behavior: if the element is not in the xml file then the default will be used by the parser (and added in the tree). But it seems, it's not the case.
    Any help/explanation will be really appreciated.

    I am trying to validate xml file against schema file. I decided to use JDOM and JAXP.
    First question: is it a good choice?
    If only schema validation is required use the validation API in JDK 5.0.
    http://www-128.ibm.com/developerworks/xml/library/x-javaxmlvalidapi.html
    http://java.sun.com/developer/technicalArticles/xml/validationxpath/
    For validation with JDOM, the following validation application explains the procedure:import org.jdom.input.SAXBuilder;
    import org.xml.sax.SAXException;import org.jdom.*;
    import java.io.*;
    public class JDOMValidator{
    public void validateSchema(String SchemaUrl, String XmlDocumentUrl){
               try{
    SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser",true);<br/>saxBuilder.setValidation(true);
    saxBuilder.setFeature("http://apache.org/xml/features/validation/schema",true);
    saxBuilder.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
    saxBuilder.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",SchemaUrl);
    Validator handler=new Validator();
    saxBuilder.setErrorHandler(handler);
    saxBuilder.build(XmlDocumentUrl);
    if(handler.validationError==true)
    System.out.println("XML Document has Error:"+handler.validationError+""+
    handler.saxParseException.getMessage());      
    else           
          System.out.println("XML Document is valid");
              }catch(JDOMException jde){
                }catch(IOException ioe){
    private class Validator extends DefaultHandler{     
         public boolean  validationError = false; 
         public SAXParseException saxParseException=null;    
      public void error(SAXParseException exception) throws SAXException{        
         validationError =true;
         saxParseException=exception; 
      public void fatalError(SAXParseException exception) throws SAXException  {
    validationError = true;     
    saxParseException=exception;
      public void warning(SAXParseException exception) throws SAXException       {
    public static void main(String[] argv)   {
       String SchemaUrl=argv[0];StringXmlDocumentUrl=argv[1];
       JDOMValidator validator=new JDOMValidator();
       validator.validateSchema(SchemaUrl,XmlDocumentUrl);
    }

  • XML Validation with no connection to the internet

    Hi,
    I'm trying to validate a ml instance document against a xml schema, using the javax.xml.validation.Validator.validate() method. This works fine as long as I have an internet connection, but not when I disconnect from the internet it fails.
    I've detected, using a network sniffer, that this is due to the fact that the validation process tries to fetch the XMLSchema.dtd and datatypes.dtd from w3.org. Is there any way to avoid this by prestoring these somewhere? So that the internet connection is not needed?
    I need to be able to do validation without a connection to the internet since the environment where my application is deployed does not have such a connection.
    Ray

    Hi Ray,
    Were you able to resolve this issue? I am encountering a very similar problem where I am not connected to the internet and it fails during the newSchema method on javax.xml.validation.SchemaFactory. I have attempted to implement the suggestions of ExtremeGardener and vidyut with no luck.
    Per ExtremeGardener's suggestion of replacing xmlns:xs="http://www.w3.org/2001/XMLSchema" with xmlns:xs="XMLSchema.xsd" and storing it locally, it gave me an error for trying to set the "xs" or "xsd" prefixes to anything other than "http://www.w3.org/2001/XMLSchema." I forget the exact error. I also tried to use my own prefix and it did not like that either.
    Per vidyut's suggestion of using a catalog resolver, I believe that I have tried that too (if I understand correctly). I created an LSResourceResolver and tied it to the SchemaFactory. I can invoke it for a namespace but that did not resolve the issue because it only invokes the resolver on an import, include, or redefine. I believe that it is trying to reach the internet due to the xmlns:xs="http://www.w3.org/2001/XMLSchema" attribute within the top-level schema element in the XSD and I know of no way to invoke it for that.
    I also created an ErrorHandler and tied it to the SchemaFactory. That shows me the errors and they are all related to the standard XML data types defined in XMLSchema.xsd. The errors that I am seeing are all of this form: "UndeclaredPrefix: Cannot resolve 'xs:string' as a QName: the prefix 'xs' is not declared."
    I am currently using the SchemaFactory in Java 1.5, but I am thinking about trying the Xerces SchemaFactory since they are not exactly the same implementation.
    Does anyone have any other suggestions? Any help you can provide would be greatly appreciated!
    Thanks,
    betzro1

  • XML Datastore with default precision length

    Hi All,
    While creating a xml datastore in model by using xsd, it creates columns with default column length/precision. I need them to be exact to target db.
    Here is the sample xsd with columns restriction...
    <xsd:element name="NAME" minOccurs="1" xdb:SQLName="NAME"
    xdb:SQLTYPE="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="960"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="DESCRIPTION" minOccurs="0" xdb:SQLName="DESCRIPTION"
    xdb:SQLTYPE="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="4000"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="STAT_CD" minOccurs="1" xdb:SQLName="STAT_CD"
    xdb:SQLTYPE="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="120"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PROFILE_TYPE" minOccurs="0" xdb:SQLName="PROFILE_TYPE"
    xdb:SQLTYPE="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="60"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="REGN_ID" minOccurs="0" xdb:SQLName="REGN_ID"
    xdb:SQLTYPE="NUMBER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:integer">
    <xsd:precision value="18"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    Here simpletype defines the length/precision or the element.
    While creating datastore by reverse engg it takes the dedault length which is 10 for numeric and 255 for varchar.
    Is this xsd is wrong or something else.

    Can someone provide me a sample xsd which has defined column length for each attribute.

  • 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)

  • Erro in XML validation with schema document.

    Hi Friends,
    I am trying to validate XML file as per the defined schema document through JAXB parser.
    Following is my xml. schema and java class code.
    XML File_
    <?xml version="1.0"?>
    <notify xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="NotificationDetailsSchema.xsd">
    <notification>
    <alertname>Alert1</alertname>
    <deletable>Y</deletable>
    <descurl>Alert1URL</descurl>
    </notification>
    <notification>
    <alertname>Alert2</alertname>
    <deletable>Y</deletable>
    <descurl>Alert2URL</descurl>
    </notification>
    </notify>
    Schema file_
    <?xml version="1.0" encoding="windows-1252"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xsd:element name="notify">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="notification" maxOccurs="unbounded">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="alertname">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="deletable">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="Y|N"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="descurl">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    Java Class_
    SAXSource source = new SAXSource (xmlInputSource);
    SchemaFactory sf = SchemaFactory.newInstance (XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema = sf.newSchema(schemaFileObj);
    Validator validator = schema.newValidator ();
    validator.setErrorHandler (new ParserErrorHandler());
    validator.validate (source);
    I tried to execute the validation through stand along java class and it worked correctly.
    However when I added this class into my Fusion web application, I am getting following error.
    org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'USAVER'.*
    Can you please help me to figure out this problem?

    Ruskin wrote:
    However there needs to be the possibility of a totally random mix of three different types of elements in a parent element. Can you take your example to make it more clear? Does all three elements mutually exclusive?

  • 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 validation with StAX

    Hi,
    I have a requirement to validate XMLs during JAXB unmarshalling and during StAX parsing. The schema is packaged in a jar. I am able to successfully read the schema, and validate the XML during unmarshalling by setting the schema in the unmarshaller (through setSchema()).
    However, I am not able to validate it with StAX using the same schema and same XML.
    Here is the code snippet for StAX:
    StringReader stringReader = new StringReader(inputXMLStr);
    XMLEventReader xmlEventReader = XMLInputFactory.newInstance().createXMLEventReader(stringReader);
    EventFilter filter = new EventFilter() {
    public boolean accept(XMLEvent event) {
    return event.isStartElement();
    XMLEventReader xmlFilteredEventReader = xmlif.createFilteredReader(xmlEventReader, filter);
    Schema mySchema = getSchema(); // this method retrieves the schema by reading the schema files as
    stream source and calling schemaFactory.newSchema(...)
    Validator validator = mySchema.newValidator();
    validator.setErrorHandler(new SchemaErrorHandler());
    Source xmlSource = new StAXSource(xmlFilteredEventReader);
    validator.validate(xmlSource);
    I get a SAX Parse exception saying "cvc-elt.1: Cannot find the declaration of element 'myElement'"
    And I also see the following exception:
    Caused by: java.lang.NullPointerException
         at com.sun.org.apache.xalan.internal.xsltc.trax.StAXEvent2SAX.bridge(StAXEvent2SAX.java:171)
         at com.sun.org.apache.xalan.internal.xsltc.trax.StAXEvent2SAX.parse(StAXEvent2SAX.java:118)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:651)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:708)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
         at com.sun.org.apache.xerces.internal.jaxp.validation.StAXValidatorHelper.validate(StAXValidatorHelper.java:89)
         at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:114)
         at javax.xml.validation.Validator.validate(Validator.java:127)
    I am not able to figure out why the validation would work with UnMarshaller but not with StAX.
    Any help appreciated.
    Thanks
    Meera

    Have u tried the Stream STAX parser instead?
    something like:
    SchemaFactory factory = SchemaFactory
                             .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    File schemaLocation = new File(XSD_FILE_PATH);
                   Schema schema = factory.newSchema(schemaLocation);
    // 3. Get a validator from the schema.
    Validator validator = schema.newValidator();
    ErrorHandler lenient = new ForgivingErrorHandler(fw);
    validator.setErrorHandler(lenient);
    XMLInputFactory staxFactory = XMLInputFactory.newInstance();
    staxFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
                             Boolean.TRUE);
    staxFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,
                             Boolean.FALSE);
    staxFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE,
                             Boolean.TRUE);
    staxFactory     .setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    FileInputStream fis = new FileInputStream(XML_FILE_PATH);
    XMLStreamReader xmlr = staxFactory.createXMLStreamReader(fis);
    validator.validate(new StAXSource(xmlr));

  • XML validating with Public ID (In Struts with Java)

    I've found in my struts .jar local copies of various DTD files to validate XML files for Struts. However, I'm unable to figure out how a DOCTYPE like the following
    <!DOCTYPE struts-config PUBLIC
         "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
         "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">is able to find the struts-config_1_1.dtd file in struts.jar. I understand that PUBLIC means "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" should be looked up in a catalog which should translate to a local copy (the one in struts.jar I imagine) of the DTD. I'm unable to find this catalog file or understand how this takes place though -- does Java have this catalog stored internally somewhere with default values?

    by default, if it detects that PUBLIC flag in the doctype it will check the alternate location first, then the http URL second.
    when starting up tomcat i can see the following log statements from apache
    DEBUG (Digester.java:1734) - register('-//Apache Software Foundation//DTD Struts Configuration 1.0//EN', 'jar:file:/C:/......war/WEB-INF/lib/struts-1.1.jar!/org/apache/struts/resources/struts-config_1_0.dtd'
    DEBUG (Digester.java:1734) - register('-//Apache Software Foundation//DTD Struts Configuration 1.1//EN', 'jar:file:/C:/......war/WEB-INF/lib/struts-1.1.jar!/org/apache/struts/resources/struts-config_1_1.dtd'
    DEBUG (Digester.java:1734) - register('-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN', 'jar:file:/C:/......war/WEB-INF/lib/struts-1.1.jar!/org/apache/struts/resources/web-app_2_2.dtd'
    DEBUG (Digester.java:1734) - register('-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN', 'jar:file:/C:/......war/WEB-INF/lib/struts-1.1.jar!/org/apache/struts/resources/web-app_2_3.dtd'so i'm wondering how the digester is able to load those DTDs from the jar file and register them to those URIs???
    Edited by: den2681 on Aug 6, 2008 4:13 PM

  • XML Validation with DTD... Urgent

    Hi all,
    I am using java 1.4
    I have to validate the XML file with the external DTD.
    Can anyone give me the code for that.
    DTD should be external.
    Thanks,
    Vinayak.

    If you are using Solaris , it has xml validation tool "xmllint", using this you can validate your xml against DTD.
    try with "xmllint --help " to see all the option.
    Message was edited by:
    sasrivas

  • Xml to ABAP internal table mapping and schema validation

    Hi Experts,
    I'm trying to get data from an xml file into internal tables in ABAP. My requirement is to validate xml against an xsd schema, how can i do it?
    My other question is, if there are any possible ways to map the fields of a table so that once the xml file is read, the fields automatically get populated depending on the different elements and attributes in the xml file.
    -joe

    Hi,
    check out :
    http://help.sap.com/saphelp_nw70/helpdata/en/fd/9d734b389211d596a200a0c94260a5/frameset.htm
    Terry

Maybe you are looking for

  • Emac disk utility not detecting ibook hardrive in Firewire mode

    ok so i got this ibook g3 (800 mhz version) with no os on it so i hooked it up to my emac via firewire and booted the ibook in the firewire mode. i go into the emac disk utility to format the drive and its not there. i tried booting my emac in fire w

  • Purchis

    what are all the steps involved in creating the PURCHIS report using the T-codes from MC18,MC21,MC24,MCSZ.can anyone explain me briefly? what is the difference between this report with SAP Query? best answers will be rewarded?

  • Unhandled event loop exception (open a log file in NW Developer Studio)

    Hi! SAP NetWeaver Developer Studio SAP NetWeaver 7.1 Composition Environment When I try to open a log file at the SAP Management Console View (i.e. available.log) I get a "Unhandled event loop exception" and the log file content is not shown. Any hin

  • No entry in MSDP_FCST2 after background run

    Hi,      I ran a forecast job using automodel 56 (for plant P1 and Material MATL1) in the background by creating an activity, job and scheduling. I see the job completed successfully in SM37 and here is what I see in the spool f the background job ==

  • Please help, how to implement hasNext() and next() of a HashSet iterator?

    Hi guys, Can someone help me out with this? I'm struggling to write an iterator (the hasNext() and next() methods) for a SimpleHashSet class and I keep failing. I have a basic unit test, which goes like this: @Test     public void testIterator() {