Extending the Resource XML Schema XDBResource.xsd
Hi,
Is anybody could share an expirience about extending
the Resource XML Schema XDBResource.xsd ?
I want to use XML DB as document repository.
I want to use some application parameters (for
example document varchar id and so on) as resource
properties. I read from Oracle documentation, that
one way is to extend the Resource XML Schema XDBResource.xsd.
Users will put documents using WebDAV, so new schema
should be used default instead of XDBResource.xsd.
Is it possible ?
Thanks in advance
Viacheslav
Thos is an error in the documentation. Extending the Resource Schema is not currently supported. We are considering this for a future release of the product. XML DB does allow small amounts of user defined meta data to be added to a Resource.....
For Instance Given the following package
create or replace package xdb_namespaces
as
RESOURCE_NAMESPACE constant VARCHAR2(128) := 'http://xmlns.oracle.com/xdb/XDBResource.xsd';
METADATA_NAMESPACE constant VARCHAR2(128) := 'http://xmlns.oracle.com/xdb/userMetaData';
RESOURCE_PREFIX_R constant VARCHAR2(128) := 'xmlns:r="' || RESOURCE_NAMESPACE || '"';
METADATA_PREFIX_M constant VARCHAR2(128) := 'xmlns:m="' || METADATA_NAMESPACE || '"';
end;
select * from all_errors where owner = 'XDB'
create or replace public synonym XDB_NAMESPACES for XDB_NAMESPACES
grant execute on XDB_NAMESPACES to public
The following procedure can add metadata to the ANY defined by the current resource Schema
procedure addUserMetaDataNode(OID varchar2)
as
metadata_xml XMLTYPE := XMLTYPE('<m:UserMetaData ' || XDB_NAMESPACES.METADATA_PREFIX_M || '/>');
begin
update /*+ NO_TRIGGER */ XDB.XDB$RESOURCE r
set r.xmldata.RESEXTRA = metadata_xml.getClobVal()
where sys_nc_oid$ = hextoraw(OID)
and existsNode
object_value,
'/r:Resource/r:Contents',
XDB_NAMESPACES.RESOURCE_PREFIX_R
) = 1
and existsNode
object_value,
'/r:Resource/m:UserMetaData',
XDB_NAMESPACES.RESOURCE_PREFIX_R || ' ' || XDB_NAMESPACES.METADATA_PREFIX_M
) = 0;
end;
Note that this is not a SUPPORTED method of doing this.. Once the UserMetaDataNode has been added additional metadata can be added using updateXML with an XPATH that targets the UserMetaData node.
A Future release of XML DB will provide a facitlity to attach a row in a schema based XML table, containing user defined meta data to a resoure, in the same way that the defaultTable mechanisim allows the content of a resource to be stored in an XMLType table.
Similar Messages
-
Hi all,
I just read Pages 346-348 of the book "Microsoft SQL Server 2012 Bible" written by A. Jorgensen, P. LeBlanc, J. Chinchilla, J. Segarra & A. Nelson (published by Wiley) regarding XML Schemas and XML SCHEMA COLLECTIONS: Step 1. create and
save orderxml.xml
<Order OrderID="1">
<Item>
<ItemNumber>V001</ItemNumber>
<Quantity>1</Quantity>
<Price>299.99</Price>
</Item>
</Order>
Step 2. using the tool in the following location:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
Open a command prompt, and navigate the preceding directory. The syntax for creating schema is: Xsd.exe C:\temp\orderxml.xml /outputdirectory:c:\temp to create the orderxml.xsd file.
Step 3. Copy all the contents of the orderxml.xsd file to the clipboard, and create a new query window in SQL Server Management Studio, pasting in the content of the clipboard. To create the XML Schema Collection, you need to add the CREATE XML SCHEMA COLLECTION
statement to the beginning of the schema as shown below:
--MSss2012bibleP348.sql for XML Schema Collection OrderInformationSchemaCollection
-- Copied and executed by SHC (Date & Time): 24 April 2015 8:05 AM
USE ScottChangDB
GO
Create XML SCHEMA COLLECTION OrderInformationCollection AS
N'<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schema-microsoft-com:xml-msdata">
<xs:element name="Order">
<xs:sequence>
<xs:element name="Item" minOccurs="0" maxOccurs="unbounded".
<xs:complexType>
<xs:sequence>
<xs:element name="ItemNumber" type="xs:string" minOccurs="0" />
<xs:element name="Quantity" type="xs:string" minOccurs="0" />
<xs:element name="price" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="OrderID" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded'>
<xs:element ref="Order" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>' ;
/* Apply it to the table/columns */
ALTER TABLE ItemInfo
ALTER COLUMN ItemData xml (OrderInformationCollection)
GO
I prepared (i) the orderxml.xml file for Step 1 and Step 2, and (ii) the MSss2012bibleP348.sql file for Step 3. But I am not sure that I can do the Steps (i) and (ii) in my PC that does not have the regular version of Microsoft SQL Server 2012 and Microsoft
Visual Studio 2012. Furthermore, I have difficulties to do Step 2 and Step 3 in my PC that is the part of Windows 7 Lan Computer System in my office: I navigated to my C:\Program Files (x86)\Microsoft SDKs\v7.0A\Bin\, I did not see the x64
thing in the Bin folder, but, I saw the xsd.exe in the Bin folder. If I click the xsd.exe and I get the following in the bottom of the PC screen:
xsd.exe Date modified:12/122011 12:55 PM Date created: 12/12/2011 12:55 PM
Applicaion Size:81.8 KB
Also, I see my PC screen flashes (and it looks like a dialog box with black background to flash for me to type the command) quickly. I am lost completely in this step and I don't understand the whole thing in doing Step 1, Step 2, and Step 3
I briefly summarized/described/presented above.
I need the following help from the experts of XML Schemas and XML Schema Collections in Microsoft SQL Server 2012 Management Studio:
Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
Help #2: How can I execute the xsd.exe in my C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in my ScottChangDB
database?
Please kindly help and give me the answers/comments for Help #1, Help #2 and Help #3.
Thanks in advance,
Scott ChangHi Scott,
Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
Step1 and Step2 not that related to SQL Server, you can get the XSD from a given XML with an online XSD generator.
Google search: XSD generator
Help #2: How can I execute the xsd.exe in my C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
Please see the link in the #1
Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in
my ScottChangDB database?
See the syntax and example in
create XML schema collection
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Location of XML schema file (XSD)
Hi! Previously a XML schema was imported into the Console Manager and used for the import of data into the repository. Now we have made some changes and I would like to change the XML schema file. However, I would like to get a copy of the previously import schema (XSD) file from the system. Does anyone know where this file can possibly be held? Any way for us to extract this file to update?
Cheers!
SFHi SF,
the XSD is actually stored in MDM's database. One option to export is using the transport schema mechanism in MDM console - asuming that you're on MDM 7.1. If so, right-click on your repository in MDM console and choose Transport -> Export Repository Schema in the context menu. Doing this you'll get a huge XML file describing your repository. Open this XML in a suitable editor (e.g. IE, Wordpad, XML Spy, and so on) and check the file contents. Somewhere inside you'll find a section for XML Schemas and your XSD.
If you are on 5.5, the only option is accessing the DB directly...
Best regards
Michael -
Can someone verify the attached XML schema
I recently started working on XML and I am creating an xsd for the following sample xml
<?xml version="1.0" encoding="UTF-8"?>
<Student>
<Student_Data>
<name>John</path>
<age>25</module>
<Roll_No>1</coulmnname>>
</Student_Data>
<Student_Data>
<name>mary</path>
<age>26</module>
<Roll_No>2</coulmnname>>
</Student_Data>
</Student> I created the following schema for the above XML
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="stringtype">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="CommonData">
<xs:sequence>
<xs:element name="name" type="stringtype"/>
<xs:element name="age" type="stringtype"/>
<xs:element name="rollnumber" type="stringtype"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="student_list">
<xs:sequence>
<xs:element name="Student_Data" maxOccurs="unbounded" type="CommonData"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Student" type="student_list"/>
</xs:schema> Can someone look at it and let me know if this is the right schema for the above sample xml?
I am not sure if I used the "student_list" in a right way.Are you doing this by hand? Don't. It's much easier to use a tool, e.g. XMLSpy, or an IDE plugin.
-
Convert XML Schema Files (XSD) in HTML Forms
Hi Everybody,
I am new in the topic of the XML, XSD, the situation is the following , I have a few files .XSD and need to generate automatic html forms based on these .XSD to gather information and later convert them into XML files and save them in a repository and later a middleware will process this information.
My first serious question if it is possible to develop the above mentioned task automatic? And the second one where you recommend to me to start investigating?.
Thanks in advance for your answer
Regards from Peru.There are products which do that already, I think. XMLSpy is one. Check that out to see if I'm right (not sure about the HTML part). Otherwise, welcome to the club of several hundred people who have asked basically that same question (only not with the HTML part) here.
-
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. -
OAF: *PG.xml is read-only. Unable to extend the LOVRN to add lovmappings
Hello All,
I am trying to extend the PG.xml to add additional lovmappings using JDev. But the PG.xml is readonly. Unable to create new items on lovmappings!
I have imported all the server.xml for the VO extension. That worked fine. ( I tried to add the new lovmappings using Personalization but with NO LUCK! ).
So, now I am trying to add the lovmappings using JDev and am unable to create new lovmappings! The whole PG.xml is readonly (except the Privacy and others on the footer! ).
So I opened only the PG.xml and the concerned LovRN.xml from myprojects/oracle/apps directory! along with all the myclasses/oracle/apps xml files.
So Do I need to bring in anything else into my project to make the lovmapping to create new items ???
Please help...
Thanks,
FrancisRamkumar,
This is what I am trying to do!
I extended the LovVO and deployed it successfully to application. I could see and use the newly added fields in the LOV region. That works fine.
The requirement is:
I want to populate the newly added field values from Lov region to the base page. This is what I did.
1. Added the 2 new "Message Styled Text" items (from the extended VO) in the LOV region ( But not rendedred! )
2. Added 2 new "Message Styled Text" items on the base page to populate the values from the LOV region.
3. On the base page, personalizing the LOV (lovMappings) to inherit the values from the LOV region.
>> Created 2 new lovmappings to inherit the 2 new values from the LOV region extended VO. ( Here the "LOV Region Item" {the itemID from the LOV region that I want to bring back and populate} and "Return Item" {the itemID on the base page that I want the value to get populated} are the only fields I entered other than the ID column! )
5. Bounced the apache.
-- After doing this, logged back in and tried the LOV, it doesn't populate the inherited values to the newly created items on the base page.
Thanks for all the help.
FR -
How to read data with different XML schemas within the single connection?
I have Oracle 11g database
I access it through jdbc:oracle:thin, version 11.2.0.3, same as xdb.
I have several tables, each has one XMLType column, all schema-based.
There are three different XML schemata registered in the DB
I may need to read the XML data from several tables.
If all the XMLTypes have the same XML schema ,there is no problem,
If the schemata are different, the second read throws BindXMLException.
If I reset the connection between the reads of the XMLType column with different schemata, it works.
The question is: how can I configure the driver, or the connection to be able to read the data with different XML schemata without resetting the connection (which is expensive).
The code to get the XMLType data is textbook implementation:
1 ResultSet resultSet = statement.executeQuery( sql ) ;
2 String result = null ;
3 while(resultSet.next()) {
4 SQLXML sqlxml = resultSet.getSQLXML(1) ;
5 result = sqlxml.getString() ;
6 sqlxml.free();
7 }
8 resultSet.close();
9 return result ;It turns out, that I needed to serialize the XML on the server and read it as Blob. Like this:
1 final Statement statement = connection.createStatement() ;
2 final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;
3 ResultSet resultSet = statement.executeQuery( sql ) ;
4 String result = null ;
5 while(resultSet.next()) {
6 Blob blob = resultSet.getBlob( 1 );
7 InputStream inputStream = blob.getBinaryStream();
8 result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();
9 inputStream.close();
10 blob.free();
11 }
12 resultSet.close();
13 statement.close();
14
15 System.out.println( result );
16 return result ;
17
Then it works. Still, can't get it work with XMLType in resultset.On the client unwrapping XML blows up when trying to switch to different XML schema. JDBC/XDB problem? -
Autotype from XML schema problems
Hello,
I am trying to autotype the following Xml schema:
http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3
My build.xml contains:
<target name="autotype" >
<autotype
schemaFile="REL-5-MM7-1-3.xsd"
targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
packageName="com.foo"
keepGenerated = "True"
destDir="output" />
</target>
1.
I run using ant but it fails..
SubmitRspTypeCodec.java:15: cannot resolve symbol
[autotype] symbol : class GenericResponseTypeCodec
[autotype] location: package soap
[autotype] extends javax.xml.soap.GenericResponseTypeCodec
weblogic.webservice.tools.build.WSBuildException: Failed to do type mapping -
with nested exception:
[weblogic.xml.schema.binding.BindingException: ERROR: during code compilation
- with nested exception:
[java.io.IOException: Compiler failed executable.exec]]
The interesting point is when i deleted following 3 lines from schema (line 413
to 415 in REL-5-MM7-1-3.xsd),
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
no compile error is thrown.
2.
But the weird thing is that some of classes are not generated, for example SubmitReqType,
ReplaceReqType. This is because they reference RelativeOrAbsoluteDateType (line
367). And RelativeOrAbsoluteDateType contains the following union definition:
<xs:union memberTypes="xs:dateTime xs:duration"/>
i think that this union definition might cause problem but neither an error nor
a warning message is submitted from ant. It says successful but missing classes.
I am struggling with these 2 problems for days, any help would be appreciated.
Thanks,
aLiHi Ali,
I suspect that the reason you are having this problem is covered in the following
link:
http://e-docs.bea.com/wls/docs81/webserv/overview.html#1074641
I guess my question is, what else do you have in the build.xml that uses (or attempts
to use) the autotype Ant task? Are you trying to build a client (i.e. a JAX-RPC
static stub) for a web service? Is this for a WebLogic Web Service you want to
build? Or are you just trying to see if autotype can process the .xsd file, in
question? If so, the above link states why it currently won't work.
One alternative option, is to use a Workshop Schema project (or XMLBeans) to process
the .xsd file. I just did that, and it worked fine :-)
Regards,
Mike Wooten
"Ali Pakkan" <[email protected]> wrote:
>
Hello,
I am trying to autotype the following Xml schema:
http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3
My build.xml contains:
<target name="autotype" >
<autotype
schemaFile="REL-5-MM7-1-3.xsd"
targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
packageName="com.foo"
keepGenerated = "True"
destDir="output" />
</target>
1.
I run using ant but it fails..
SubmitRspTypeCodec.java:15: cannot resolve symbol
[autotype] symbol : class GenericResponseTypeCodec
[autotype] location: package soap
[autotype] extends javax.xml.soap.GenericResponseTypeCodec
weblogic.webservice.tools.build.WSBuildException: Failed to do type mapping
with nested exception:
[weblogic.xml.schema.binding.BindingException: ERROR: during code compilation
- with nested exception:
[java.io.IOException: Compiler failed executable.exec]]
The interesting point is when i deleted following 3 lines from schema
(line 413
to 415 in REL-5-MM7-1-3.xsd),
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
no compile error is thrown.
2.
But the weird thing is that some of classes are not generated, for example
SubmitReqType,
ReplaceReqType. This is because they reference RelativeOrAbsoluteDateType
(line
367). And RelativeOrAbsoluteDateType contains the following union definition:
<xs:union memberTypes="xs:dateTime xs:duration"/>
i think that this union definition might cause problem but neither an
error nor
a warning message is submitted from ant. It says successful but missing
classes.
I am struggling with these 2 problems for days, any help would be appreciated.
Thanks,
aLi -
[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. -
XML Schema Generated By XMLSpy fails validation in JDev 10.1.3.0.4
Hi gurus,
I am trying to view an XML schema generated by XMLSpy in JDev 10.1.3.0.4 but got this error:
Error(6,74): <Line 6, Column 74>: XML-24523: (Error) Invalid value 'simpletypes\AmendmentReasonChargeType.xsd' for attribute: 'schemaLocation'
Now in the XML schema, there is this line that causes the above error:
<xs:include schemaLocation="simpletypes\AmendmentReasonChargeType.xsd"/>
The same XML schema can be opened in Visual Studio 2003 OK. Could anyone help me out here? Thank you!
BenThere is a tool tip that displays over the line that causes the error and this is what it says,
value of attribute schemaLocation not of anyURI type. The value must be of the following type:
Type Name: anyURI Primitive Type: anyURI
What does it mean?
Thanks
Ben -
Not able to pass cyclic XML schema type to a webservice method
I have a webservice method called getData(GetDataDocument
gDoc).
I constructed a request with object (which exactly satisfy
the XML schema def) to call up the getData(). [From my java client
also I did the same; but the java classes have been generated using
apache's xmlBeans; this works fine with the same kind of request].
But the soap request constructed from flex does not get
generated with all the values that I set in the request object.
On further observation, I found out that if the schema
involves cyclic elements, the soap request is not getting
constructed as desired.
My schema def:
<complexType name="PredicateBagType">
<sequence>
<choice>
<element maxOccurs="unbounded" minOccurs="0"
name="PredicateBag" type="tns:PredicateBagType"/>
<element maxOccurs="unbounded" minOccurs="0"
name="BinaryPredicate" type="tns:BinaryPredicateType"/>
<element maxOccurs="unbounded" minOccurs="0"
name="UnaryPredicate" type="tns:UnaryPredicateType"/>
</choice>
</sequence>
<attribute name="contextNode"
type="tns:contextNodeIDType"/>
<attribute default="false" name="negate"
type="boolean"/>
<attribute name="type"
type="tns:PredicateBagTypeType"/>
</complexType>
Note that the PredicateBagType may contain another
PredicateBagType.
I have constructed my request with objects in my flex
application . Though I have set the BinaryPredicate object in my
PredicateBag object, the soap request constructed looks like this
which is not desired
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<tns:get_Data maxPrograms="0" personalInfoUse="false"
xmlns:tns="urn:tva:transport:2005">
<tns:QueryConstraints>
<tns:PredicateBag contextNode="1" negate="false"
type="AND"/>
</tns:QueryConstraints>
<tns:RequestedTables>
<tns:Table type="ProgramInformationTable"/>
</tns:RequestedTables>
</tns:get_Data>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>.
If I comment out the PredicateBagType choice in my xsd, the
flex application constructs the soap request looks like this.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<tns:get_Data maxPrograms="0" personalInfoUse="false"
xmlns:tns="urn:tva:transport:2005">
<tns:QueryConstraints>
<tns:PredicateBag contextNode="ProgramInformation"
negate="false" type="AND">
<tns:BinaryPredicate fieldID="Genre" fieldValue="Fiction"
test="contains"/>
</tns:PredicateBag>
</tns:QueryConstraints>
<tns:RequestedTables>
<tns:Table type="ProgramInformationTable"/>
</tns:RequestedTables>
</tns:get_Data>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This request holds good. But I cannot comment out the
PredicateBagType from my choice. Is this an issue with soap request
construction issue in Flex..?Yes, <choice> is just "partial" supported in Flex 2 .
read this
link
for partial and not supported tags
Partially supported XML Schema structures
The following XML Schema structures or structure attributes
are only partially implemented in this release:
<choice>
<all>
<union>
regards
kcell -
I have a list of schema files and they a number of elements in them. But for my data extraction i use only close to 300 tags. When i register the schema I get an error that a table cannot of have more than 1000 columns. My work mate is working on Annotations and I am planning to build a new schema to make extract only these 300 tag names and also make sure the XML file can be validated like it did earlier. Explaining this i came across a complex type element called *<any>* which can be used to allow elements to be available which are not declared within the schema file.
My Original schema file looks something like below,
<xsd:complexType name="WfInformation">
<xsd:all minOccurs="0">
<xsd:element name="Company" type="WfCompany" minOccurs="0" />
<xsd:element name="HeadOffice" type="WfOffice" minOccurs="0" />
<xsd:element name="IndependentOffice" type="WfIOffice" minOccurs="0" />
<xsd:element name="AffiliateCompany" type ="WfIAOffice" minOccurs="0" />
<xsd:element name="Number" type="xsd:string" minOccurs="0" />
<xsd:element name="ReferenceID" type="xsd:string" minOccurs="0" />
</xsd:all>
</xsd:complexType>
of the above list of items i use only elements Company, HeadOffice, Number. After reading through some documentation I wanted to <any> tag like below,
<xsd:complexType name="WfInformation">
*<xsd:sequence>*
<xsd:element name="Company" type="WfCompany" minOccurs="0" />
<xsd:element name="HeadOffice" type="WfOffice" minOccurs="0" />
*<xsd:any processContents="lax"/>*
*<xsd:any processContents="lax"/>*
<xsd:element name="Number" type="xsd:string" minOccurs="0" />
*<xsd:any processContents="lax"/>*
*</xsd:sequence>*
</xsd:complexType>
My question is if I am correcting the lines as i mentioned above will be Register schema again fail with same reason that i have 1000 columns. As i understand every element inside an Complex element is stored as a column value. In that case will this redesign work. Or is there any other way to approach re-desgin the XML Schema.Thanks. I think that leaves out my option to create a totally new Schema to suit my XML files.
Only other option we have is to use Annotations.
I think my colleague - eoin62 would have shared the XML Schema files earlier through your oracle email address.
Please refer thread - How to register multiple XSD files
But we received a reply and we knew very little on how to make changes to Admin.xsd and how would that solve our problem. Please correct me if i am incorrect. Because the biggest Schema was estimate.xsd that has close to 800+ elements. I am not sure if my colleague sent you the necessary tag names we use within the Schema. We have close to around 300 tags we use. But our combined XML Schema has close to 1600+ If we have to annotate, i thought it would be better we tell Oracle which tagswe need, which inturn should should help better create XMLtype table against a Schema and work on performance.
Your earlier reply was,
Basically in XML Schema Admin.xsd element AdminCompin WorkfileTypeneeds to be stored Out of line..
Add the annotations xdb:SQLInline=”false” and xdb:defaultTable=”ADMIN_COMP_XML”. to the element..
if you can share with our XML Schema on how to annotate or if you can share a location that shows how an annotated or non-annotated Schema works that would help us correcting our Schema files.
Thanks for all your support. We have gone a long way in XML Parsing in the last 6 weeks.
Edited by: beta32c on Feb 19, 2013 12:09 AM -
Hi All
How to tackle this xml schema validation problem
i am using the sample code provided by ORacle technet for xml
schema validation in the Oracle database(817).
The sample code works perfectly fine.
Sample as provided by http://otn.oracle.com/tech/xml/xdk_sample/archive/xdksample_093001.zip.
It works fine for normal xml files validated against
xml schema (xsd)
but in this case my validation is failing . Can you let me know why
I have this main schema
Comany.xsd
===========
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.company.org"
xmlns="http://www.company.org"
elementFormDefault="qualified">
<xsd:include schemaLocation="Person.xsd"/>
<xsd:include schemaLocation="Product.xsd"/>
<xsd:element name="Company">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Person" type="PersonType" maxOccurs="unbounded"/>
<xsd:element name="Product" type="ProductType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
================
which includes the following 2 schemas
Product.xsd
============
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:complexType name="ProductType">
<xsd:sequence>
<xsd:element name="Type" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
==============
Person.xsd
===========
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:complexType name="PersonType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="SSN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
=================
now when i try to validate a xml file against Company.xsd
it throws an error saying unable to find Person.xsd.
no protocol error
Now where do i place these 2 schemas(.xsd files) Person & product
so that the java schemavalidation program running inside Oracle
database can locate these files
Rgrds
SushantHi 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
Maybe you are looking for
-
How do you remove credit card info from apple store app on ipad?
Is there a way to remove my credit card info on the apple store app on iOS? There is no option for none. I don't mean from iTunes I have a gift card on file in iTunes.
-
SRM 7.0 Invoice posting issues, validation
Hi Experts , We are configuring SRM7.0 with ECC6 ( Ehp4) having Classic Scenario . 1. In Std SRM , we can post Invoice both ways With ref to PO W/o ref to PO. We don't want to post Invoice w/o refernce to PO. How it can be stoped ? I want syst
-
Ambigious Column Not Detected In SELECT with JOIN
I wrote the following SELECT query. SELECT TRANS.ID, TRANS.INVISIBLE FROM TRANS JOIN TRANSCAT TC ON TC.ID = TRANS.TRANSCATID JOIN TRANSTYPE TT ON TT.ID = TRANS.TRANSTYPEID WHERE INVISIBLE = 0 AND ID IN (SELECT DISTINCT TRANSID FROM XTRANS WHERE XTRAN
-
Query with creating sub material group
Hi We hv requirement of additional submaterial group with existing material group. i hv configured & its coming in sales org2 tab as below. However when i got mm02, and check put input values its asking for input values after clicking on continue w/
-
Slow Speeds, no phone for two months, extortionate...
Last summer, in preparation for Infinity (or so we were told), work was carried out at our local cabinet. Most houses in the street lost their phone for days, weeks or even months. Thankfully we have a second line in the house dating back to dial up