Validation XML documnet with XML Schema in PL/SQL
Hello,
can someone please explain
How to validate an XML document with XML schema using PL/SQL code (with out writing Java code).
Thanks for your Help in Advance
Surendra.
see the posting: Schema validation routine?
regards, Bart
Similar Messages
-
Hi,
I'm getting an error trying to validate an xml document using xml schema(xsd). The java code/schema/xml/error are listed below.
Not sure what the error
" Invalid content was found starting with element 'ticker'. One of '{ticker}' is expected." means.
Using jre 1.6
Any input appreciated.
Thanks !
// Java Code
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(schemaURL);
Validator validator = schema.newValidator();
validator.validate(new StreamSource(is));
// Schema
<xs:element name="stocktrade">
<xs:complexType>
<xs:sequence>
<xs:element name="ticker" type="xs:string"/>
<xs:element name="price" type="xs:string"/>
<xs:element name="quantity" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
// XML doc
<stocktrade
xmlns ... and other attributes
>
<ticker>aaa</ticker>
<price>23.5</price>
<quantity>11</quantity>
</stocktrade>
// Error
Exception in thread "main" org.xml.sax.SAXParseException: cvc-complex-type.2.4.
: Invalid content was found starting with element 'ticker'. One of '{ticker}' i
expected.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSA
ParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Un
nown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError
Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError
Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErr
rReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.report
chemaError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handle
tartElement(Unknown Source)When I tried this with Xerces SAX, I got---
org.xml.sax.SAXNotRecognizedException: http://java.sun.com/xml/jaxp/properties/schemaLanguage
Maybe Xerces has not implemented the schemaLanguage property.
I have been successfully using Xerces-dependent properties to do validation:
XMLReader parser = saxParser.getXMLReader();
parser.setFeature( "http://xml.org/sax/features/validation", true);
parser.setFeature( "http://xml.org/sax/features/namespaces", true);
parser.setFeature( "http://apache.org/xml/features/validation/schema", true);
parser.setFeature( "http://apache.org/xml/features/validation/schema-full-checking", true);
if (noNamespaceSchemaLocation!=null) {
parser.setProperty(
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
noNamespaceSchemaLocation);
if (schemaLocation!=null) {
parser.setProperty(
"http://apache.org/xml/properties/schema/external-schemaLocation",
schemaLocation);
Also, as DrClap pointed out, for the schema location I use URIs.
Please let me know if you got the jaxp schemaLocation property to work and how you did it. -
Request for sample code, Validating XML Schema
Does anyone have some sample code to validate
an XML Schema with the Oracle parser?
Also, the classgen code seems to have more XML Schema classes in it. There is an xschema.jar full of XML Schema related code. Would it be possible to use this code?
I've tried DOMSample.java with the v2 parser. It seems to happily echo Schema based XML files that are obviously wrong. (I use Tibco's XML Authority to verify the XML file and XML Schema).I do not have sample code but it is not a difficult API to call. I have worked on it before, so if you have a specific question on it, happy to help out if I can.
-
Validating XML with XML Schema using PL/SQL
Hello,
I have XSD file and a example XML file.
Using pl/sql how I can validate the example XML is valid for XSD file?
Thanks in advance.
Bakul
Message was edited by:
bakuleshHave you looked at this documentation, Transforming and Validating XMLType Data
-
Validating XML against an XML Schema using PL/SQL
Hello everyone,
I've a strange problem.
I'm trying to validate an XMLTYPE variable against an XSD schema using the XMLisValid function.
The XML I was trying to validate was returning false (0) when using this method.
However, when I register the XSD against a column in a table and then insert this XMLTYPE into that column, I do not get any errors. If I change the XSD to ensure failure when using this method, I do get an error, so it is registered and working.
I have then created a very basic XSD and both methods work when validating the XML against this. So obviously the more complicated XSD I want to validate against is making a difference, but I would expect them to either both fail or both pass, not one fail and one pass.
Does anyone know why they'd be returning different results?
Thanks in advance for your help.
Robin
examples of what I'm using:
XML to validate:
<centres>
<add>
<centre>
<centreName>Name 1</centreName>
<centreRef>45678</centreRef>
</centre>
</add>
</centres>
Simple XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="centres" type="centresType"/>
<xs:complexType name="addType">
<xs:sequence>
<xs:element type="xs:string" name="centreName"/>
<xs:element type="xs:short" name="centreRef"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="centresType">
<xs:sequence>
<xs:element type="addType" name="add" maxOccurs="3" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Complicated XSD:
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid XML Studio - 30 Day Trial Edition 7.1.6.1440 (http://www.liquid-technologies.com)-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="centres">
<xs:complexType>
<xs:sequence>
<xs:element name="remove">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1000" name="centreRef">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="add">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1000" name="centre">
<xs:complexType>
<xs:sequence>
<xs:element name="centreName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="centreRef">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="qualifications">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1000" name="qualRef">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modifyQualAssociations">
<xs:complexType>
<xs:sequence>
<xs:element name="remove">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1000" name="r">
<xs:complexType>
<xs:attribute name="centreRef" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="qualRef" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="add">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1000" name="a">
<xs:complexType>
<xs:attribute name="centreRef" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="qualRef" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>Steps to validate XML data against a schema in Oracle:
1. Register your XSD in the database.
begin
dbms_xmlschema.registerschema(
SchemaUrl,
SchemaDoc,
local => TRUE/FALSE);
end;
2. For validating your XML document against your registered schema, here is a sample pl/sql block.
declare
v_xml xmltype;
begin
v_xml := your_xml_document;
v_xml.schemaValidate();
end;
Hope this helps :) -
Validating TLF data with a schema?
According to the following post rdermer claims that there isn’t a XSD for TLF markup:
http://forums.adobe.com/message/2223205#2223205
But what other ways can we validate our TLF data? And excuse my ignorance, but why can't I use a XSD to validate TLF data in a XML file?I think you could use a schema if you made one, I just don't know of one that already exists that you could use for this purpose.
- robin -
We want to validate XML Messages generated by UDS 5.1 components against XSchemas before we send them out.
Forte 3.5. built in parser does no validation.
Has anybody set up a solution architecture he/she will share with us ? ( We do NOT have an AppServer in place !).
Solutions on UNIX platform preferred.
Thanks for each hint !We have implemented a validating XML parser that does not require command line execution but unfortunately it depends on the Microsoft MSXML parser. We used olegen to create a Forte project that allows us to reference the MSXML parser as if it were inline Forte TOOL code. The MSXML4.dll provides support for validating XML schemas.
We are looking to find a multi-platform way to accomplish the same thing. I'm guessing that there may be a validating XML parser out there implemented in C that can be included into the Forte repository using the wrapper mechanism - has anyone tried this?
I see that Xerces has a C++ based validating parser - do you thing that could be accessed via the wrapper? Or would that have to be accessed via the command line?
Regards. -
Hi,
I need to load some XML schema definitions to afterwards validate some DOM documents against this schemas. My problem is, when loading those XML schema definitions I have to validate them. How to do this? How to provide an javax.xml.validation.Schema object and check is valid XML schema?
Thanks in advance.The very act of loading the schema into a schema object will validate it. That is, if you get as far as having an instance of Schema, it's valid.
-
Hi all,
I learmed the basic stuff of XML, DTD, DOM, etc. long time ago. Now, I came back to resume my XML journey and try to learn the XML Schemas, XPath and XQuery. I have Microsoft SQL Server 2012 Management Studio (SSMS2012) in our computer network. From
Page 221 of the old Book "Beginning XML 2nd Edition" written by David Hunter, et.al., (published by Wrox), I copied the name5.xsd and name5.xml :
<?xml version="1.0"?>
<schema xmlns=http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.wrox.com/name" xmlns:target="http://www.wrox.com/name"
elementFormDefault="qualified">
<element name="name">
<complexType>
<sequence>
<element name="first" type="string"/>
<element name="middle" type="string"/>
<element name="last" type="string"/>
</sequence>
</complexType>
</element>
</schema>
<?xml version="1.0"?>
<name
xmlns=http://www.wrox.com/name"
xmlns:xsi="http://www.wrox.org/2001XMLSchema-instance"
xsi:schemaLocation="http://www.wrox.com/name name5.xsd"
title="Mr.">
<first>John</first>
<middle>Frizgerald</middle>
<last>Doe</last>
</name>
How can I execute these two files in my SSMS2012 for doing my first XML Schema trial?
Please kindly help, advise and respond.
Thanks in advance,
Scott ChangHi Eric Zhang, Thanks for your nice response.
1) I saw the CREATE XML SCHEMA COLLECTION (Transact-SQL) and tried its first example "Create XML schema collection in the database" in my SQL Server 2012 Management Studio (SSMS2012):
-- Create a sample database in which to load the XML schema collection.
-- Copied this set of code stsments from Microsoft Library (ms176009)
-- ColesMS12_20a.sql (saved in C:/Documents/SQL Server Management Studio)
-- 19 March 2015 1145 AM
CREATE DATABASE SampleDB
GO
USE SampleDB
GO
CREATE XML SCHEMA COLLECTION ManuInstructionsSchemaCollection AS
N'<?xml version="1.0" encoding="UTF-16"?>
<xsd:schema targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
xmlns ="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:complexType name="StepType" mixed="true" >
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:element name="tool" type="xsd:string" />
<xsd:element name="material" type="xsd:string" />
<xsd:element name="blueprint" type="xsd:string" />
<xsd:element name="specs" type="xsd:string" />
<xsd:element name="diag" type="xsd:string" />
</xsd:choice>
</xsd:complexType>
<xsd:element name="root">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="Location" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="step" type="StepType" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="LocationID" type="xsd:integer" use="required"/>
<xsd:attribute name="SetupHours" type="xsd:decimal" use="optional"/>
<xsd:attribute name="MachineHours" type="xsd:decimal" use="optional"/>
<xsd:attribute name="LaborHours" type="xsd:decimal" use="optional"/>
<xsd:attribute name="LotSize" type="xsd:decimal" use="optional"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>' ;
GO
-- Verify - list of collections in the database.
select *
from sys.xml_schema_collections
-- Verify - list of namespaces in the database.
select name
from sys.xml_schema_namespaces
-- Use it. Create a typed xml variable. Note collection name specified.
DECLARE @x xml (ManuInstructionsSchemaCollection)
GO
--Or create a typed xml column.
CREATE TABLE T (
i int primary key,
x xml (ManuInstructionsSchemaCollection))
GO
-- ////The following code statements are not used in order to create SampleDB
-- Clean up
---DROP TABLE T
---GO
---DROP XML SCHEMA COLLECTION ManuInstructionsSchemaCollection
---Go
---USE Master
---GO
---DROP DATABASE SampleDB
It worked and I got the following results:
1 4 NULL sys 2009-04-13 12:59:13.390 2012-02-10 20:16:02.097
65536 1 NULL ManuInstructionsSchemaCollection 2015-03-19 11:47:17.660 2015-03-19 11:47:17.660
http://www.w3.org/2001/XMLSchema
http://schemas.microsoft.com/sqlserver/2004/sqltypes
http://www.w3.org/XML/1998/namespace
http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions
But, I don't undertand (i) what SCHEMA COECTION is, (ii) what <xsd:schema targetNamespace=.....</xsd:complexType> are, (iii) How I can specify my "project specific" schema in the Microsoft SCHEMA COLLECTION to check my xml file.
2) I dived in the XQuery programmimng in SSMS2012 in the last few weeks. I used the examles of Ad-Hoc XML File Query by Seth Delconte (in
httpS://www.simple-talk.com/content/print.aspx?article=1756) in my SSMS2012. They worked. But I don't understand the (i) Importing XML data using a function, (ii) Using the XQuery contans()
function to find substrings, (iii)Efficiency comparisons in the article.
Please kindly help me in enlightening me to resolve the difficulties listed in 1) and 2).
Thanks,
Scott Chang -
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. -
Validation with jaxp 1.3 and xml-schema
I'm totally green when it comes to xml&jaxp. Using jse 1.5 (jaxp 1.3), I'm trying
to have my app parse and validate an xml doc with xml schema. I want the validation to
happen using the schema specified in the xml doc. Also, I'd prefer if my application didn't have to set
the schema to use. As far as I can make out though, it appears that I need to parse the schemaLocation when
I want to validate using xml schema. Anyone know a way to avoid that step?
If not, then any idea why I'm getting the following err?
Error...
junit.framework.AssertionFailedError: null/null:4,9: Document is invalid: no grammar found.null/null:4,9: Document root element "catalog", must match DOCTYPE root "null".
at junit.framework.Assert.fail(Assert.java:47)
at com.rwd.toolbox.junit.AbstractRwdTestCase.printAndFail(AbstractRwdTestCase.java:229)
at com.rwd.util.xml.XmlUtilsTests.testXmlValidationUsingSchemaDefinedInXmlDoc(XmlUtilsTests.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Code... obviously taken from junit test case...
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
documentFactory.setNamespaceAware(true);
documentFactory.setValidating(true);
DocumentBuilder builder = documentFactory.newDocumentBuilder();
com.rwd.util.xml.Validator v = new com.rwd.util.xml.Validator(_validationStyle);
builder.setErrorHandler(v);
Document document = builder.parse(_document);
where com.rwd.util.xml.Validator extends DefaultHandler. Note that if I add following
code, then validation works as i expect it... but that's not really an option I care for (at least in this case).
I would anticipate being able to have the parser see the XSD reference in the XML and
apply it. Anyway, here's code to programmatically specify an XSD to use for validation....
documentFactory.setAttribute(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
documentFactory.setAttribute(
"http://java.sun.com/xml/jaxp/properties/schemaSource",
"file:///C:/workspace31m4/LMSTester/testData/util/xml/o.xsd");
Finally, the XML file... (example from onJava site)... Note that I've tried changing the URI to file:///c:/..., same result:
<?xml version="1.0" encoding="UTF-8"?>
<!--A OnJava Journal Catalog-->
<catalog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file://C:/workspace31m4/LMSTester/testData/util/xml/o.xsd"
title="OnJava.com" publisher="O'Reilly">
<journal date="April 2004">
<article>
<title>Declarative Programming in Java</title>
<author>Narayanan Jayaratchagan</author>
</article>
</journal>
<journal date="January 2004">
<article>
<title>Data Binding with XMLBeans</title>
<author>Daniel Steinberg</author>
</article>
</journal>
</catalog>
and its XSD file (also from onJava)...
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element ref="journal" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="title" type="xs:string"/>
<xs:attribute name="publisher" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="journal">
<xs:complexType>
<xs:sequence>
<xs:element ref="article" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="date" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="article">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element ref="author" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="author" type="xs:string"/>
</xs:schema>
Thanks,
-PaulThere are other applications using Xerces1.0 so the requirement is that I cannot replace the Xerces jar. Any suggestions.
-
Has anybody tried creating and validating a XML doc with XML Schema?
Hi,
Has anybody tried creating and validating a XML doc with XML Schema?With XMLBeans, an XML document may be created from and validated with an XML schema.
-
JDOMException thrown validating XML against a schema with Xerces2
I'm trying to validate a document with JDOM and Xerces 2.
I can validate it with XMLSpy (it works, my document is valid).
But with JDOM and xerces, this error occurs when parsing and validating my document:
org.jdom.JDOMException: Error on line 6 of document file:///E:/developpement/SitePerso/xml/xml/listeEntreprises.xml: cvc-complex-type.2.4.a: Invalid content starting with element 'item'. The content must match '(("":nom){0-1},("":item){0-UNBOUNDED})'.
My XML document:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by de Boussineau (none) -->
<!--Sample XML file generated by XML Spy v4.3 U (http://www.xmlspy.com)-->
<liste xmlns="E:/developpement/SitePerso/xml/domain~1/schemaListe" ... E:\developpement\SitePerso\xml\schemas\schemaListe.xsd">
<item xsi:type="xsel:typeEntreprise">
<xsel:nom>PHOENIX I.S.I.</xsel:nom>
<xsel:groupe>Taffioles</xsel:groupe>
<xsel:adresse>2 rue du centre</xsel:adresse>
The element <nom> before <item> is not required. So what's the problem ?...
-
Has anyone been successful at validating xml with a Schema running weblogic 6.1
sp2?
Here is a snippet of code...
SAXParserFactory objFactory = SAXParserFactory.newInstance();
objFactory.setValidating("true");
objFactory.setNamespaceAware("true");
objFactory.setFeature("http://apache.org/xml/features/validation/schema", "true");
objXMLInputParser.parse(new InputSource(new StringReader(XMLDocument)), A_HANDLER);
When my xml code runs through the parser I get an error for each element saying
the element type is not declared in the dtd or schema.
Since weblogic 6.1 runs with 1.3.1 Xerces parser. Does it support xml validation
with a Schema. From what I've read it seems that it does.
Any help or insight would be appreciated.
Thanks
KarenI figured out my problem in case anyone else is having trouble..
In the xml document that you need to refer to:
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema-instance that is the namespace
supported by xerces 1.3.1.
Whew!
"Karen Schaper" <[email protected]> wrote:
>
Has anyone been successful at validating xml with a Schema running weblogic
6.1
sp2?
Here is a snippet of code...
SAXParserFactory objFactory = SAXParserFactory.newInstance();
objFactory.setValidating("true");
objFactory.setNamespaceAware("true");
objFactory.setFeature("http://apache.org/xml/features/validation/schema",
"true");
objXMLInputParser.parse(new InputSource(new StringReader(XMLDocument)),
A_HANDLER);
When my xml code runs through the parser I get an error for each element
saying
the element type is not declared in the dtd or schema.
Since weblogic 6.1 runs with 1.3.1 Xerces parser. Does it support xml
validation
with a Schema. From what I've read it seems that it does.
Any help or insight would be appreciated.
Thanks
Karen -
[11g] XML Schema full validation with binary XML ?
Hi,
Oracle's doc quotes " Loading XML data into XML schema-based binary XML storage causes full validation against the target XML schemas. ".
After registering this XML Schema which indicates that a company must have at least a code, name and pilotes element :
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xdb:storeVarrayAsTable="true" version="1.0">
<xsd:element name="compagnie" type="compagnieType"/>
<xsd:complexType name="compagnieType">
<xsd:sequence>
<xsd:element name="comp" type="compType" minOccurs="1" xdb:SQLName="COMP"/>
<xsd:element name="pilotes" type="pilotesType" minOccurs="1" xdb:SQLName="PILOTES"/>
<xsd:element name="nomComp" type="nomCompType" minOccurs="1" xdb:SQLName="NOMCOMP"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="pilotesType">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded"
name="pilote" type="piloteType" xdb:SQLName="PILOTE"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="piloteType">
<xsd:sequence>
<xsd:element name="nom" type="nomType" xdb:SQLName="NOM"/>
<xsd:element name="salaire" type="salaireType" minOccurs="0"
xdb:SQLName="SALAIRE"/>
</xsd:sequence>
<xsd:attribute name="brevet" xdb:SQLName="BREVET">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="4"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
I can therefore insert a row no valid into this table
CREATE TABLE compagnie_binaryXML_grammaire OF XMLType
XMLTYPE STORE AS BINARY XML
XMLSCHEMA "http://www.soutou.net/compagnies3.xsd"
ELEMENT "compagnie"
ALLOW NONSCHEMA
VIRTUAL COLUMNS (vircolcomp AS (EXTRACTVALUE(OBJECT_VALUE,'/compagnie/comp')));
SQL> INSERT INTO compagnie_binaryXML_grammaire VALUES
2 (XMLTYPE.CREATEXML('<?xml version="1.0" encoding="ISO-8859-1"?>
3 <compagnie>
4 <pilotes></pilotes>
5 <nomComp>No pilot and no comp!</nomComp>
6 </compagnie>').CREATESCHEMABASEDXML('http://www.soutou.net/compagnies3.xsd'
1 ligne crÚÚe.
Unless the following instruction is done, no valid XML file can be added.
ALTER TABLE compagnie_binaryXML_grammaire
ADD CONSTRAINT valide_compagniebinaryXML
CHECK (XMLIsValid(OBJECT_VALUE) = 1);
Where is the difference between the behaviour of an object-relational table ?My guess is that the virtual column spoils the soup (could you check).
The following works for me on 11.1.0.6.0.
connect / as sysdba
drop user test cascade;
create user test identified by test;
grant xdbadmin, dba to test;
connect test/test
spool encoding_test01.txt
var schemaPath varchar2(256)
var schemaURL varchar2(256)
set long 100000000
col SCHEMA_URL FOR a60
col object_name for a50
select * from v$version;
purge recyclebin;
alter session set recyclebin=OFF;
drop table VALIDATE_XML_SCHEMA;
prompt Create Folder for TEST schema, user
declare
retb boolean;
begin
retb := dbms_xdb.createfolder('/test');
end;
prompt =================================================================
prompt Register Relational XML SChema
prompt =================================================================
prompt XML SChema
begin
:schemaURL := 'http://www.relational.com/root.xsd';
:schemaPath := '/test/root_relational.xsd';
end;
prompt Cleaning up
call DBMS_XMLSCHEMA.deleteSchema(:schemaURL,4);
commit;
prompt XSD Schema
declare
res boolean;
xmlSchema xmlType := xmlType(
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns="http://www.relational.com/root.xsd" targetNamespace="http://www.relational.com/root.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
<xs:annotation>
<xs:documentation>Example XML Schema</xs:documentation>
</xs:annotation>
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
<xs:element ref="INFO"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INFO" xdb:SQLName="INFO_TYPE">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/>
<xs:element name="INFO_CONTENT"
xdb:SQLName="TYPE_INFO_CONTENT" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>');
begin
if (dbms_xdb.existsResource(:schemaPath)) then
dbms_xdb.deleteResource(:schemaPath);
end if;
res := dbms_xdb.createResource(:schemaPath,xmlSchema);
end;
alter session set events='31098 trace name context forever';
BEGIN
DBMS_XMLSCHEMA.registerSchema
(SCHEMAURL => :schemaURL,
SCHEMADOC => xdbURIType(:schemaPath).getClob(),
LOCAL => TRUE, -- local
GENTYPES => FALSE, -- generate object types
GENBEAN => FALSE, -- no java beans
GENTABLES => FALSE, -- generate object tables
OWNER => USER);
END;
commit;
prompt =================================================================
prompt Register Binary XML SChema
prompt =================================================================
prompt XML SChema
begin
:schemaURL := 'http://www.binary.com/root.xsd';
:schemaPath := '/test/root_binary.xsd';
end;
prompt Cleaning up
call DBMS_XMLSCHEMA.deleteSchema(:schemaURL,4);
commit;
prompt XSD Schema
declare
res boolean;
xmlSchema xmlType := xmlType(
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns="http://www.binary.com/root.xsd" targetNamespace="http://www.binary.com/root.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
<xs:annotation>
<xs:documentation>Example XML Schema</xs:documentation>
</xs:annotation>
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
<xs:element ref="INFO"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INFO" xdb:SQLName="INFO_TYPE">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/>
<xs:element name="INFO_CONTENT"
xdb:SQLName="TYPE_INFO_CONTENT" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>');
begin
if (dbms_xdb.existsResource(:schemaPath)) then
dbms_xdb.deleteResource(:schemaPath);
end if;
res := dbms_xdb.createResource(:schemaPath,xmlSchema);
end;
alter session set events='31098 trace name context forever';
BEGIN
DBMS_XMLSCHEMA.registerSchema
(SCHEMAURL => :schemaURL,
SCHEMADOC => xdbURIType(:schemaPath).getClob(),
LOCAL => TRUE, -- local
GENTYPES => FALSE, -- generate object types
GENBEAN => FALSE, -- no java beans
GENTABLES => FALSE, -- generate object tables
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
OWNER => USER);
END;
commit;
prompt =================================================================
prompt Register SECOND Binary XML SChema
prompt =================================================================
prompt XML SChema
begin
:schemaURL := 'http://www.different.com/roots.xsd';
:schemaPath := '/test/roots.xsd';
end;
prompt Cleaning up
call DBMS_XMLSCHEMA.deleteSchema(:schemaURL,4);
commit;
prompt XSD Schema
declare
res boolean;
xmlSchema xmlType := xmlType(
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns="http://www.different.com/roots.xsd" targetNamespace="http://www.different.com/roots.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:element name="ROOTS" xdb:maintainDOM="false">
<xs:annotation>
<xs:documentation>Example XML Schema</xs:documentation>
</xs:annotation>
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
<xs:element ref="INFO"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INFO" xdb:SQLName="INFO_TYPE">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/>
<xs:element name="INFO_CONTENT"
xdb:SQLName="TYPE_INFO_CONTENT" type="xs:string"/>
</xs:sequence> </xs:complexType>
</xs:element>
</xs:schema>');
begin
if (dbms_xdb.existsResource(:schemaPath)) then
dbms_xdb.deleteResource(:schemaPath);
end if;
res := dbms_xdb.createResource(:schemaPath,xmlSchema);
end;
alter session set events='31098 trace name context forever';
BEGIN
DBMS_XMLSCHEMA.registerSchema
(SCHEMAURL => :schemaURL,
SCHEMADOC => xdbURIType(:schemaPath).getClob(),
LOCAL => TRUE, -- local
GENTYPES => FALSE, -- generate object types
GENBEAN => FALSE, -- no java beans
GENTABLES => FALSE, -- generate object tables
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
OWNER => USER);
END;
commit;
prompt =================================================================
prompt END Registration Process
prompt =================================================================
select xmlType(xdbURIType ('/test/root.xsd').getClob())
from dual;
alter session set events='31098 trace name context forever';
select schema_url, binary
from user_xml_schemas;
select * from tab;
select object_name, object_type from user_objects;
prompt =================================================================
prompt BASICFILE - XMLSCHEMA (default) - DISALLOW NONSCHEMA
prompt =================================================================
drop table "VALIDATE_XML_SCHEMA";
create table "VALIDATE_XML_SCHEMA" of XMLTYPE
XMLTYPE STORE AS BASICFILE BINARY XML
XMLSCHEMA "http://www.binary.com/root.xsd"
ELEMENT "ROOT";
prompt No schema defined
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Bogus, noexistent schema defined
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.bogus.com/root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Binary schema defined
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.binary.com/root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Binary schema with different location path
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOTS xmlns="http://www.different.com/roots.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOTS>'))
prompt Binary schema with incorrect "root(s)"
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.different.com/roots.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Relational registered schema
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.relational.com/root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt =================================================================
prompt BASICFILE - XMLSCHEMA - ALLOW NONSCHEMA
prompt =================================================================
drop table "VALIDATE_XML_SCHEMA";
create table "VALIDATE_XML_SCHEMA" of XMLTYPE
XMLTYPE STORE AS BASICFILE BINARY XML
XMLSCHEMA "http://www.binary.com/root.xsd"
ELEMENT "ROOT"
ALLOW NONSCHEMA;
prompt No schema defined
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Bogus, noexistent schema defined
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.bogus.com/root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Binary schema defined
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.binary.com/root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Binary schema with different location path
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOTS xmlns="http://www.different.com/roots.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOTS>'))
prompt Binary schema with incorrect "root(s)"
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.different.com/roots.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
prompt Relational registered schema
insert into "VALIDATE_XML_SCHEMA"
values
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns="http://www.relational.com/root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>'))
-- Output
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
5 rows selected.
Recyclebin purged.
Session altered.
drop table VALIDATE_XML_SCHEMA
ERROR at line 1:
ORA-00942: table or view does not exist
Create Folder for TEST schema, user
declare
ERROR at line 1:
ORA-31003: Parent / already contains child entry test
ORA-06512: at "XDB.DBMS_XDB", line 316
ORA-06512: at line 4
=================================================================
Register Relational XML SChema
=================================================================
XML SChema
PL/SQL procedure successfully completed.
Cleaning up
call DBMS_XMLSCHEMA.deleteSchema(:schemaURL,4)
ERROR at line 1:
ORA-31000: Resource 'http://www.relational.com/root.xsd' is not an XDB schema document
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 106
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 102
ORA-06512: at line 1
Commit complete.
XSD Schema
PL/SQL procedure successfully completed.
Session altered.
PL/SQL procedure successfully completed.
Commit complete.
=================================================================
Register Binary XML SChema
=================================================================
XML SChema
PL/SQL procedure successfully completed.
Cleaning up
call DBMS_XMLSCHEMA.deleteSchema(:schemaURL,4)
ERROR at line 1:
ORA-31000: Resource 'http://www.binary.com/root.xsd' is not an XDB schema document
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 106
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 102
ORA-06512: at line 1
Commit complete.
XSD Schema
PL/SQL procedure successfully completed.
Session altered.
PL/SQL procedure successfully completed.
Commit complete.
=================================================================
Register SECOND Binary XML SChema
=================================================================
XML SChema
PL/SQL procedure successfully completed.
Cleaning up
call DBMS_XMLSCHEMA.deleteSchema(:schemaURL,4)
ERROR at line 1:
ORA-31000: Resource 'http://www.different.com/roots.xsd' is not an XDB schema document
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 106
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 102
ORA-06512: at line 1
Commit complete.
XSD Schema
PL/SQL procedure successfully completed.
Session altered.
PL/SQL procedure successfully completed.
Commit complete.
=================================================================
END Registration Process
=================================================================
Session altered.
SCHEMA_URL BIN
http://www.relational.com/root.xsd NO
http://www.binary.com/root.xsd YES
http://www.different.com/roots.xsd YES
3 rows selected.
no rows selected
no rows selected
=================================================================
BASICFILE - XMLSCHEMA (default) - DISALLOW NONSCHEMA
=================================================================
drop table "VALIDATE_XML_SCHEMA"
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
No schema defined
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00021: undefined element "ROOT"
Bogus, noexistent schema defined
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00023: unknown namespace URI "http://www.bogus.com/root.xsd"
Binary schema defined
1 row created.
Binary schema with different location path
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00023: unknown namespace URI "http://www.different.com/roots.xsd"
Binary schema with incorrect "root(s)"
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00023: unknown namespace URI "http://www.different.com/roots.xsd"
Relational registered schema
(xmltype('<?xml version="1.0" encoding="UTF-8"?>
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00023: unknown namespace URI "http://www.relational.com/root.xsd"
=================================================================
BASICFILE - XMLSCHEMA - ALLOW NONSCHEMA
=================================================================
Table dropped.
Table created.
No schema defined
1 row created.
Bogus, noexistent schema defined
1 row created.
Binary schema defined
1 row created.
Binary schema with different location path
1 row created.
Binary schema with incorrect "root(s)"
1 row created.
Relational registered schema
1 row created.
Maybe you are looking for
-
I inadvertently deleted a lot of unbookmarked tabs so is there a way to get them back?
Immediately after I did I put a copy of places.sqlite from my profile in a safe place. places.sqlite seems to have thousands of urls in it. I am running 3.5.9 on FC11 (yeah I know I should upgrade but can't at the moment). Therefore I don't have "Hel
-
Hi I have been trying for ages to connect to NSeries PC Suite. I get as far as stage 2 on the connection wizard but then vista says that the driver is not compatible with my operating system. Can anybody help please. George
-
I'm trying to layoff a ProRes 422 720p sequence to my Panasonic Standard Def AJSD93 deck. I have it downconverted thru my AJA i/o box...but for some reason when I open edit to tape and go to drop my sequence on the drop zone for assemble or insert...
-
I posted a topic some time ago and had zero (0) answer to it. Here it is once again. Mail doesn't know what to do with non breaking spaces (alt-spacebar). It simply ignores them. The right encoding is there all right (I checked) but Mail acts exactly
-
OAS 4.0.8.1 - PLSQL cartridge
I got a request failed while calling a package compiled without error on 8.1.5. Message as follows: Error occured while accessing: "app/cart1/my_pkg.validate_info" OWS-05101: execution failed due to ORA-01036 ORA-01036: Illegal variable name/number A