Data Insertion, XML Schema Specifying Element minOccurs="1
An XML schema having an element with attribute minOccurs="1" has been successfully registered. A table was created based on that schema. Inserting data both with and without that element works successfully. Why is this?
The only thing right now, I can think of, is that the database doesn't recognize it as being controlled via / depends on a registered XML Schema. See the FAQ on this forum for examples (See here: How does XML DB handle XML Schema Validation ?
Similar Messages
-
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 -
How to handle tables data in XML schema based adobe form
Hi all,
I am working on the CRM business partner creation by using Interactive adobe form with following steps:
1) Uploaded the offline Interactive adobe form to online interactive adobe form via WebDynpro ABAP;
2) Capture XML data into corresponding BAPI structures;
3) Save all the changes to database via BAPI.
The adobe form contains customer information as well as several table views which are bind with the context created in WebDynpro: Node NEW_BP_NODE cardinality 1:1 with single attributes and table type attributes (1:n): COLOUR_COMP, MEN_COMP etc.
While converting the xml format data to SAP context format, It is fine to use following routine to find the single attribute and map to the BAPI structure to do the database update.
NODE = DOCUMENT->FIND_FROM_NAME( NAME = 'XYZu2019).
XYZ = NODE->GET_VALUE( ).
Question: how to convert the xml table data to SAP context format in WebDynpro ABAP?
The XML table data looks like below.
<?xml version="1.0" encoding="UTF-8" ?>
<NEW_BP_NODE>
<COLOUR_COMP>
<DATA>
<ZZTFLD0W2AQW />
<ZZTFLDRZ2AQX>000</ZZTFLDRZ2AQX>
<ZZTFLDVD2TQW />
<ZZTFLDQK2HQX />
<ZZTFLDEL2XQX />
<ZZTFLDTC2DQX>000</ZZTFLDTC2DQX>
<ZZTFLDOR2UQX />
</DATA>
<DATA>
<ZZTFLD0W2AQW />
<ZZTFLDRZ2AQX />
<ZZTFLDVD2TQW />
<ZZTFLDQK2HQX />
<ZZTFLDEL2XQX />
<ZZTFLDTC2DQX />
<ZZTFLDOR2UQX />
</DATA>
<DATA>
<ZZTFLD0W2AQW />
<ZZTFLDRZ2AQX />
<ZZTFLDVD2TQW />
<ZZTFLDQK2HQX />
<ZZTFLDEL2XQX />
<ZZTFLDTC2DQX />
<ZZTFLDOR2UQX />
</DATA>
</COLOUR_COMP>
<MEN_COMP>
<DATA>
<ZZTFLD4V2V7V />
<ZZTFLDYD2N7W>000</ZZTFLDYD2N7W>
<ZZTFLDX32I7W />
<ZZTFLD2D2W7W />
<ZZTFLDGD2A7W />
</DATA>
<DATA>
<ZZTFLD4V2V7V />
<ZZTFLDYD2N7W>000</ZZTFLDYD2N7W>
<ZZTFLDX32I7W />
<ZZTFLD2D2W7W />
<ZZTFLDGD2A7W />
</DATA>
</MEN_COMP>
Thanks in advance for your help.
MichelleHi,
Just follow these steps:
1. Create interactive form UI element in your view.
2. Now provide Datasource and PDFSOURCE to it in form properties.
3. Now give a template name prefix with 'Z' or 'Y'.
4. Double click on it. It will prompt for interface name.
5. Provide interface name prefixed with 'Z' or 'Y'.
6. Click on Context button in the Pop up window and provide the node you have selected as DATASOURCE.
7. Click ok and it will open the form designer.
8. In this way you can create a XML Schema based Form.
9. Activate the interface and design the form providing layout type and other details.
Hope it will help.
Regards,
Vaibhav -
XML generation with SAP data using XML schema - Reg
Hello experts,
My requirement is , SAP( ztable data ) data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
Generating XML file with their Schema should be underlined.
I studied that call transformation statement helps for this.
Even then i don't have clear idea about this topic.
Please brief me about how to use their XML schema to generate XML with my own sap data.
Thanks in advance experts.
Kumarplease try this same program and see it ....
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:temporders_dtd.xml'.
* Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
* wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
size = l_xml_table_size ).
* Creating a document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
* Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
* upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
* attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
* advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
reward points if it is use fulll ....
Girish -
Greetings to all Members,
I write in the forum because my desperation is increasing because of an issue / problem I'm having with DataServices.
On the client where I am, DataServices have installed 4.0 and now I need to do a Real-Time Job. I know that to perform such jobs, you must have an XSD schema and that both input and output must be XML. In my case, my connection is through a DataStore which I returned Oracle tables in a schema. My question is: is there any way we can convert these files oracle tables or XML schemas?
The reason I need to create this job, is because I have to generate through this job that calls a web service to those tables
Thanks in advance for the answers and for help
Marga.You've closed the context, before evening calling getXML
13 DBMS_XMLGEN.closeContext(Ctx);
14 xml := DBMS_XMLGEN.getXML(Ctx); -
XML Schema for elements names varying with number
HI ,
I have an xml document where the no of tags are unlimited ,but having same name +tag number
ex:-<name1>String</name1>
<name2>String</name2>
<name3>String</name3>
<name4>String</name4>
<name5>String</name5>
I need to design a schema for this xml,where the name tag can go up to any number,i am not able to use attributes,as the system recieving this xml is demanding this format.
can any one give me a schema for this,so that i will be able to generate jaxb objects to generate xml from the schema,in my webserviceHi Abhishek,
Thanks for your reply
In our project
The remaining part of the code we are dealing with schema and jaxb objects..i am having only this xml which is pending....
as of now i was creating this xml in a dynamic passion only using DOM.
my plan is to atleast do like below
expected result
<doc>
<tag1></tag1>
<tag2></tag2>
<tag3></tag3>
<tag4></tag4>
<tag5></tag5>
</doc>
I am able to generate the below xml
Actual
<doc>
<tag></tag>
<tag></tag>
<tag></tag>
<tag></tag>
<tag></tag>
</doc>
I am trying to write an XSL and transform above result to the expected result. But still not be able to write the xsl to match mmy expected result
Edited by: Aditya on Aug 3, 2011 7:26 AM -
MDIS ValueX XML Structure, element TEXT not found in xml schema
When you extract ECC Contract through MECCM using port ERP Contract Data Transmission, if your mapping isn't correct 2 exception types are created: StructuralX or ValueX (and ImportX but I haven't seen this type of exception yet).
Anyone noticed that the structure of the XML messages are actually different? The XSD for structuralX files are the same as the files placed in the "ready" folder, where as the XSD for the valueX files are DIFFERENT, and contain a tag called <TEXT>.
This raises an issue when we're trying to handle exceptions in Import Manager using the type Port. We get error "Logon Error: Source file does not conform to XML Schema. Element <TEXT> not found in xml schema".
We can process exceptions in the structuralX folder, but not in the valuex folder because the xml file structure in the valuex folder is different.
Just wondering if anyone else has had this issue or has resolved it. We will open message with SAP.
Thanks.Hello
What is your MDM version ?
this issue happened in old MDM 7.1 versions but was fixed in SP-2 unless you mapped Clone fields and in this case the fix is a bit later.
In MDM 7.1 the latest builds of SP-2 and SP-3 should have the fix for all issues. But if you use MDM 5.5 then some issues regarding XSD conversion for exception where not addressed due to technical issues.
The workaround for MDM 5.5 (If you use a late build of SP-6 Patch-4 or SP-6 Patch-5) is to use the original file to fix the exception and not the file in the exception folder.
Please notice that when you have Structural exception then all the Source XML file will go to the Exception folder.
But in case of Value Exception - The source XML file will be dropped in the archive folder and another XML file containing VXR's (Virtual Extended Records) will be dropped in the exception folder, Therefore will have a different structure.
Hope it helps.
Thanks.
Best Regards.
Yaron. -
Obtain name into name element (XML schema)
Hello abappers,
I need obtain the next code XML schema
<xs:element name='AuditFile'>
<xs:complexType>
<xs:sequence>
<xs:element ref='Header' />
<xs:element ref='MasterFiles' />
<xs:element name='GeneralLedgerEntries' />
<xs:element name='SourceDocuments' />
</xs:sequence>
</xs:complexType>
</xs:element>
The code:
l_element_Audito TYPE REF TO if_ixml_element,
l_document TYPE REF TO if_ixml_document.
l_element_AuditFile TYPE REF TO if_ixml_element,
l_element_GeneralLedgerEntries TYPE REF TO if_ixml_element,
l_element_SourceDocuments TYPE REF TO if_ixml_element,
l_element_Header TYPE REF TO if_ixml_element,
l_element_MasterFiles TYPE REF TO if_ixml_element,
Fill root node with value AuditFile
l_element_AuditFile = l_document->create_simple_element(
name = 'AuditFile'
parent = l_element_Audito ).
Create element 'Header' as child of 'AuditFile'
l_element_Header = l_document->create_simple_element(
name = 'Header'
parent = l_element_AuditFile ).
Create element 'MasterFiles' as child of 'AuditFile'
l_element_MasterFiles = l_document->create_simple_element(
name = 'MasterFiles'
parent = l_element_AuditFile ).
Create element 'GeneralLedgerEntries' as child of 'AuditFile'
l_element_GeneralLedgerEntries = l_document->create_simple_element(
name = 'GeneralLedgerEntries'
parent = l_element_AuditFile ).
Create element 'SourceDocuments' as child of 'AuditFile'
l_element_SourceDocuments = l_document->create_simple_element(
name = 'SourceDocuments'
parent = l_element_AuditFile ).
and with the this code obtain:
<xs:element name="AuditFile">
<xs:complexType>
<xs:sequence>
<xs:element ref="Header" />
<xs:element ref="MasterFiles" />
<xs:element ref="GeneralLedgerEntries" />
<xs:element ref="SourceDocuments" />
</xs:sequence>
</xs:complexType>
</xs:element>
Can you help me, please?
Cordial greetings.Hello abappers,
I need obtain the next code XML schema
<xs:element name='AuditFile'>
<xs:complexType>
<xs:sequence>
<xs:element ref='Header' />
<xs:element ref='MasterFiles' />
<xs:element name='GeneralLedgerEntries' />
<xs:element name='SourceDocuments' />
</xs:sequence>
</xs:complexType>
</xs:element>
The code:
l_element_Audito TYPE REF TO if_ixml_element,
l_document TYPE REF TO if_ixml_document.
l_element_AuditFile TYPE REF TO if_ixml_element,
l_element_GeneralLedgerEntries TYPE REF TO if_ixml_element,
l_element_SourceDocuments TYPE REF TO if_ixml_element,
l_element_Header TYPE REF TO if_ixml_element,
l_element_MasterFiles TYPE REF TO if_ixml_element,
Fill root node with value AuditFile
l_element_AuditFile = l_document->create_simple_element(
name = 'AuditFile'
parent = l_element_Audito ).
Create element 'Header' as child of 'AuditFile'
l_element_Header = l_document->create_simple_element(
name = 'Header'
parent = l_element_AuditFile ).
Create element 'MasterFiles' as child of 'AuditFile'
l_element_MasterFiles = l_document->create_simple_element(
name = 'MasterFiles'
parent = l_element_AuditFile ).
Create element 'GeneralLedgerEntries' as child of 'AuditFile'
l_element_GeneralLedgerEntries = l_document->create_simple_element(
name = 'GeneralLedgerEntries'
parent = l_element_AuditFile ).
Create element 'SourceDocuments' as child of 'AuditFile'
l_element_SourceDocuments = l_document->create_simple_element(
name = 'SourceDocuments'
parent = l_element_AuditFile ).
and with the this code obtain:
<xs:element name="AuditFile">
<xs:complexType>
<xs:sequence>
<xs:element ref="Header" />
<xs:element ref="MasterFiles" />
<xs:element ref="GeneralLedgerEntries" />
<xs:element ref="SourceDocuments" />
</xs:sequence>
</xs:complexType>
</xs:element>
Can you help me, please?
Cordial greetings. -
[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. -
How to enhance the fields into xml schema?
Hi Expert,
We are at SRM-MDM Catalog 3.0 SP02, we enhanced two fields in the contract data which were transfered from the SRM via xml. But when the MDM import manage do the mapping between the xml file and MDM catalog items automatically, it will bring a exception with the mapping error. The error message is "Logon Error: Source file dose not conform to XML schema. Element <field name> not found in the xml schema."
How could I add these fields to xml schema?
The problem is resolved.
Edited by: Wendrin Duan on Nov 5, 2009 5:01 AMHi
Did changing the Name of the Schema in the console to be the same as the Name of the Schema file solve the problem.
I take it you used the output file with the custime fields to create the Schema file so as to have a consistent structure.
REegards,
Iggy -
Insert data into the xml schema-based xmltype table problem!
Hello, there,
I got problem in inserting data into the xmltype table after registered XML schema and created table. details see below:
1) xml schema:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Constantin Ilea (EMERGIS INC) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" targetNamespace="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" elementFormDefault="qualified">
<!-- ************** PART I: BEGIN SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
<xs:simpleType name="RoutingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Synch"/>
<xs:enumeration value="Asynch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="StatusType">
<xs:restriction base="xs:string">
<xs:enumeration value="ACTIVE"/>
<xs:enumeration value="VOID"/>
<xs:enumeration value="PENDING"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SenderApplicationType">
<xs:restriction base="xs:string">
<xs:enumeration value="PR"/>
<xs:enumeration value="CR"/>
<xs:enumeration value="POS"/>
<xs:enumeration value="CPP"/>
<xs:enumeration value="Other"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ServiceTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="IS"/>
<xs:enumeration value="WS"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RouteDirect">
<xs:restriction base="xs:string">
<xs:enumeration value="Request"/>
<xs:enumeration value="Reply"/>
<xs:enumeration value="None"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Indicator">
<xs:annotation>
<xs:documentation>can we also change the value to "ON" and "OFF" instead? in this way this cn be shared by all type of switch indicator</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="YES"/>
<xs:enumeration value="NO"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RuleType">
<xs:restriction base="xs:string">
<xs:enumeration value="ControlAct"/>
<xs:enumeration value="WSPolicy"/>
<xs:enumeration value="AccessControl"/>
<xs:enumeration value="Certification"/>
<xs:enumeration value="MessageConformance"/>
<xs:enumeration value="Variant"/>
<xs:enumeration value="Routing"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="HL7Result">
<xs:restriction base="xs:string">
<xs:enumeration value="ACCEPT"/>
<xs:enumeration value="REFUSE"/>
<xs:enumeration value="REJECT"/>
<xs:enumeration value="ACK"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="IIPType">
<xs:restriction base="xs:string">
<xs:enumeration value="PUT"/>
<xs:enumeration value="GET/LIST"/>
<xs:enumeration value="NOTIF"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ProfileTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="IIPProfile"/>
<xs:enumeration value="BizOperationProfile"/>
<xs:enumeration value="OrchestrationProfile"/>
<xs:enumeration value="DomainObjectProfile"/>
<xs:enumeration value="ServiceProfile"/>
<xs:enumeration value="ExceptionProfile"/>
<xs:enumeration value="CustomizedProfile"/>
<xs:enumeration value="SystemProfile"/>
<xs:enumeration value="HL7XMLSchemaProfile"/>
<xs:enumeration value="EnricherParametersProfile"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterType">
<xs:restriction base="xs:string">
<xs:enumeration value="String"/>
<xs:enumeration value="Object"/>
<xs:enumeration value="Number"/>
<xs:enumeration value="Document"/>
</xs:restriction>
</xs:simpleType>
<!-- ************** PART I: END SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
<!-- ************** PART II: BEGIN COMPLEX OBJECT TYPE DEFINITIONS ********************************** -->
<!-- *********************** begin new added objects, by rshan *************************************** -->
<xs:complexType name="ProfileType">
<xs:annotation>
<xs:documentation>
1.Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
2.ProfileID used to uniquely identify the current profile
3.ProfileData used to hold all the necessary profile related data
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="ProfileID" type="ProfileIDType">
<xs:annotation>
<xs:documentation>this will hold all the common attributes, espically the global unique identifier to the profile, no matter what type of profile is</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ProfileData" type="ProfileDataType">
<xs:annotation>
<xs:documentation>all the non-common profile meta data that attached to each specific profile type such as IIPProfile, OrchestrationProfile, and BizOperationProfile will be placed here</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProfileIDType">
<xs:annotation>
<xs:documentation>global unique identifier and all the common attributes across all different profiles, the @ID and @Type together will be used as the primary key to identify the profile data</xs:documentation>
</xs:annotation>
<xs:attribute name="ID" type="xs:ID" use="required">
<xs:annotation>
<xs:documentation>ID is the global unique identifier to the profile, no matter what type of profile it is</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Name"/>
<xs:attribute name="Description"/>
<xs:attribute name="Version">
<xs:annotation>
<xs:documentation>version of the profile data</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Type" type="ProfileTypeType" use="required">
<xs:annotation>
<xs:documentation>value to identify the ProfileType type within
IIPProfile,BizOperationProfile,OrchestrationProfile,DomainObjectProfile
ServiceProfile,ExceptionProfile,SystemProfile,HL7XMLSchemaProfile,
EnricherParametersProfile,CustomizedProfile
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Status" type="StatusType" default="ACTIVE">
<xs:annotation>
<xs:documentation>used to show the related profile data status like "ACTIVE","PENDING","VOID"...</xs:documentation>
</xs:annotation>
</xs:attribute>
<!--
<xs:sequence>
<xs:element name="ProfileReference" type="ProfileIDType" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>this will be the place to hold the integrity relationship with other profiles like foreign key if existed and necessary to show up</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
-->
</xs:complexType>
<xs:complexType name="ProfileDataType">
<xs:annotation>
<xs:documentation>meta data associated tightly to each specific type of profile</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:element name="EnricherParametersProfileData" type="EnricherParametersDataType">
<xs:annotation>
<xs:documentation>Enricher Parameters related profile data
1. one instance of this type may contains all the related System metadata.
2. idType part may use to identify different version/release/status
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExtendProfileData" type="ExtendProfileDataType">
<xs:annotation>
<xs:documentation>If needed, any profile data not defined within the current release scope can be added here </xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="ExtendProfileDataType">
<xs:sequence>
<xs:element name="ExtendProfile" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnricherParametersDataType">
<xs:sequence>
<xs:element name="EnricherParameter" type="EnricherParameter" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnricherParameter">
<xs:sequence>
<xs:element ref="Enricher"/>
</xs:sequence>
<xs:attribute name="serviceName" type="xs:string" use="required"/>
<xs:attribute name="interactionID" type="xs:string"/>
</xs:complexType>
<xs:element name="Enricher">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Parameters" type="Parameters"/>
<xs:element ref="Section" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ValueType">
<xs:attribute name="field" use="required"/>
<xs:attribute name="value"/>
<xs:attribute name="action"/>
</xs:complexType>
<xs:element name="Section">
<xs:complexType>
<xs:sequence>
<xs:element name="Value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="path" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="Parameters">
<xs:sequence>
<xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" use="required"/>
<xs:attribute name="reference"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RuleList">
<xs:annotation>
<xs:documentation>an array of rules</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Rule" type="RuleProfile" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RuleProfile">
<xs:attribute name="RName" use="required"/>
<xs:attribute name="RType" type="RuleType" use="required"/>
<xs:attribute name="Status" default="ON">
<xs:annotation>
<xs:documentation>By default is ON (or if is missing)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Order"/>
<xs:attribute name="Direction" type="RouteDirect">
<xs:annotation>
<xs:documentation>Request / Reply</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ************** PART II: END COMPLEX OBJECT TYPE DEFINITIONS *********************************** -->
<!-- ************** PART III: BEGIN ROOT ELEMENTS DEFINITIONS ********************************* -->
<!-- 0) Profile wrapper root element
Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
-->
<xs:element name="Profile" type="ProfileType">
<xs:annotation>
<xs:documentation>Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
2)register xml schema:
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaurl=>'http://rac3-1-vip:8080/home/'||USER||'/xsd/EHIPProfile_v00.xsd',
5 schemadoc=>xdbURIType('/home/'||USER||'/xsd/EHIPProfile_v00.xsd').getClob(),
6 local=>True,
7 gentypes=>True,
8 genbean=>False,
9 gentables=>False
10 );
11 End;
12 /
PL/SQL procedure successfully completed.
SQL>
SQL>
3) xml data:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<Profile xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1">
<ProfileID Type="EnricherParametersProfile" Status="ACTIVE" ID="EnricherPP.ID.0001" Name="EnricherPP.ID.0001" Description="EnricherPP.ID.0001" Version="01"/>
<ProfileData>
<EnricherParametersProfileData>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.ExceptionCreators:createExceptionV50CategoryCanonicalPart" interactionID="">
<Enricher>
<Parameters>
<Parameter name="MESSAGE_ID" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="RESPONSE_TYPE">
<Value field="value" value="I"/>
</Section>
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="HL7V3"/>
</Section>
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<Section path="SENDING_NETWORK_ADDRESS">
<Value field="value" value=""/>
</Section>
<Section path="SENDING_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_APPLICATION_NAME">
<Value field="value" value="NL HIAL"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectCreators:createFindClientsAssociatedIdentifersRequestObject" interactionID="PRPA_IN101105CA">
<Enricher>
<Parameters>
<Parameter name="MESSAGE_ID" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="RESPONSE_TYPE">
<Value field="value" value="I"/>
</Section>
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="HL7V3"/>
</Section>
<Section path="PROCESSING_CODE">
<Value field="value" value="T"/>
</Section>
<!--
<Section path="PROCESSING_MODE_CODE">
<Value field="value" value="T"/>
</Section>
-->
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<Section path="RECEIVER_NETWORK_ADDRESS">
<Value field="value" value="prsunew.moh.hnet.bc.ca"/>
</Section>
<Section path="RECEIVER_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.40.5.1"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_NETWORK_ADDRESS">
<Value field="value" value=""/>
</Section>
<Section path="SENDING_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_APPLICATION_NAME">
<Value field="value" value="NL HIAL"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectContentEnrichers:enrichPRRequest" interactionID="">
<!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<Enricher>
<Parameters>
<Parameter name="MESSAGE_IDENTIFIER" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="V3PR2"/>
</Section>
<!--POS/CPP populated ?-->
<!--Not sure if this should be set as a variance within EHIP or if we expect the POS/CPP to provide this value-->
<Section path="PROCESSING_CODE">
<Value field="value" value="T"/>
</Section>
<!--POS/CPP populated ?-->
<Section path="PROCESSING_MODE_CODE">
<Value field="value" value="T"/>
</Section>
<!--POS/CPP populated ?-->
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<!-- note:We Expect PRS to give us a web service address -->
<!--<Section path="RECEIVER_NETWORK_ADDRESS">
<Value field="value" value="_http://PRSServer/svcName"/>
</Section>
-->
<Section path="RECEIVER_APPLICATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.3.40.1.14"/>
<Value field="extension" value="SIT1"/>
</Section>
<!-- note: values of the fields to be provided by PRS -->
<Section path="RECEIVER_APPLICATION_NAME[0]">
<Value field="value" value="receiverAppName"/>
</Section>
<!-- note: RECEIVER_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
<!-- note: values of the fields to be specified by PRS later -->
<Section path="RECEIVER_AGENT/RECEIVER_ORGANIZATION/RECEIVER_ORGANIZATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.3.40.4.1"/>
<Value field="extension" value="receiverOrgId"/>
</Section>
<Section path="SENDING_APPLICATION_NAME[0]">
<Value field="value" value="NLPRSCLNT"/>
</Section>
<!-- note: SENDING_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
<!-- note: values of the fields to be specified by PRS later -->
<Section path="SENDING_AGENT/SENDING_ORGANIZATION/SENDING_ORGANIZATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.4.3.57"/>
<Value field="extension" value="3001"/>
</Section>
<Section path="PERFORMER/HEALTHCARE_WORKER_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.4.3.57"/>
<Value field="extension" value="HIAL_USR"/>
</Section>
</Section>
<Section path="PAYLOAD">
<!--<Section path="QUERY_STATUS_CODE">
<Value field="value" value="New"/>
</Section>-->
<!-- note: AUDIT has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="AUDIT[0]/AUDIT_INFORMATION">
<Value field="code" value="LATEST"/>
<Value field="codeSystem" value="PRSAuditParameters"/>
</Section>
<!-- note: CONFIDENCE has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="CONFIDENCE/CONFIDENCE_VALUE">
<Value field="value" value="100"/>
</Section>
<!-- note: HISTORY has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="HISTORY/INCLUDE_HISTORY_INDICATOR">
<Value field="value" value="false"/>
</Section>
<!-- note: JURISDICTION has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="JURISDICTION/JURISDICTION_TYPE">
<Value field="value" value="NL"/>
</Section>
<!-- note: RESPONSE_OBJECT has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[0]">
<Value field="code" value="GRS_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[1]">
<Value field="code" value="GRS_ELECTRONIC_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[2]">
<Value field="code" value="GRS_IDENTIFIER"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[3]">
<Value field="code" value="GRS_ORGANIZATION_NAME"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[4]">
<Value field="code" value="GRS_PERSONAL_NAME"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[5]">
<Value field="code" value="GRS_REGISTRY_IDENTIFIER"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[6]">
<Value field="code" value="GRS_TELEPHONE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[7]">
<Value field="code" value="PRS_CONDITION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[8]">
<Value field="code" value="PRS_CONFIDENTIALITY_INDICATOR"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[9]">
<Value field="code" value="PRS_DEMOGRAPHIC_DETAIL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[10]">
<Value field="code" value="PRS_DISCIPLINARY_ACTION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[11]">
<Value field="code" value="PRS_INFORMATION_ROUTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[12]">
<Value field="code" value="PRS_NOTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[13]">
<Value field="code" value="PRS_PROVIDER_CREDENTIAL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[14]">
<Value field="code" value="PRS_PROVIDER_EXPERTISE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[15]">
<Value field="code" value="PRS_PROVIDER_RELATIONSHIP"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[16]">
<Value field="code" value="PRS_STATUS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[17]">
<Value field="code" value="PRS_WORK_LOCATION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[18]">
<Value field="code" value="PRS_WORK_LOCATION_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[19]">
<Value field="code" value="PRS_WORK_LOCATION_DETAIL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[20]">
<Value field="code" value="PRS_WORK_LOCATION_ELECTRONIC_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[21]">
<Value field="code" value="PRS_WORK_LOCATION_INFORMATION_ROUTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[22]">
<Value field="code" value="PRS_WORK_LOCATION_TELEPHONE"/>
</Section>
<!-- note: ROLE_CLASS has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="ROLE_CLASS /ROLE_CLASS_VALUE">
<Value field="value" value="LIC"/>
</Section>
<Section path="SORT_CONTROL[0]/SORT_CONTROL_ELEMENT_NAME">
<Value field="code" value="PrincipalPerson.name.value.family"/>
</Section>
<Section path="SORT_CONTROL[0]/SORT_CONTROL_DIRECTION_CODE">
<Value field="value" value="A"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
</EnricherParametersProfileData>
</ProfileData>
</Profile>
the data is valid against the schema through XML Spy tool... and loaded into the XDB repository...
4) create table and insert data:
SQL> CREATE TABLE EHIP_PROFILE OF SYS.XMLTYPE
2 XMLSCHEMA "http://rac3-1-vip:8080/home/EHIPSBUSER1/xsd/EHIPProfile_v00.xsd" ELEMENT "Profile"
3 ;
Table created.
SQL>
SQL> alter table EHIP_PROFILE
2 add CONSTRAINT EHIP_PROF_PK PRIMARY KEY(XMLDATA."ProfileID"."ID",XMLDATA."ProfileID"."Type");
Table altered.
SQL>
SQL>
SQL>
SQL>
SQL> select xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob() from dual;
XDBURITYPE('/HOME/'||USER||'/PROFILEDATA/ENRICHERPP.ID.0001.XML').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy
SQL>
SQL>
SQL> insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()));
insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()))
ERROR at line 1:
ORA-21700: object does not exist or is marked for delete
what's the problem caused the "ORA-21700: object does not exist or is marked for delete" error?
Thanks in advance for your help?Thanks Marco,
Here're my environment:
SQL> select INSTANCE_NUMBER, INSTANCE_NAME,HOST_NAME,VERSION from v$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION
2 rac32 RAC3-2 10.2.0.3.0
I followed your suggested in the above, and always purge recyclebin, but still got the same problem. because in 10gr2, there's no dbms_xmlschema.purge_schema available,
and I did checked the recyclebin after force the delete of schema, nothing inside. any other recommendation? -
Problem inserting and querying XML data with a recursive XML schema
Hello,
I'm facing a problem with querying XML data that is valid against a recursive XML Schema. I have got a table category that stores data as binary XML using Oracle 11g Rel 2 on Windows XP. The XML Schema is the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="bold_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="keyword_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
<xs:element name="plain_text" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="emph_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="text_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="parlist_type">
<xs:sequence>
<xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="listitem_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="parlist" type="parlist_type"/>
<xs:element name="text" type="text_type"/>
</xs:choice>
</xs:complexType>
<xs:element name="category">
<xs:complexType>
<xs:sequence>
<xs:element name="name"/>
<xs:element name="description">
<xs:complexType>
<xs:choice>
<xs:element name="text" type="text_type"/>
<xs:element name="parlist" type="parlist_type"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id"/>
</xs:complexType>
</xs:element>
</xs:schema>I registered this schema and created the category table. Then I inserted a new row using the code below:
insert into category_a values
(XMlElement("category",
xmlattributes('categoryAAA' as "id"),
xmlforest ('ma categ' as "name"),
(xmlelement("description", (xmlelement("text", 'find doors blest now whiles favours carriage tailor spacious senses defect threat ope willow please exeunt truest assembly <keyword> staring travels <bold> balthasar parts attach </bold> enshelter two <emph> inconsiderate ways preventions </emph> preventions clasps better affections comes perish </keyword> lucretia permit street full meddle yond general nature whipp <emph> lowness </emph> grievous pedro')))
The row is successfully inserted as witnessed by the results of row counting. However, I cannot extract data from the table. First, I tried using SqlPlus* which hangs up and quits after a while. I then tried to use SQL Developer, but haven't got any result. Here follow some examples of queries and their results in SQL Developer:
Query 1
select * from category
Result : the whole row is returned
Query 2
select xmlquery('$p/category/description' passing object_value as "p" returning content) from category
Result: "SYS.XMLTYPE"
now I tried to fully respect the nested structure of description element in order to extract the text portion of <bold> using this query
Query 3
select xmlquery('$p/category/description/text/keyword/bold/text()' passing object_value as "p" returning content) from category_a
Result: null
and also tried to extract the text portion of element <text> using this query
Query 4
select xmlquery('$p/category/description/text/text()' passing object_value as "p" returning content) from category_a
Result: "SYS.XMLTYPE".
On the other hand, I noticed, from the result of query 1, that the opening tags of elements keyword and bold are encoded as the less than operator "<". This explains why query 3 returns NULL. However, query 4 should display the text content of <text>, which is not the case.
My questions are about
1. How to properly insert the XML data while preserving the tags (especially the opening tag).
2. How to display the data (the text portion of the main Element or of the nested elements).
The problem about question 1 is that it is quite unfeasible to write a unique insert statement because the structure of <description> is recursive. In other words, if the structure of <description> was not recursive, it would be possible to embed the elements using the xmlelement function during the insertion.
In fact, I need to insert the content of <description> from a source table (called category_a) into a target table (+category_b+) automatically .
I filled category_a using the Saxloader utility from an flat XML file that I have generated from a benchmark. The content of <description> is different from one row to another but it is always valid with regards to the XML Schema. The data is properly inserted as witnessed by the "select * from category_a" instruction (500 row inserted). Besides, the opening tags of the nested elements under <description> are preserved (no "<"). Then I wrote a PL/SQL procedure in which a cursor extracts the category id and category name into varchar2 variables and description into an XMLtype variable from category_a. When I try to insert the values into a category_b, I get the follwing error:
LSX-00213: only 0 occurrences of particle "text", minimum is 1which tells that the <text> element is absent (actually it is present in the source table).
So, my third question is why are not the tags recognized during the insertion?
Can anyone help please?Hello,
indded, I was using an old version of Sqlplus* (8.0.60.0.0) because I had a previous installation (oracle 10g XE). Instead, I used the Sqlplus* shipped with the 11g2database (version 11.2.0.1.0). All the queries that I wrote work fine and display the data correctly.
I also used the XMLSERIALIZE function and can now display the description content in SQL Developer.
Thank you very much.
To answer your question Marco, I registered the XML Schema using the following code
declare
doc varchar2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="bold_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="keyword_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
<xs:element name="plain_text" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="emph_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="text_type" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="bold" type="bold_type"/>
<xs:element name="keyword" type="keyword_type"/>
<xs:element name="emph" type="emph_type"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="parlist_type">
<xs:sequence>
<xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="listitem_type">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="parlist" type="parlist_type"/>
<xs:element name="text" type="text_type"/>
</xs:choice>
</xs:complexType>
<xs:element name="category">
<xs:complexType>
<xs:sequence>
<xs:element name="name"/>
<xs:element name="description">
<xs:complexType>
<xs:choice>
<xs:element name="text" type="text_type"/>
<xs:element name="parlist" type="parlist_type"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id"/>
</xs:complexType>
</xs:element>
</xs:schema>';
begin
dbms_xmlschema.registerSchema('/xmldb/category_auction.xsd', doc, LOCAL => FALSE,
GENTYPES => FALSE, GENBEAN => FALSE, GENTABLES => FALSE,
FORCE => FALSE,
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
OWNER => USER);
end;then, I created the Category table as follows:
CREATE TABLE category_a of XMLType XMLTYPE store AS BINARY XML
XMLSCHEMA "xmldb/category_auction.xsd" ELEMENT "category";Now, there still remains a problem of how to insert the "description" content which I serialized as a CLOB data into another table as XML. To this purpose, I wrote a view over the Category_a table as follows:
CREATE OR REPLACE FORCE VIEW "AUCTION_XWH"."CATEGORY_V" ("CATEGORY_ID", "CNAME", "DESCRIPTION") AS
select category_v."CATEGORY_ID",category_v."CNAME",
XMLSerialize(content ( xmlquery('$p/category/description/*' passing object_value as "p" returning content)) as clob) as "DESCRIPTION"
from auction.category_a p,
xmltable ('$a/category' passing p.Object_Value as "a"
columns category_id varchar2(15) path '@id',
cname varchar2(20) path 'name') category_v;Then, I wrote a procedure to insert data into the Category_xwh table (the source and target tables are slightly different: the common elements are just copied wereas new elements are created in the target table). The code of the procedure is the following:
create or replace PROCEDURE I_CATEGORY AS
v_cname VARCHAR2(30);
v_description clob ;
v_category_id VARCHAR2(15);
cursor mycursor is select category_id, cname, description from category_v;
BEGIN
open mycursor;
loop
/*retrieving the columns*/
fetch mycursor into v_category_id, v_cname, v_description ;
exit when mycursor%notfound;
insert into category_xwh values
(XMlElement("category",
xmlattributes(v_category_id as "category_id"),
xmlelement("Hierarchies", xmlelement("ObjHierarchy", xmlelement ("H_Cat"),
xmlelement ("Rollsup",
(xmlelement("all_categories",
xmlattributes('allcategories' as "all_category_id")))
xmlforest (
v_cname as "cat_name",
v_description as "description")
end loop;
commit;
close mycursor;
END I_CATEGORY;When I execute the procedure, I get the following error:
LSX-00201: contents of "description" should be elements onlyso, I just wonder if this is because v_description is considered as plain text and not as XML text, even if its content is XML. Do I need to use a special function to cast the CLOB as XML?
Thanks for your help.
Doulkifli -
Specifying nested element with two different XML Schema
Hello,
I am trying to convert one xml file to another file. I figure data services would be great for this.
My problem relates to how to have a source xml file with a certain xml schema be transformed to one of a different xml schema. I cannot build the nested elements of the target schema.
From the source xml I only need four fields. But they need to be nested three levels in the target xml.
Source
<DRUG_PRODUCT_LST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DRUG_ITEM>
<DRUG_PRODUCT_ID>113083</DRUG_PRODUCT_ID>
<DIN_PDIN>2317559</DIN_PDIN>
<HC_BRAND_NAME>PMS-SILDENAFIL</HC_BRAND_NAME>
<HC_ATC_CODE>G04BE03</HC_ATC_CODE>
</DRUG_ITEM>
<DRUG_PRODUCT_LST
Target
<?xml version="1.0" encoding="ISO-8859-1"?>
<CODES>
<CODE_TYPES>
<CODE_TYPE>
<COD_CODE>113083</COD_CODE>
<COD_DESCR>PMS-SILDENAFIL</COD_DESCR>
<COD_SOURCE>G04BE03</COD_SOURCE>
<COD_NPSA>2317559</COD_NPSA>
</CODE_TYPE>
</CODE_TYPES>
</CODES>
I have tried using an xml pipline to unnest the source, then use a query transform to re-nest for the target. But I do not know how to specify the input schemas.Hello,
I am trying to convert one xml file to another file. I figure data services would be great for this.
My problem relates to how to have a source xml file with a certain xml schema be transformed to one of a different xml schema. I cannot build the nested elements of the target schema.
From the source xml I only need four fields. But they need to be nested three levels in the target xml.
Source
<DRUG_PRODUCT_LST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DRUG_ITEM>
<DRUG_PRODUCT_ID>113083</DRUG_PRODUCT_ID>
<DIN_PDIN>2317559</DIN_PDIN>
<HC_BRAND_NAME>PMS-SILDENAFIL</HC_BRAND_NAME>
<HC_ATC_CODE>G04BE03</HC_ATC_CODE>
</DRUG_ITEM>
<DRUG_PRODUCT_LST
Target
<?xml version="1.0" encoding="ISO-8859-1"?>
<CODES>
<CODE_TYPES>
<CODE_TYPE>
<COD_CODE>113083</COD_CODE>
<COD_DESCR>PMS-SILDENAFIL</COD_DESCR>
<COD_SOURCE>G04BE03</COD_SOURCE>
<COD_NPSA>2317559</COD_NPSA>
</CODE_TYPE>
</CODE_TYPES>
</CODES>
I have tried using an xml pipline to unnest the source, then use a query transform to re-nest for the target. But I do not know how to specify the input schemas. -
Insert XHTML elements inside XML schema
Hi,
My oracle version is 10.2.0.2.0. Following this suggest :
http://forums.oracle.com/forums/thread.jspa?messageID=835251󋺳
I tried to create a schema in this way:
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
targetNamespace="http://test.example.it/test"
xmlns="http://test.example.it/test"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<!-- definition of main element -->
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="AnnoBando" type="xs:string" xdb:SQLType="CLOB"/>
<xs:element name="AnnoBando2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>In this schema only element "AnnoBando" contains XHTML elements, my question is, when I upload my xml document, can I pass directly XHTML elements in this way?
insert into TESTSQLTYPE values ('codice', xmltype('
<Project
xmlns = "http://test.example.it/test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xsi:schemaLocation = "http://test.example.it/test http://test.example.it/test2.xsd">
<AnnoBando> text <b>bolded text</b> text</AnnoBando>
<AnnoBando2>empty text</AnnoBando2>
</Project>
'))or I should insert html entities of "<" and ">" of the element?
If i try to insert the xml example specified here I get this error:
ORA-31187: Cannot Add Node 'b' (type='element') to Simple Type Node '/Project/Annobando'Thanks for your help.
StefanoTry these two:
1.
======
<AnnoBando>![CDATA[text <b>bolded text</b> text]]</AnnoBando>
=======
2.
======
<AnnoBando> text &lt;b&gt;bolded text&lt;/b&gt; text</AnnoBando>
=======<p>
Basically, because '<' and '>' are used for element declarations in XML, you cannot include them 'nude' in the element content. The above are two methods of escaping those characters.
<p>
Leigh. -
Hi, i have got another problem with livecycle designer scripting.
I have got script line which is defining of string variable:
var aaa = "this is my string";
and i have got embed XML schema like this (it`s only short part of whole file):
... xs:element name="bbb" type="xs:string"/ ...
After saving data to XML i would like to get "this is my string" as a value of my "bbb" XML element.
To save this data i`m using submit button which is connect with submit.php file on my server.
How to connect script created variable and embed XML schema element which is present on my "Data View" tab.
Please help me a bit becouse i don`t know even where to search answer of it...
Of course i know possibilities to create fake unvisible text field object and bind it with 'bbb' and than put "this.rawValue = aaa" to connect those two variables but i think that is not a good idea to solve it in that way. It`s too primitivei solve it, i should write this:
xfa.datasets.data.bbb.value = aaa;
Maybe you are looking for
-
Does Conditional Formatting does not work in HTML report editor - BO 4.1
Hi I have just upgraded to BO 4.1 from BOXI 3.1 I see conditional formatting option is grayed out for me in BO 4.1 I dont have java installed and running launchad on HTML (Preference ->WEBI-> Modify Report -> HTML ) Is there any relation between Appl
-
Conversion of External material with Internal using search help
Hi, We are working on ECC 6.0 for automotive company and have following scenario. One OE (External/Customer) material number (MARA-BISMT) with more than one internal material number (MARA-MATNR). This has been done because same customer material is s
-
OS X Air Crash (Keychain Related)
Hi Guys, On an Air desktop application we've got we are seeing some odd crashes on OS X, specifically Mavericks. Multiple customers are seeing it and we weren't recording the crashes in our Scout Telemetry, it seemed to crash outside of Air's remit.
-
Hi, I have a scenario which is to be mapped in SAP, please guide me how to map. Scenario : Whenever I create a PO, i will create it for a set of materials. Example if I am ordering material A then I will have to order B,C,D,E. I dont want to enter al
-
Users for the j2ee application
hi friends, i want to create the users for J2EE applications. can i create the users only for j2ee engine ? how can i create these users? if i want to implement the sap is it necessary to buy the licence for j2ee users? thanks®ards, srinivas.