Regarding schema validation and dbms_xmlparser, dbms_xmldom

Hi All,
Recently I came across one scenario, where I need to register XSD and validate all incoming xml agaist registered XSD and then access its contents and process them as per business needs.
To accomplish this:
1. Simply I have registered XSD using registerschema+ .
2. To validate xmls, used schemaValidate+ .
3. Once this is done then to fetch value from xml, I used below statement:
SELECT EXTRACTVALUE (COLUMN_VALUE, '/details/emp_id') "Employee_ID"
FROM TABLE
+(XMLSEQUENCE+
+(XMLTYPE+
+('<?xml version="1.0"?>+
+<employee>+
+<details>+
+<emp_id>1001</emp_id>+
+</details>+
+</employee>'+
+).EXTRACT ('/employee/details')+
+)+
+) t;+
This works fine.
But I was browsing the same requirement over forum, got solutions related to DBMS_XMLPARSER and DBMS_XMLDOM.
I tried to go through its details but didnt get much idea on the same.
Can anyone please help me to understand about use of dbms_xmlparser and dbms_xmldom and about DOM.
In which scenario we need to use them?
Thanks
Vikram

Where I was thinking with that sentence is the "streaming evaluation" that Oracle now offers. This option is available when XML is stored in an XMLType column of SECUREFILE BINARY format (introduced in 11.1.0.6 and default for XMLType columns in 11.2.0.2) and that data is queried/accessed.
You can find some information on it here
http://docs.oracle.com/cd/B28359_01/appdev.111/b28369/xdb01int.htm
(Search for "streaming")
and here as well
http://docs.oracle.com/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#CBAIIEFG
Streaming is basically reading the data as Oracle scans past it since it knows, based on the binary storage format, what the XML looks like, so it does not need to create the whole document to find the sections the XPath/XQuery specifies. You can see that a SQL statement is using streaming evaluation when "XPATH EVALUATION" shows up in the explain plan as shown by
{message:id=10737315}
This option is only available when the XML is stored in the DB in the correct format. If the XML is stored in a PL/SQL variable, Oracle cannot use streaming evaluation on it.

