This is an example of schema validating with error feedback
Hi,
Hope this is of help....
This is an example of schema validating WITH error feedback
public boolean validate(InputStream is) {
// create and setup the DOM parser object
parser = new DOMParser();
parser.setPreserveWhitespace(false);
parser.setValidationMode(XMLConstants.SCHEMA_STRICT_VALIDATION);
boolean isValid = false;
if (is != null) {
try {
parser.parse(new InputSource(is));
isValid = true;
} catch (XMLParseException e) {
for (int i = 0; i<e.getNumMessages() ;i++){
System.out.println("XMLParseException nr:"+new Integer(i+1)+" \'imsmanifest.xml\' line nr: "+new Integer(e.getLineNumber(i))+" col nr:"+
new Integer(e.getColumnNumber(i))+" (formatErrorMessage: "+e.formatErrorMessage(i)+") ["+e.getMessage(i)+"]");
} catch (java.io.IOException e) {
System.out.println("IOException: Error creating input source [" + e.getMessage() + "]");
} catch (org.xml.sax.SAXException e) {
System.out.println("SAXException: Error parsing [" + e.getMessage() + "]");
} catch (Exception e){
System.out.println("Exception: Error parsing [" + e.getMessage() + "]. ");
doc = parser.getDocument();
return isValid;
regards
Jon
"personally, I'd just put the exception handling into the package."
Maybe I am making this over-complicated. I would like all the error handling in the package. It seems like putting an ONSERVERERROR trigger would be a little overkill, and if it fires on every database error, and I have to screen for only my errors seems like a little overkill and to me, it seems like it would incur quite a bit of overhead for the database seeing it is firing for every error. I don't even know if I would ultimately be allowed to keep it.
Really, all I would want to do is:
1) Handle the error and recover if possible
2) If it is a fatal error, have a way to abort the package gracefully with some kind of record of it.
3) Allow for the possibility of non-fatal errors or messages, even that I might generate myself to be able to be logged.
This package has about 20 procedures now. If I have an error (particularly fatal), in let's say, procedure 8, I don't even know what happens. I don't know if by default it aborts the whole package or just that procedure or just keeps going. Is it possible to get just hung up and sit there?
Thanks for the input.
Similar Messages
-
Schema Validation with Java and Document object
Hi, I am working on a project that will validate an xml Document object from a child class. I seem to have completed XSD validation with new DOMSource(doc) and using schema factory, which doesn't support DTD validation. And now I am attempting to validate the DTD. It seems like all the examples I've seen are trying to parse files, and I am struggling with finding a way to validate it directly against the document object.
The child class creates the xml document which is passed back to the parent class, and I need to do the validation in the parent class, so I need away to validate against the document object. This will be an assertion in Fitnesse if anyone is familar with it.
private void doSchemaValidationCommand(int rowCount, Document doc, String xpathExpression)
String validationPath = getText(rowCount,1);
String extensionSeparator = ".";
Boolean error = false;
String ext = null;
try
int dot = validationPath.lastIndexOf(extensionSeparator);
ext = validationPath.substring(dot + 1);
catch(Exception e)
this.wrong(rowCount, 1, e.getMessage());
if (ext.equalsIgnoreCase("xsd"))
try {
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
File schemaLocation = new File(validationPath);
Schema schema = factory.newSchema(schemaLocation);
Validator validator = schema.newValidator();
try {
validator.validate(new DOMSource(doc));
catch (SAXException ex) {
this.wrong(rowCount, 1, ex.getMessage());
error = true;
catch (IOException ex) {
this.wrong(rowCount, 1, ex.getMessage());
error = true;
catch (SAXException ex) {
this.wrong(rowCount, 1, ex.getMessage());
error = true;
catch (Exception ex){
this.wrong(rowCount, 1, ex.getMessage());
error = true;
else if (ext.equalsIgnoreCase("dtd"))
try {
}I tried this but it doesn't give me any validation of whether or not it was completed successfully, it just adds a tag for the dtd to the xml and doesn't seem to do anything further with it, am I missing any steps?
else if (ext.equalsIgnoreCase("dtd"))
try {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(System.out);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, validationPath);
transformer.transform(source, result);
catch(Exception e)
this.wrong(rowCount, 1, e.getMessage());
error = true;
}Edited by: sarcasteak on Apr 13, 2009 1:33 PM -
How to implement the schema validation with XSD in adapter module
Dear All,
I am trying to develop a EJB as the file adapter mudule.
Please guide me how to implement the schema validation of the source message with XSD.
Or provide me the relative resources about this task.
Thanks & Regards,
Red
Edited by: Grace Chien on Nov 19, 2008 8:23 AMHi Grace,
You can do the xml scema validation in PI7.1 version directly.
To develop the adapter module for xml schema validation
Validating messages in XI using XML Schema
Schema Validation of Incoming Message
Regards
Goli Sridhar -
How to do schema validation with XSD_90200B Beta?
Hi, I just downloaded xdk_java_9_0_2_0_0B.zip. And found that the size of xmlparserv2.jar and xschema.jar are significantly reduced. And if I replace them with the June version I had before, it does not do schema validation anymore.
What other jar files do I need to do Schema Validation?
Thank you very much!
Yufei
nullThe schema validation is in the xschema.jar.
-
Hi everybody
Look at the following simple xml schema:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:element name="num" type="xsd:string"/>
<xsd:element name="amount" type="xsd:integer"/>
<xsd:element name="invoice">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="num"/>
<xsd:element ref="amount"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="invoices">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="xsd:invoice" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
When I open it in JDeveloper 10.1.3.2.0 and choose "Validate XML", validation executes without errors.
In spite of bad namespace declaration in <xsd:element ref="xsd:invoice" ...
For example, in XML Spy validation of this schema ends with error: "'xsd:invoice' must refer to an existing element".
If there any option on JDeveloper to turn on namespace-aware validation to prevent the above situation?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 -
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,
VinothHi 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 -
SaxParser supports schema validation?
Does oracle.xml.parser.v2.SAXParser support XML schema validation?
Thanks!Yes, you can do XML Schema Validation with the SAX Parser.
-
Cisco VPN client crashes with Error 51 on Intel Mac Mini
I am in the process of migrating from XP to Tiger on a brand-new Mac Mini (Intel Duo). Now I am stuck:
I use v 4.8.00 of the Cisco VPN client supplied by my university's IT dept. to connect to the Campus intranet. I have been unable to succesfully use this software, as it crashes upon initializing with "Error 51: Cannot connect to the VPN subsystem." Re-installing the software does not change the state of affairs.
After some research, I used a hack found here (http://www.versiontracker.com/php/feedback/article.php?story=20060107011305622 and http://www.versiontracker.com/php/feedback/article.php?story=20060107011305622) to manually restart the VPN daemon. The Terminal result looks like this:
kld(): warning /System/Library/Extensions/CiscoVPN.kext/Contents/MacOS/CiscoVPN cputype (18, architecture ppc) does not match cputype (7 architecture i386) of objects files previously loaded (file not loaded)
kextload: kldlookup("_kmodinfo") failed for module /System/Library/Extensions/CiscoVPN.kext/Contents/MacOS/CiscoVPN
kextload: a link/load error occured for kernel extension /System/Library/Extensions/CiscoVPN.kext
load failed for extension /System/Library/Extensions/CiscoVPN.kext
(run kextload with -t for diagnostic output)
Not being fluent in Darwin, I can only interpret this to mean that the VPN client is incompatible with the Intel chip in the Mac mini... Is this correct? Is the only way for me to use VPN to wait for a 4.8.x version to be made available?
Hopeful still,
felixxAlso - the Mac VPN system will work with most Cisco networking devices. You can open up the PCF profile that your IT group wants you to use and figure out most of the questions Internet Connect will ask you to set up the VPN connection. For the rest, you have to ask the IT group or try some things and see what works...
cheers,
Mike -
"Archive Source Files with Errors" feature - how to?
File sender adapter has a feature to Archive Source Files with Errors.
I have an adapter module applied to inbound files and in case an error occurs during the processing of the adapter module, I want to make use of this feature , this is because the CC keeps on picking the file with erroneous data after regular specified interval and shows up an error in RWB.
How can I use the Archive Source Files with Errors feature with this? Do I have to do anything specific in the adapter module code for this to work?
Regards,
AmolHi,
if you see whats mentioned on the help link
http://help.sap.com/saphelp_nw04/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/frameset.htm
it says:
To archive source files where a permanent error occurred during processing, set the indicator.
A permanent error occurs either during the conversion of the file content, or in a module in the module processor.
does this not mean it could be used with errors raised in adapter modules? ideally it should be. -
Transport Control program tp edded with error code 0247
Hi Guys
I have co setup TMS in a three system landscape, with the PRD server being the transport domain controller. The three systems are running on the HP -UX OS. The import queue of the PRD server remains empty. All the checks on the TMS configurations shows OK.
When i try to add the transport request from Extras > Other Requets> ADD and enter the transport requet no. I receive this message:
Transport Control program tp edded with error code 0247
Errors: add buffer has problem with data- and/or cofile
Can someone assist? I have got some challenges on linux. Are there steps i need to follow or is there something i need to do?
Cheers,
DanielDaniel,
Mostly this issue comes when you have some permission problem.
Please check the permission of your /usr/sap/trans/bin and related directories.
It is ideally sidadm.sapsys. Please give 775 to respective directories.
If your Trans directory is mounted, please check if it is properly mounted or not.
If it is not working, please check the log in TMS alert Viewer (Go to STMS Monitor>TMS Alerts>TMS Alert Viewer)
and paste the detailed log here.
Regards,
Sujit. -
Xdksample_093001.zip - Schema Validation example
I have downloaded this example and installed it as per
instructions.
when I try to run it I get the following error.
The following error has occurred:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.parser.schema.XSDException: Element 'schema' has
invalid namespace: 'http://www.w3.org/2001/XMLSchema'
ORA-06512: at "NM31.SCHEMAUTIL", line 0
ORA-06512: at line 15
Details:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.parser.schema.XSDException: Element 'schema' has
invalid namespace: 'http://www.w3.org/2001/XMLSchema'
ORA-06512: at "NM31.SCHEMAUTIL", line 0
ORA-06512: at line 15
How do I/Can I resolve this?Hi Jinyu
This is the java code loaded in the database using loadjava called by a wrapper oracle stored procedure
import oracle.xml.parser.schema.*;
import oracle.xml.parser.v2.*;
import java.net.*;
import java.io.*;
import org.w3c.dom.*;
import java.util.*;
import oracle.sql.CHAR;
import java.sql.SQLException;
public class SchemaUtil
public static String validation(CHAR xml, CHAR xsd)
throws Exception
//Build Schema Object
XSDBuilder builder = new XSDBuilder();
byte [] docbytes = xsd.getBytes();
ByteArrayInputStream in = new ByteArrayInputStream(docbytes);
XMLSchema schemadoc = (XMLSchema)builder.build(in,null);
//Parse the input XML document with Schema Validation
docbytes = xml.getBytes();
in = new ByteArrayInputStream(docbytes);
DOMParser dp = new DOMParser();
// Set Schema Object for Validation
dp.setXMLSchema(schemadoc);
dp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
dp.setPreserveWhitespace (true);
StringWriter sw = new StringWriter();
dp.setErrorStream (new PrintWriter(sw));
try
dp.parse (in);
sw.write("The input XML parsed without errors.\n");
catch (XMLParseException pe)
sw.write("Parser Exception: " + pe.getMessage());
catch (Exception e)
sw.write("NonParserException: " + e.getMessage());
return sw.toString();
This is the code i used initially for validating a xml file against single xml schema (.xsd) file
In the above code could u tell how to specify the second schema validation code for the incoming xml.
say i create another Schemadoc for the 2nd xml schema.
something like this with another parameter(CHAR xsd1) passing to the method
byte [] docbytes1 = xsd1.getBytes();
ByteArrayInputStream in1 = new ByteArrayInputStream(docbytes1);
XMLSchema schemadoc1 = (XMLSchema)builder.build(in1,null);
DOMParser dp = new DOMParser();
How to set for the 2nd xml schema validation in the above code or can i combine 2 xml schemas.
How to go about it
Rgrds
Sushant -
[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. -
Getting schema validation working in Eclipse with Coherence 3.7.1.0
Just wondered if anyone had got schema validation to work in Eclipse (3.5 - Galileo) for Coherence 3.7.1.0?
The Coherence developer docs show that you should add sections like this:
<pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config
coherence-pof-config.xsd">
However, if I use that "shortened" form (for cache, pof, etc. configs) Eclipse gives a warning "No grammar constraints (DTD or XML schema) detected for the document." and the schema validation fails to work (i.e. no "auto pop-ups" when entering content, and rubbish content is gladly accepted.)
In Coherence 3.7.0, I'd used the following "extended" form (note the longer "schemaLocation") to get things working correctly:
<pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config
http://xmlns.oracle.com/coherence/coherence-pof-config/1.0/coherence-pof-config.xsd">
Also note that entering the "http://xmlns.oracle.com/coherence/coherence-pof-config/1.0/coherence-pof-config.xsd" in a web browser opens the xsd, as you'd expect.
Now...
I'm looking at the PofAnnotationSerializer in 3.7.1.0 and the "auto indexing" option. The declaration in my pof file for it fails as the "class" (or fully-qualified java.lang.Class version) in the "init-params" section isn't valid. If I look at the xsd on the url above, this is indeed the case, that option does not appear.
However, if I look at the POF xsd in the coherence.jar file for 3.7.1.0, the "class" option has been added, and has a newer 'version="1.1"' added to it's schema declaration. So I therefore tried to point my "extended" declaration to point to " http://xmlns.oracle.com/coherence/coherence-pof-config/1.1/coherence-pof-config.xsd", in order to get schema validation to work in Eclipse with this new schema. Unfortunately that url doesn't exist - you get a "Content Server Request Failed" error.
So, I guess my question is, is there a way to get myself pointed at the 1.1 versions of the xsd's so I can have schema validation working in Ecliipse? Or is there another workaround (did a bit of Googling, but that mainly seemed to be people switching validation off to simply get rid of the error...)
Cheers,
SteveCheers, Dave.
I had in fact had a try at extracting the xsd and pointing to it directly, and that did indeed work (had to do this following the same steps shown below using an "entry" in the XML Catalog.)
I had a look around at some of the other "entries" in Eclipse by default and noticed that they actually refer to xsd's directly within the jars, hence saving the extraction step and keeping screw-ups down to a minimum; a bit of playing around to get the syntax right and I finally managed to get it working.
For those who are interested (NB. my Coherence 3.7.1.0 install is in a directory "c:\coherence3.7"), the steps are:
In Eclipse, Go to Window->Preferences->XML->XML Catalog. Then create a "User Specified Entry".
In the "Location", add (without the quotes): "jar:file:/C:/coherence3.7/coherence/lib/coherence.jar!/coherence-pof-config.xsd"
In the "Key Type", add (without the quotes): "Namespace Name"
In the "Key", add (without the quotes): "http://xmlns.oracle.com/coherence/coherence-pof-config"
The schema validation now works fine. Eclipse shows no warnings/errors, and the auto-complete and validation are fully functional.
Still, it would be nice to get the "1.1" urls updated to point to the schemas on the Oracle site, to avoid all our developers from having to make these changes (and of course avoid them pointing at an older, out-of-date local install of coherence.)
Cheers,
Steve -
SAX Parser Validation with Schemas (C, C++ and JAVA)
We are currently using the Oracle XML Parser for C to parse and validate XML data using the SAX parser interface with validation turned on. We currently define our XML with a DTD, but would like to switch to schemas. However, the Oracle XML Parser 9.2.0.3.0 (C) only validates against a DTD, not a schema when using the SAX interface. Are there plans to add schema validation as an option? If so, when would this be available? Also, the same limitation appears to be true for C++ and JAVA. When will any of these provide SAX parsing with schema validation?
Thanks!
JohnWill get back to you after checked with development team...
-
Xerces2_6_2 validating with dtd and schema.. please help
Hi I am having trouble validating an xml document using xerces2_6_2
I have a DTD that containes only entity references, and a schema that is used to ensure the xml is valid.
I get this error.
Element type "my root tag" must be declared!
It seems to expect all validation grammer to be in the dtd. I have sucessfully validated with xml spy and oxygen,(oxygen uses xerces too).
This is a real pain I really would lie to take advantage of using schemas, I know I could just use entity references in this form and not have a dtd but this is really not acceptable.
I have tried out all the xerces specific properties and features but this has not worked either.
Perhaps I should implement a validator? Does anyone have any ideas?
thanksMy solution, I thought to take, wasn't the right way, but I have found following thread within the forum
http://forum.java.sun.com/thread.jspa?forumID=34&threadID=527461
The problem you have described points to a dtd error. Considering the thread above, it would make sense. It is a presumption, but perhaps that is because of the new Xerces version. I would try with an older one.
Sorry, that I could help you along.
Maybe you are looking for
-
Failover Cluster in SQL 2012 in not auto switch when stop service SQL
Good Morning to all, I'm Mr.Tuyen from VietNam. I have a big problem with AlwaysOn High Availabity in SQL 2012. I setup 3 server and join Availabilty Group. Ex: Server A (Primary), Server B (Secondary), Cluster Qourum is only node. I have test: 1. St
-
OR [ | ] --- Additions to Java?
Would it be difficult to add a new sytax for conditional statements? Say for example you had the following condition: if( (m_Names.charAt(0))== 'c' ) do something... Now what if you wanted to also check for A, C, ... without using regex. Why can't we
-
I HAVE BEEN USING AN IPHONE 4 AND I JUST TRANSFERRED ALL MY DATA TO A NEW IPHONES. IN THE OLD IPHONE I HAD 2 YAHOO AVVOUNTS RECEIVING MAILS. IN THE NEW IPHONE I CANNOT REGISTER MY SECOND YAHOO ADDRESS ,I KEEP RECEIVING THE MESSAGE THAT YAHOO SERVER C
-
UIX/BC4J: messageCheckBox - Unparseable number: "On"
I use a messageCheckBox to set values that will be posted to a database field of type Number(1). I expect it to post a 1 if the checkbox is selected. Here is the UIX tag: <bc4j:messageCheckBox id="idKUTD" name="Kutd" attrName="Kutd" prompt="KUTD" sel
-
MBA upgraded to Yosemite and the widget desktop disappear.
Hi, I just upgraded my MBA to Yosemite and after the system rebooted, I can't switch to the left desktop for the widgets. Please help. Thank you.