As you have done with the two simple examples, you can use the orapipe utility to run the pipeline application. Referring to its pipeline control file, you see the following three parameters that need to be passed:
source The input XML book listing file
Lschema The local schema
Rschema The remote schema
Even though you pass the remote schema filename or URL, it is not actually retrieved unless the condition calls for it. The following is the command line for the book1.xml file:
java oracle.xml.pipeline.controller.orapipe –sequential -force -attr source xml/book1.xml -attr Lschema xsd/book_local.xsd -attr Rschema xsd/book_remote.xsd pipeline/pipeProcessing_3.xml
Because this is a valid book listing, you will see the message “XML document accepted” and an identical result3.xml file written.
In the previous sections, we discussed the details of each process in the XML pipeline application. Now, we will show you how the XML pipeline application behaves under different scenarios. First consider an invalid book listing, called book2.xml:
<?xml version="1.0"?> <book inStock="true"> <title>Compilers: Principles, Techniques, and Tools</title> <author>Alfred V.Aho, Ravi Sethi, Jeffrey D. Ullman</author> <ISBN>0-201-10088-6</ISBN> <edition>Second</edition> <publisher>Addison Wesley</publisher> </book>
Instead of the instock attribute having a value of “Yes” or “No” as per the schema, it is “true.” Recall that this error is not one that we track and therefore the document should be rejected with additional processing. The following is the command line and the result:
java oracle.xml.pipeline.controller.orapipe –sequential –force -attr source xml/book2.xml -attr Lschema xsd/book_local.xsd -attr Rschema xsd/book_remote.xsd pipeline/pipeProcessing_3.xml XML document rejected.
This section considers the situation in which a partner has altered its schema but without your knowledge. In this case, the partner has decided that the <edition> element could be optional and has changed minOccurs="1" to minOccurs="0". Now you have received book3.xml with the following listing:
<?xml version="1.0"?> <book inStock="Yes"> <title>Compilers: Principles, Techniques, and Tools</title> <author>Alfred V.Aho, Ravi Sethi, Jeffrey D. Ullman</author> <ISBN>0-201-10088-6</ISBN> <publisher>Addison Wesley</publisher> </book>
The initial validation against the local XML schema should fail with an errid of 24534, indicating that there is an XSD error. This causes the remote XML schema to be retrieved and compared with the local XML schema. If the XML document is valid against the remote XSD, changes found in the remote XML schema will be noted and the XML document will be finally accepted, as shown in the following command line and its result:
java oracle.xml.pipeline.controller.orapipe –sequential –force -attr source xml/book3.xml -attr Lschema xsd/book_local.xsd -attr Rschema xsd/book_remote.xsd pipeline/pipeProcessing_3.xml XSD documents are not consistent. Please upload the new XSD file. XML document accepted.
If the invalidating error happens to return one of the watched numbers, there is a chance that the remote schema has not changed and thus it was simply an error in the input XML document. This case triggers a comparison between the two schemas as well as a second validation, but ultimately the XML document or, in this case, book4.xml will be rejected, as shown in the following command line and result:
java oracle.xml.pipeline.controller.orapipe –sequential -force -attr source xml/book4.xml -attr Lschema xsd/book_local.xsd -attr Rschema xsd/book_remote_same.xsd pipeline/pipeProcessing_3.xml XSD documents are consistent. XML document rejected.
In this final case, the invalidating error again returns one of the watched numbers, and a check of the schemas detected a difference. However, in this case, the second validation failed, as shown in the following:
java oracle.xml.pipeline.controller.orapipe –sequential -force -attr source xml/book4.xml -attr Lschema xsd/book_local.xsd -attr Rschema xsd/book_remote_ same.xsd pipeline/pipeProcessing_3.xml XSD documents are not consistent. Please upload the new XSD file. XML document rejected.