Similar Messages

  • DTD/ schema validation and XSLT

    Hi
    I want to do mappings from IDoc to CIDX messages. The first choice was to do XSLT mappings. But because we need DTD/schema validation we switched to Graphical mapping.
    But mapping idocs to cidx messages with graphical mapping is proving to be a difficult job with all the context problems.
    Is it possible to combine the advantages of both mapping techniques in the following way.
    Define 1 interface mapping with 2 message mappings in it:
    - The first 'source to target' with XSLT.
    - The second 'target to target' with Graphical mapping (only connecting the top node) so we can have DTD/Schema validation.
    Kind regards
    Thierry

    hi,
    Source - XSLT - Target1
    Target1 - GM - Target2
    If what I understand is correct,in your INTERFACE MAPPING , then your Source Interafce will point to messagetype of typr SOURCE and Destination Interface will point to message type TARGET2.
    If yes, then like i told use SOURCE with XSLT to create TARGET1 , then use TARGET1 as the input to your next mapping program and create the TARGET2 as the output.
    In your message mapping,
    1 SOURCE   TARGET1  will act as the source and destination message types for one mapping (XSLT>)
    2. TARGET1 TARGET2 will act as the cource and destination mesage types for the other mapping (GRAPHICAL)
    Regards,
    Bhavesh

  • Dynamic schema validation and validation error consolidation

    I have a case where there are 18 schemas against which I need to validate my payload. After validation if there is any errors in that then I want a list of elements where it got failed. I want to know is that possible in BPEL?

    Hi there,
    Couldn't get what exactly your requirement is for.
    But I believe your requirement is some where in line with this post:
    https://forums.oracle.com/thread/423576
    Hope using the choice element and creating a unique xsd will suffice your requirement.
    Regards,
    Deepak.

  • Schema Validation Key/Keyref and substitutionGroup Problem

    First, thank you for fixing the schemaLocation problem.
    My next question is about key/keyref and substitution. If I define a key/keyref relationship inside one element, then use another element to substitute that element, I found that the key/keyref relationship is not preserved in the new element using oracle schema validation. I am not clear whether this is the correct behavior.
    For example:
    <element name="extended" type="xl:extendedType" abstract="true">
    <key name="labelKey">
    <selector xpath=".//[@xlink:type='locator']"/>
    <field xpath="@xlink:label"/>
    </key>
    <keyref name="labelKeyRef1" refer="self:labelKey">
    <selector xpath=".//*[@xlink:type='arc']"/>
    <field xpath="@xlink:from"/>
    </keyref>
    </element>
    <element name="calculationlink" type="xl:extendedType" substitutionGroup="xl:extended"/>
    The key/keyref is not validated inside calculationlink in this case.
    Yufei
    null

    Yufei,
    After we tested the schema location problem using the test case we produced, we can't find it has any problem. Would you send us the test data you have if you think it not works for you?
    I will check your keyref soon.

  • Memory Leakage while parsing and schema validation

    It seems there is some kind of memory leakage. I was using xdk 9.2.0.2.0. Later i found that from this forum which contain a Topic on this and they (oracle ) claim they have memory leakage. And they have fixes this bugs in 9.2.0.6.0 xdk. When i used truss command, for each call to parser and schame validation, it was opening file descriptor for lpxus and lsxus file. And this connections were not close. And keep on openning it with each call to parser. I was able to diagonise this using truss command on on solaris. After making many calls, i was error message could not open file Result.xsd (0202). I am using one instance of Parser and Schema. And i am doing clean up for parser after each parse.
    Later i downloaded, 9.2.0.6.0,
    Above problem for the parser was solvedm but still the problem continued for schema validation. And even i tried with latest beta release 10.
    And this has caused great troubles to us. Please can u look whether there is come sort of leakage. Please advice if u have any solution.
    Code---
    This below code is called multiple times
    char* APIParser::execute(const char* xmlInput) {
              char* parseResult = parseDocument(xmlInput);
              //if(strcmp(parseResult,(const char*)"")==0) {
    if(parseResult == NULL) {
                   parseResult = getResult();
    parser.xmlclean();
         return parseResult;
              } else {
                   return parseResult;
    Parser and schema are intialised in Construtor and terminated in Destructor.

    Hi, here is the complete test case
    #include<iostream>
    #ifndef ORAXML_CPP_ORACLE
    # include <oraxml.hpp>
    #endif
    using namespace std;
    #define FAIL { cout << "Failed!\n"; return ; }
    void mytest(int count)
         uword ecode;
         XMLParser parser;
         Document *doc;
         Element root, elem;
         if (ecode = parser.xmlinit())
              cout << "Failed to initialze XML parser, error " << ecode << "\n";
              return ;
         cout << "\nCreating new document...\n";
         if (!(doc = parser.createDocument((oratext *) 0, (oratext *) 0,(DocumentType *) 0)))
         FAIL
         if (!(elem = doc->createElement((oratext *) "ROOT")))
                   FAIL
         string test="Elem";
         for(int i=0;i<count;i++)
              //test="Elem"+string(ltoa(i));
              if (!(elem = doc->createElement((oratext *) "element")))
                   FAIL
              if (!doc->appendChild(elem))
                   FAIL
         //doc ->print();
         //parser.xmlclean();
         parser.xmlterm();
    int main(int argc,char* argv[])
         int count=atol(argv[1]);
         mytest(count);
         char c;
         cout<<"check memory usage n press any key"<<endl;
         cin>>c;
         return 0;
    -------------------------------------------cut here-----
    Now, i cant use the xdk 10g because i work on a hpux machine. I have tried the above program with a count of 1000000. the memory usage at the end was around 2 gigabytes.
    Could someone please please help me? :(
    Thank you.

  • Regarding Validation and Substitution.

    Hi all,
    I need to write a new substitution and validation and these has to be triggered when MIRO/FB60/FB65 are saved.
    Now the problem is that i have append my exit and the Form has been written and program had also customized.
    But when I save the transactions mentioned my exit form is not triggering. Can any one suggest why this is not triggering ASAP.
    Thanks
    SAGAR.

    Hi,
    you can create ur validation enchancement using GGB0 transcation and activate it using OB28 transcation code
    it will works.

  • Help On schema validation

    Hi,
    I am a newbie in XML schema territory.
    I generates a xml using 'SELECT XMLQuery( ...)' -- This finally works after upgrading to 10.2.0.3!
    1) What methods do you recommend to validate the query result agaist the schema? The query result is first returned as 'XMLType' type, and then
    I turned it into a CLOB.
    At the end, I save the output into a file (via CLOB to String).
    2) How do I register the schema in DB? Can I install the schema on the file system, instead? I am not sure which way is simpler and easier. I'd yearn for any simpler method, if any --- a common complaint from any beginner, I guess.
    A few pointers will help me a great deal.
    Sun

    Sun,
    You can take a look at an FAQ thread on this topic: How does XML DB handle XML Schema Validation ?
    Regards,
    Geoff

  • Java Stored Procedure SAXParser XML Schema Validation

    Using Oracle XML Developers Kit 10.2.0.2.0 - Production.
    Attempting to validate using XML Schema in a Java stored procedure with the code:
                   if ( schemaDoc == null )
                        // Obtain default connection
                        Connection conn = new OracleDriver().defaultConnection();
                        OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement("SELECT XmlDocObj FROM XmlDoc WHERE XmlDocNbr = 2");
                        OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
                        if ( rset.next() )
                             // get the XMLType
                             XMLType schemaXml = (XMLType)rset.getObject(1);
                             XSDBuilder builder = new XSDBuilder();
                             XMLSchema schemaDoc = (XMLSchema)builder.build(new InputSource(schemaXml.getInputStream()));
                   if ( inst == null )
                        inst = new ValidateCoreRequest();
                   ErrorHandlerImpl handler = inst.getNewErrorHandler();
    SAXParser saxParser = new SAXParser();
    saxParser.setXMLSchema(schemaDoc);
    saxParser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxParser.setErrorHandler(handler);
    saxParser.parse(new InputSource(new StringReader(docStr)));
    if( handler.validationError )
                        errorMsg[0] = handler.saxParseException.getMessage().substring(0, Math.min(199, handler.saxParseException.getMessage().length()));
    Never reports validation errors in the XML. Although the XDK Programmers Guide states "...you can use
    the oracle.xml.parser.schema.XSDBuilder class to build an XML schema and
    then configure the parser to use it by invoking the XMLParser.setXMLSchema()
    method. In this case, the XML parser automatically sets the validation mode to
    SCHEMA_STRICT_VALIDATION and ignores the schemaLocation and
    noNamespaceSchemaLocation attributes." No validation seems to occur. I have tried to set an xsi:noNamespaceSchemaLocation attribute on the root XML node, but this results in URL errors if the URL is not valid or schema build errors if the URL is valid, but does not point to a real location.
    It appears that without a schema location attribute, no schema validation occurs. Using setXMLSchema() with a database source does not seem to cause the schema location attributes to be ignored. At least for Java stored procedures.
    Does XML Schema validation work in the database for externally referenced schemas?
    Thank You,
    Art

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jan Vissers ([email protected]):
    I have two schemas A and B. A contains a java stored procedure which calls a java stored procedure stored in B. Upon resolving the "A" Java Stored Procedures I get the following error:
    ORA-29545: badly formed class: at offset 3093 of Adapter.TFADPBeschikbaarheid.sendAanvraag expecting a class-oracle.xml.parser.v2.XMLDocument but encountered a class-oracle.xml.parser.v2.XMLDocument.
    ... Question:
    it is expecting something which it has in fact encountered... SO!!!! What is the error.
    Thx,
    Jan<HR></BLOCKQUOTE>
    Try this:
    Edit your XSU installation script located on lib directory of Oracle XSU's distribution:
    Find the line:
    loadjava -r -v -u $USER_PASSWORD xmlparserv2.jar
    Replace by:
    loadjava -r -v -g public -u $USER_PASSWORD xmlparserv2.jar
    And installs your Oracle XSU again.
    Best regards, Marcelo.

  • Urgent - please help with osb-service bus schema validation.

    I have a proxyService runing on osb service bus, when I send wrong input to my proxyservices it react correctly by rejecting it, becuase the requestion is not conform to the schema, but I only get the error message saying that
    the Input is does not much, is there a way to get more info about the error ?
    like witch fields that cause the error ?

    The fault variable in your stage error handler will have the approariate information. Just add a stage error handler in the stage you are doing schema validation (make sure that in validate action you are selecting "raise Error on validation failure") and the error handler log the $fault
    Also refer -
    Re: Validate each xml element against XML schema
    Regards,
    Anuj

  • XML Schema validation Error

    Hi,
    Have a scenerio in which consecutive mapping needs to be done.The first mapping is a Java Mapping in which XML schema validation needs to be done.
    If XML Schema validation is sucessful(Mapping 1),then graphical message mapping(MM_Entry) needs to be performed.
    I have uploded a jar file in imported Archives which contains
    1)Schema file(inputSchema.xsd): This is an XSD file which is generated in XI....XSD fomat of Source message type
    2) The java Class file
    Following are few lines of code for better idea:
    public class SAXParser implements StreamTransformation {
    public void execute(InputStream input, OutputStream output) throws StreamTransformationException {
    SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
    InputStream mySchema = this.getClass().getClassLoader().getResourceAsStream("inputSchema.xsd");
    SAXParser saxParser = saxParserFactory.newSAXParser();
    saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
    saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",mySchema);
    saxParser.parse(input, new HandlerBase());
    After above step(parsing),input is copied to output and streams are closed as follows:
    byte[] buf = new byte[4096];
    for(int len=-1;(len=input.read(buf))!=-1;)
    output.write(buf,0,len);
    input.close();
    output.close();
    After sending correct source message from input ,i am getting following error:
    Runtime exception occurred during execution of application mapping program com/sap/xi/tf/_MM_Entry_: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Parsing an empty source. Root element expected!

    Daniel,
    As I've said, I've used it successfully in PI 7.0 SP10.
    You're right about documentation, it says that by default, Java 1.4.2 mark() and reset() methods of InputStream class are not fully implemented (mark() would do nothing and reset() would always throw an IOException). And that would be the expected behavior...
    ...unless the SAP developers have extended the InputStream class to include actual implementatios to the mark() and reset() methods.
    I'm not saying that they have, but it would be possible, wouldn't it?
    It does work, after all...
    Regards,
    Henrique.

  • BPM Problem: Schema validation error notification

    Hello all,
    When a schema validation error takes place upon receiving XML messages via HTTP, is there something that can be set up in BPM to notify data owners? (either alert or email)
    Regards,
    Steve

    Bhavesh,
    <i>When you mean source schema validation, does it imply that you want to validate your Source XML before graphical mapping to make sure it meets the Source XML Schema?</i>
    validate my Source XML
    <i>As you pointed out you are usinga BPM, you can wrap the Transfromation step with a Exception handling block, so when there is a mismatch of Source schema and ite actual message the exception handler will be invoked and in the exception handler you can trigger alerts using the control step.</i>
    I'm using an outbound interface (outside BPM) to call the abstract interface (very first step in BPM), and there's a tranformation step after that. 
    -If the Source schema is wrong, will the error take place at the outbound interface or at the transformation step?  If outside at the outbound interface, i wouldn't be able to wrap anything around it.
    -Exception handling block means the BLOCK step?
    Regards,
    Steve

  • Schema validation issue

    Hi
    We do schema validation with raise error option. But to the consumer we do not want send the SOAP Fault but a response message which has error tags.
    How to do this.
    Thanks,
    Vinoth

    Hi Vinoth,
    In stage error handler, replace the content of body($body) with desired XML content(probably using a XQuery) and use Reply with success action
    Regards,
    Anuj

  • Switching ON validate xml(Schema Validation) in BPEL Console for AIAtesting

    While we were testing Oracle O2B pip, we have recently switched on schema validation by turning it on to 'Strict' so that we can Validate
    XML in BPEL Console. Earlier when we were testing we had turned the schema validation as 'None' on BPEL console, and hence everything was working fine and
    no errors we popping out while creating sales order in Siebel CRM. But the moment we put validate xml to ' Strict' it starts throwing validation errors.
    So can you please help us to know whether it is right to test the Oracle O2B pip by putting validate xml to 'Strict'? If it is fair to test it by switching
    ON Validate XML(putting validate xml to 'Strict') then we are getting below error.
    We are creating a new sales order in Siebel CRM and when we check in BPEL console it was faulted at UpdateSalesOrderSiebelCommsProvABCSImpl (v. 1.0) .When we checked the BPEL flow it is throwing error at InvokeUpdateUpsert.
    Error is According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-complex-type.2.4.a: Invalid content was found starting with element 'xsdLocal1:Process_spcInstance_spcId'. One of '{"http://siebel.com/asi":Process_spcInstance_spcId}' is expected.
    Steps for Switching on Validation ?
    1)     Login to BPEL Console
    2)     Go To Configuration section
    3)     Schema Validation changes
    a.     ON: populate validateXML with value strict
    b.     OFF: populate validateXML with value none
    Really appreciate if you can help..

    hi
    Indeed, the "Validate XML" menu option only shows "Validate XML: 0 errors, 0 warnings.".
    But, if you look at the "Design" tab for your schema, the "invoices" element node contains an "xsd:invoice" sequence shown in red. If you change "xsd:invoice" to "invoice" this becomes white and the node can be expanded.
    One other thing, registering an XML Schema in JDeveloper like the one you posted, isn't possible without an "oracle.xml.parser.schema.XSDException" (without further details).
    regards
    Jan Vervecken

  • Schema validation of messages

    Hi everybody.
    Does anyone know if XML Schema validation of incoming messages will be implemented in upcoming XI patches or full releases? You can do it yourself, of course, in an adapter module or a Java mapping program, but both options seem somewhat roundabout.
    Regards,
    Morten Wittrock

    You are sooooo right, man! I'm thinking exactly the same! I'll have a XI Walldorf man in hand probably in a few days and I'll ask him. I'll let you know.
    Alex

  • Biztalk EDi schema Validation

    Hi Experts,
    Currently we are validating the EDI IFSCUM schemas at the pipeline level, now I have a requirement in such a way that the message should come to Orchestration and in Orchestration i will validate the incoming message against schema validation method. 
    I tried to keep the edivalidation set to false and dropped the message with wrong record count in UNT record.
    But this message is failing at port level, i need to pass this message to orchestration.
    How can i bypass these kind of validations at port level?

    Hi Sandy,
    Some of the EDI validations are performed always irrespective whether the EDI validation is enabled or not.
    http://msdn.microsoft.com/en-us/library/bb226369.aspx
    Refer the msdn article above. This specifies the validation that are performed always and validation which are done only if the EDI Data validation is enabled.
    Regards, Vivin.

Maybe you are looking for

  • How to translate a message in English to another language on iPhone 6

    How do you translate a message in English to another language on the iPhone 6 Plus?

  • Cannot get Entire total to work

    I am starting a new thread on this because the other one I had previously has 37 posts and this is a new problem as I got the intial problem fixed. Thank you! I have this code: import java.io.*; import java.text.*; public class Inventory      private

  • Strange behavior ACR 4.5 W/CS3 on Intel MacPro W/ OS 10.4.11

    I installed ACR 4.5 on my MacPro running OS 10.4.11 and all seemed fine except that if I open an image and try some settings with either a RAW or JPG file and then click on "CLOSE" the computer or CS3 the computer flashes bright for just an instant.

  • Passport whats new in the box???

    I picked up my passport yesterday, only to discover that the wall transformer for charging is a dud. I have tried in three recepticles known to have power, and it will not charge my passport with the usb cable properly installed, it does charge with

  • Fixed price bill rate

    hi every one i am working on a function which will return the bill rate of an empployee the considerations i took here is standard employee bill rate overrides, job bill rate overrides ,employee bill rate, standard job bill rate (priority in the give