Genearte XML based on registered XML schema
Hi all!!
How would I generate an XML document from XML-DB which conform to a registered
Schema? My tables and xsd are as follows:
Customer table
==============
create table cust
( id number primary key,
last_name varchar2(50),
first_name varchar2(50),
fullname varchar2(50),
dob date
Cust_address table
==================
create table cust_address
(addr_id number primary key,
address_1 varchar2(100),
address_2 varchar2(100),
county varchar2(4),
home_ph varchar2(20),
office_ph varchar2(20),
cust_id number references cust(id) );
Some data
SQL> insert into cust
2 values( 1, 'Harvey','John','Jeff M Harvey','18-jun-80');
1 row created.
insert into cust_address
values ( 1,' 21 West Trophy Road','Memphis,
TN','0009','901-6782345','901-768234',1);
My XMLSchema is as follows:
===========================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns="
http://www.oaws.org/CAR"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://www.oaws.org/CAR"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="CARData">
<xs:annotation>
<xs:documentation>Customer Contact information etc
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="NameType"/>
<xs:element name="Address" type="AddressType"/>
<xs:element name="PlayerContact">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="NameType"/>
<xs:element name="Address" type="AddressType"/>
<xs:element name="PlayCntySher" type="xs:string"/>
<xs:element name="PlayCntyClk" type="xs:string"/>
<xs:element name="PlayAlsTyp" type="xs:string"/>
<xs:element name="Play" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="BankContact">
<xs:complexType>
<xs:sequence>
<xs:element name="BKName" type="xs:string"/>
<xs:element name="BKAddr1" type="xs:string"/>
<xs:element name="BKAddr2" type="xs:string"/>
<xs:element name="BKAddrfnl" type="xs:string"/>
<xs:element name="BKCNTY" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="LTRDT" type="xs:date"/>
</xs:complexType>
</xs:element>
<xs:complexType name="AddressType">
<xs:sequence>
<xs:element name="playaddr1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="playaddr2">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="playaddrfnl" type="xs:string"/>
<xs:element name="playhomecomm">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="playwrkcomm">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="playcnty">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="25"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NameType">
<xs:sequence>
<xs:element name="PlayFullName" type="xs:string"/>
<xs:element name="PlayFName" type="xs:string"/>
<xs:element name="PlayLName" type="xs:string"/>
<xs:element name="PlayDefName" type="xs:string"/>
<xs:element name="PlayIDNum">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="12"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PlayDob" type="xs:date"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="money">
<xs:restriction base="xs:decimal">
<xs:totalDigits value="14"/>
<xs:fractionDigits value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CollectorType">
<xs:sequence>
<xs:element name="CollectorNumber" type="xs:integer"/>
<xs:element name="CarFullName" type="xs:string"/>
<xs:element name="CollectorPhone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
I have registered this schema in to my database schema
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 '
http://tien.oaws.silver:8080/home/CAR/xsd/',
5 xdbURIType('/home/CAR/xsd/CARSchema.xsd').getClob(),
6 True,True,False,True
7 );
8 End;
9 /
PL/SQL procedure successfully completed.
Now I need to generate an XML which include all elements from CUST and
CUST_ADDRESS table and must conform to the XML Schema, need your help.
Thank you.
Does the following help at all..
SQL> call dbms_xmlschema.deleteSchema('http://tien.oaws.silver:8080/home/CAR/xsd/CARData.xsd',4)
2 /
Call completed.
SQL> drop table cust_address
2 /
Table dropped.
SQL> drop table cust
2 /
Table dropped.
SQL> create table cust
2 (
3 id number primary key,
4 last_name varchar2(50),
5 first_name varchar2(50),
6 fullname varchar2(50),
7 dob date
8 )
9 /
Table created.
SQL> create table cust_address
2 (
3 addr_id number primary key,
4 address_1 varchar2(100),
5 address_2 varchar2(100),
6 county varchar2(4),
7 home_ph varchar2(20),
8 office_ph varchar2(20),
9 cust_id number references cust(id)
10 )
11 /
Table created.
SQL> insert into cust
2 values( 1, 'Harvey','John','Jeff M Harvey','18-jun-80')
3 /
1 row created.
SQL> insert into cust_address
2 values ( 1,' 21 West Trophy Road','Memphis, TN','0009','901-6782345','901-768234',1)
3 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> declare
2 xmlSchema xmltype := xmltype(
3 '<xs:schema xmlns="http://www.oaws.org/CAR" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.oaws.org/C
ntFormDefault="qualified" attributeFormDefault="unqualified">
4 <xs:element name="CARData">
5 <xs:annotation>
6 <xs:documentation>Customer Contact information etc </xs:documentation>
7 </xs:annotation>
8 <xs:complexType>
9 <xs:sequence>
10 <xs:element name="Name" type="NameType"/>
11 <xs:element name="Address" type="AddressType"/>
12 <xs:element name="PlayerContact">
13 <xs:complexType>
14 <xs:sequence>
15 <xs:element name="Name" type="NameType"/>
16 <xs:element name="Address" type="AddressType"/>
17 <xs:element name="PlayCntySher" type="xs:string"/>
18 <xs:element name="PlayCntyClk" type="xs:string"/>
19 <xs:element name="PlayAlsTyp" type="xs:string"/>
20 <xs:element name="Play" type="xs:string"/>
21 </xs:sequence>
22 </xs:complexType>
23 </xs:element>
24 <xs:element name="BankContact">
25 <xs:complexType>
26 <xs:sequence>
27 <xs:element name="BKName" type="xs:string"/>
28 <xs:element name="BKAddr1" type="xs:string"/>
29 <xs:element name="BKAddr2" type="xs:string"/>
30 <xs:element name="BKAddrfnl" type="xs:string"/>
31 <xs:element name="BKCNTY" type="xs:string"/>
32 </xs:sequence>
33 </xs:complexType>
34 </xs:element>
35 </xs:sequence>
36 <xs:attribute name="LTRDT" type="xs:date"/>
37 </xs:complexType>
38 </xs:element>
39 <xs:complexType name="AddressType">
40 <xs:sequence>
41 <xs:element name="playaddr1">
42 <xs:simpleType>
43 <xs:restriction base="xs:string">
44 <xs:length value="100"/>
45 </xs:restriction>
46 </xs:simpleType>
47 </xs:element>
48 <xs:element name="playaddr2">
49 <xs:simpleType>
50 <xs:restriction base="xs:string">
51 <xs:length value="100"/>
52 </xs:restriction>
53 </xs:simpleType>
54 </xs:element>
55 <xs:element name="playaddrfnl" type="xs:string"/>
56 <xs:element name="playhomecomm">
57 <xs:simpleType>
58 <xs:restriction base="xs:string">
59 <xs:length value="100"/>
60 </xs:restriction>
61 </xs:simpleType>
62 </xs:element>
63 <xs:element name="playwrkcomm">
64 <xs:simpleType>
65 <xs:restriction base="xs:string">
66 <xs:length value="100"/>
67 </xs:restriction>
68 </xs:simpleType>
69 </xs:element>
70 <xs:element name="playcnty">
71 <xs:simpleType>
72 <xs:restriction base="xs:string">
73 <xs:length value="25"/>
74 </xs:restriction>
75 </xs:simpleType>
76 </xs:element>
77 </xs:sequence>
78 </xs:complexType>
79 <xs:complexType name="NameType">
80 <xs:sequence>
81 <xs:element name="PlayFullName" type="xs:string"/>
82 <xs:element name="PlayFName" type="xs:string"/>
83 <xs:element name="PlayLName" type="xs:string"/>
84 <xs:element name="PlayDefName" type="xs:string"/>
85 <xs:element name="PlayIDNum">
86 <xs:simpleType>
87 <xs:restriction base="xs:string">
88 <xs:length value="12"/>
89 </xs:restriction>
90 </xs:simpleType>
91 </xs:element>
92 <xs:element name="PlayDob" type="xs:date"/>
93 </xs:sequence>
94 </xs:complexType>
95 <xs:simpleType name="money">
96 <xs:restriction base="xs:decimal">
97 <xs:totalDigits value="14"/>
98 <xs:fractionDigits value="2"/>
99 </xs:restriction>
100 </xs:simpleType>
101 <xs:complexType name="CollectorType">
102 <xs:sequence>
103 <xs:element name="CollectorNumber" type="xs:integer"/>
104 <xs:element name="CarFullName" type="xs:string"/>
105 <xs:element name="CollectorPhone" type="xs:string"/>
106 </xs:sequence>
107 </xs:complexType>
108 </xs:schema>');
109 begin
110 dbms_xmlschema.registerSchema
111 (
112 'http://tien.oaws.silver:8080/home/CAR/xsd/CARData.xsd',
113 xmlSchema,
114 True,True,False,True
115 );
116 end;
117 /
PL/SQL procedure successfully completed.
SQL> set long 100000 pages 0
SQL> --
SQL> select xmlelement
2 (
3 "CARData",
4 xmlAttributes
5 (
6 'http://www.oaws.org/CAR' as "xmlns",
7 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
8 'http://www.oaws.org/CAR http://tien.oaws.silver:8080/home/CAR/xsd/CARData.xsd' as "xsi:schemaLocation",
9 '' as "LTRDT"
10 ),
11 xmlElement
12 (
13 "Name",
14 xmlElement("PlayFullName",fullname ),
15 xmlElement("PlayFName",first_name),
16 xmlElement("PlayLName",last_name),
17 xmlElement("PlayDefName",null),
18 xmlElement("PlayIDNum",id),
19 xmlElement("PlayDob",dob)
20 ),
21 xmlElement
22 (
23 "Address",
24 xmlElement("playaddr1",address_1 ),
25 xmlElement("playaddr2",address_2),
26 xmlElement("playaddrfnl",null),
27 xmlElement("playhomecomm",home_ph),
28 xmlElement("playwrkcomm",office_ph),
29 xmlElement("playcnty",county)
30 )
31 ).extract('/*')
32 from cust, cust_address
33 where id = cust_id
34 /
<CARData xmlns="http://www.oaws.org/CAR" xmlns:xsi="http://www.w3.org/2001/XMLSc
hema-instance" xsi:schemaLocation="http://www.oaws.org/CAR http://tien.oaws.silv
er:8080/home/CAR/xsd/CARData.xsd">
<Name>
<PlayFullName>Jeff M Harvey</PlayFullName>
<PlayFName>John</PlayFName>
<PlayLName>Harvey</PlayLName>
<PlayDefName/>
<PlayIDNum>1</PlayIDNum>
<PlayDob>1980-06-18</PlayDob>
</Name>
<Address>
<playaddr1> 21 West Trophy Road</playaddr1>
<playaddr2>Memphis, TN</playaddr2>
<playaddrfnl/>
<playhomecomm>901-6782345</playhomecomm>
<playwrkcomm>901-768234</playwrkcomm>
<playcnty>0009</playcnty>
</Address>
</CARData>
SQL>
Similar Messages
-
XMLType column based on XML Schema: several questions
Hi,
I've a table on an oracle db version 10.1.0.4 where I stage the xml files containing orders created on a third party's system using BizTalk.
Although the storage I opted for is based on an XML Schema, defined by this third-party, I am facing big perfomance issues with files bigger than a few hundreds of kBs.
For instance, a 32Mb file takes more than 2 hours to be processed.
Now, after reading other threads in this forum and the documentation, my understanding of the problem is that the whole issue is with the correct indexing of the nested tables.
Here is my current XML Schema definition:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:include schemaLocation="private/Types.xsd"/>
<xs:element name="PickData">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ProdRun">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="xs:int"/>
<xs:element name="Date" type="string8"/>
<xs:element name="Final" type="xs:int"/>
<xs:element name="PickWave" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="string10"/>
<xs:element name="ProdLine" type="string2"/>
<xs:element name="TourSeq" type="xs:int"/>
<xs:element name="Tour" type="string20"/>
<xs:element name="Customer" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Seq" type="string20"/>
<xs:element name="Cust" type="string10"/>
<xs:element name="Mod" type="string30"/>
<xs:element name="Tod" type="string30"/>
<xs:element name="InvOrder" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="string20"/>
<xs:element name="Item" type="string20"/>
<xs:element name="Qty" type="xs:int"/>
<xs:element name="Priority" type="xs:int"/>
<xs:element name="Reordering" type="xs:int"/>
<xs:element name="DelDate" type="string8"/>
<xs:element name="HlOrder" type="string20"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="InvOrderKey">
<xs:selector xpath="InvOrder"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="CustomerKey">
<xs:selector xpath="Customer"/>
<xs:field xpath="Seq"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="PickWaveKey">
<xs:selector xpath="PickWave"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="ProdRunKey">
<xs:selector xpath="ProdRun"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Here is the included sub-schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="string2">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string5">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string8">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string15">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string30">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string40">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string50">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string250">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="250"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
The statement for creating my table is
CREATE TABLE "XML_ORDERS"
("ID" NUMBER(7,0) NOT NULL ENABLE,
"XMLFILE" "SYS"."XMLTYPE" ,
"INSERTED" DATE DEFAULT sysdate,
CONSTRAINT "XML_ORDERS_PK" PRIMARY KEY ("ID") USING INDEX ENABLE
) XMLTYPE COLUMN XMLFILE STORE AS OBJECT RELATIONAL
XMLSCHEMA "private/PickData.xsd" ELEMENT "PickData"
Here is a simple instance document:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<PickData xsi:noNamespaceSchemaLocation="private/PickData.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ProdRun>
<Nr>5</Nr>
<Date>15112005</Date>
<Final>1</Final>
<PickWave>
<Nr>IPW0000017</Nr>
<ProdLine>01</ProdLine>
<TourSeq>1</TourSeq>
<Tour>00000043_078</Tour>
<Customer>
<Seq>5</Seq>
<Cust>100000006</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000457</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000742</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000459</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000742</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>6</Seq>
<Cust>100000013</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000461</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000743</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000463</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000743</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>2</Seq>
<Cust>100000114</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000465</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000744</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000467</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000744</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>3</Seq>
<Cust>100000140</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000469</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000745</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000471</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000745</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>7</Seq>
<Cust>100000143</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000473</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000746</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000475</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000746</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>8</Seq>
<Cust>100000145</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000477</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000747</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000479</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000747</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>9</Seq>
<Cust>100000146</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000481</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000748</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000483</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000748</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>4</Seq>
<Cust>100000147</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000485</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000750</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000487</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000750</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>10</Seq>
<Cust>100000148</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000489</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000751</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000491</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000751</HlOrder>
</InvOrder>
</Customer>
</PickWave>
</ProdRun>
</PickData>
When I registered the XMLSchema, the following types and tables were automatically created and you can see the hierarchy below:
(by the way, I could not find any xdb_utilities.printNestedTables mentioned elsewhere)
XML_ORDERS
|_PickData381_T
|___ProdRun382_T
|_____PickWave388_COLL
|_______PickWave383_T
|_________Customer387_COLL
|___________Customer384_T
|_____________InvOrder386_COLL
These objects are then used in the following nested tables:
TABLE_NAME TABLE_TYPE_NAME PARENT_TABLE_NAME PARENT_TABLE_COLUMN
SYS_NTaK/5zar5S0WitSsgu6OKPQ== PickWave388_COLL PickData389_TAB "XMLDATA"."ProdRun"."PickWave"
SYS_NTf6QvwVm8SFKz+K/YYWq+WQ== Item408_COLL ProdData409_TAB "XMLDATA"."Item"
SYS_NTtu05ilrRQqmuEN4k+07VDA== Customer402_COLL OutboundParty403_TAB "XMLDATA"."Customer"
SYS_NTK6fhWq5uTJ+vKcgBpNm1Fg== InvOrder386_COLL SYS_NTIIzv7bkXQSSS43igtfi5eg== InvOrder
SYS_NTIIzv7bkXQSSS43igtfi5eg== Customer387_COLL SYS_NTaK/5zar5S0WitSsgu6OKPQ== Customer
I enabled sql tracing and I got the following TKPROF output
INSERT INTO IMP_ORDERS (PICK_INVORDERNR, PICK_ITEM, PICK_QTY, PICK_PRIORITY,
PICK_REORDERING, PICK_HLORDER, PICK_DELDATE, PICK_CUST, PICK_MOD, PICK_TOD,
PICK_SEQ, PICK_PICKWAVENR, PICK_PICKWAVEPRODLINE, PICK_PICKWAVETOUR,
PICK_PICKWAVETOURSEQ, PICK_ORDKEY, PICK_RUNKEY) SELECT INVORDERNR, ITEM,
QTY, PRIORITY, REORDERING, HLORDER, DELDATE, CUST, MOD, TOD, SEQ,
PICKWAVENR, PICKWAVEPRODLINE, PICKWAVETOUR, PICKWAVETOURSEQ, ROWNUM AS
PICK_ORDKEY, PRODRUNID FROM (SELECT /*+ cardinality(g 15)*/
EXTRACTVALUE(VALUE(G), '/InvOrder/Nr') AS INVORDERNR, EXTRACTVALUE(VALUE(G),
'/InvOrder/Item') AS ITEM, EXTRACTVALUE(VALUE(G), '/InvOrder/Qty') AS QTY,
EXTRACTVALUE(VALUE(G), '/InvOrder/Priority') AS PRIORITY,
EXTRACTVALUE(VALUE(G), '/InvOrder/Reordering') AS REORDERING,
EXTRACTVALUE(VALUE(G), '/InvOrder/HlOrder') AS HLORDER,
TO_DATE(EXTRACTVALUE(VALUE(G), '/InvOrder/DelDate'),'DDMMYYYY') AS DELDATE,
F.CUST, F.MOD, F.TOD, F.SEQ, F.PICKWAVENR, F.PICKWAVEPRODLINE,
F.PICKWAVETOUR, F.PICKWAVETOURSEQ, F.PRODRUNNR, F.PRODRUNDATE,
F.PRODRUNFINAL, F.PRODRUNID FROM (SELECT /*+ cardinality(e 60)*/VALUE(E) AS
CUSTOMERNODE, EXTRACTVALUE(VALUE(E), '/Customer/Cust') AS CUST,
EXTRACTVALUE(VALUE(E), '/Customer/Mod') AS MOD, EXTRACTVALUE(VALUE(E),
'/Customer/Tod') AS TOD, TO_NUMBER(EXTRACTVALUE(VALUE(E), '/Customer/Seq'))
AS SEQ, D.PICKWAVENR, D.PICKWAVEPRODLINE, D.PICKWAVETOUR, D.PICKWAVETOURSEQ,
D.PRODRUNNR, D.PRODRUNDATE, D.PRODRUNFINAL, D.PRODRUNID FROM (SELECT /*+
cardinality(c 100)*/VALUE(C) AS PICKWAVENODE, EXTRACTVALUE(VALUE(C),
'/PickWave/Nr') AS PICKWAVENR, TO_NUMBER(EXTRACTVALUE(VALUE(C),
'/PickWave/ProdLine')) AS PICKWAVEPRODLINE, EXTRACTVALUE(VALUE(C),
'/PickWave/Tour') AS PICKWAVETOUR, TO_NUMBER(EXTRACTVALUE(VALUE(C),
'/PickWave/TourSeq')) AS PICKWAVETOURSEQ, A.PRODRUNNR, A.PRODRUNDATE,
A.PRODRUNFINAL, A.PRODRUNID FROM (SELECT /*+ cardinality(b 1)*/VALUE(B) AS
PRODRUNNODE, EXTRACTVALUE(VALUE(B), '/ProdRun/Nr') AS PRODRUNNR,
TO_DATE(EXTRACTVALUE(VALUE(B), '/ProdRun/Date'),'DDMMYYYY') AS PRODRUNDATE,
EXTRACTVALUE(VALUE(B), '/ProdRun/Final') AS PRODRUNFINAL, X.ID PRODRUNID
FROM XML_ORDERS X, TABLE(XMLSEQUENCE(EXTRACT(X.XMLFILE,'/PickData/ProdRun'))
) B WHERE X.ID = :B1 ) A, TABLE(XMLSEQUENCE(EXTRACT(A.PRODRUNNODE,
'/ProdRun/PickWave'))) C ) D, TABLE(XMLSEQUENCE(EXTRACT(D.PICKWAVENODE,
'/PickWave/Customer'))) E ) F, TABLE(XMLSEQUENCE(EXTRACT(F.CUSTOMERNODE,
'/Customer/InvOrder'))) G ORDER BY PICKWAVEPRODLINE, PICKWAVETOURSEQ,
PICKWAVENR, SEQ )
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 4324.09 9994.65 0 57193 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 4324.09 9994.65 0 57193 0 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 68 (recursive depth: 1)
Rows Row Source Operation
0 COUNT (cr=0 pr=0 pw=0 time=180 us)
0 VIEW (cr=0 pr=0 pw=0 time=166 us)
0 SORT ORDER BY (cr=0 pr=0 pw=0 time=152 us)
40866 NESTED LOOPS (cr=54973 pr=0 pw=0 time=31065606 us)
1363 NESTED LOOPS (cr=54937 pr=0 pw=0 time=11037183 us)
1 NESTED LOOPS (cr=54889 pr=0 pw=0 time=10145883 us)
1 NESTED LOOPS (cr=54841 pr=0 pw=0 time=9799012 us)
1 TABLE ACCESS BY INDEX ROWID XML_ORDERS (cr=2 pr=0 pw=0 time=222 us)
1 INDEX UNIQUE SCAN XML_ORDERS_PK (cr=1 pr=0 pw=0 time=126 us)(object id 58551)
1 COLLECTION ITERATOR PICKLER FETCH (cr=54839 pr=0 pw=0 time=9798748 us)
1 COLLECTION ITERATOR PICKLER FETCH (cr=48 pr=0 pw=0 time=346818 us)
1363 COLLECTION ITERATOR PICKLER FETCH (cr=48 pr=0 pw=0 time=870830 us)
40866 COLLECTION ITERATOR PICKLER FETCH (cr=36 pr=0 pw=0 time=18739302 us)
Note that I cancelled this operation before it was over so I imagine that these figures refer to the statistics as of the time when the operation was interrupted.
So, here are finally my questions.
In order to create the constraints on the nested tables as shown in other threads, do I need to drop the existing xml_orders table and ancillary object types and recreate them or is there a way to add such constraints using the existing system generated object names?
Secondly, the xml_orders table may contain severale documents, not just one and his current primary key is the column ID. So, in order to uniquely identify the deepest element in the xml document, I need first to select the relevant document by means of the id column.
Would it be better to create the indexes containing this id column together with the nested_table_id and array_index?
Thanks for you help.
Flavio
PS: I wrote a 10 lines xsl transformation that I passed on to Saxon together with the 32Mb file. It took less than 1 minute to produce a flat file that was loaded almost instantly by SQL*Loader. So, what I am looking for is a procedure loading this stuff in less than 2 minutes or possibly less.Does the following help
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:53 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool registerSchema_&4..log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> declare
2 result boolean;
3 begin
4 result := dbms_xdb.createResource('/home/&1/xsd/&4',
5 bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
6 end;
7 /
old 4: result := dbms_xdb.createResource('/home/&1/xsd/&4',
new 4: result := dbms_xdb.createResource('/home/OTNTEST/xsd/GetaxTypes.xsd',
old 5: bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
new 5: bfilename(USER,'GetaxTypes.xsd'),nls_charset_id('AL32UTF8'));
PL/SQL procedure successfully completed.
SQL> commit
2 /
Commit complete.
SQL> alter session set events='31098 trace name context forever'
2 /
Session altered.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaURL => '&3',
5 schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
6 local => TRUE,
7 genTypes => TRUE,
8 genBean => FALSE,
9 genTables => &5
10 );
11 end;
12 /
old 4: schemaURL => '&3',
new 4: schemaURL => 'private/GetaxTypes.xsd',
old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/GetaxTypes.xsd').getClob(),
old 9: genTables => &5
new 9: genTables => TRUE
PL/SQL procedure successfully completed.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:55 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool registerSchema_&4..log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> declare
2 result boolean;
3 begin
4 result := dbms_xdb.createResource('/home/&1/xsd/&4',
5 bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
6 end;
7 /
old 4: result := dbms_xdb.createResource('/home/&1/xsd/&4',
new 4: result := dbms_xdb.createResource('/home/OTNTEST/xsd/PickData.xsd',
old 5: bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
new 5: bfilename(USER,'PickData.xsd'),nls_charset_id('AL32UTF8'));
PL/SQL procedure successfully completed.
SQL> commit
2 /
Commit complete.
SQL> alter session set events='31098 trace name context forever'
2 /
Session altered.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaURL => '&3',
5 schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
6 local => TRUE,
7 genTypes => TRUE,
8 genBean => FALSE,
9 genTables => &5
10 );
11 end;
12 /
old 4: schemaURL => '&3',
new 4: schemaURL => 'private/PickData.xsd',
old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/PickData.xsd').getClob(),
old 9: genTables => &5
new 9: genTables => TRUE
PL/SQL procedure successfully completed.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:58 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool createTable.log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> CREATE TABLE "XML_ORDERS"
2 ("ID" NUMBER(7,0) NOT NULL ENABLE,
3 "XMLFILE" "SYS"."XMLTYPE" ,
4 "INSERTED" DATE DEFAULT sysdate,
5 CONSTRAINT "XML_ORDERS_PK" PRIMARY KEY ("ID") USING INDEX ENABLE
6 ) XMLTYPE COLUMN XMLFILE STORE AS OBJECT RELATIONAL
7 XMLSCHEMA "private/PickData.xsd"
8 ELEMENT "PickData"
9 VARRAY XMLFILE."XMLDATA"."ProdRun"."PickWave" STORE AS TABLE PickWave_TAB
10 (
11 ( primary key (nested_table_id, array_index)
12 ) organization index overflow
13 VARRAY "Customer" STORE AS TABLE Customer_TAB
14 (
15 (primary key (nested_table_id, array_index)
16 ) organization index overflow
17 VARRAY "InvOrder" STORE AS TABLE InvOrder_TAB
18 (
19 (primary key (nested_table_id, array_index)
20 ) organization index overflow
21 )
22 )
23 )
24 /
Table created.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:59 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool insertFile_&3..log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> --
SQL> insert into XML_ORDERS (ID, XMLFILE) values (&4, xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
2 /
old 1: insert into XML_ORDERS (ID, XMLFILE) values (&4, xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
new 1: insert into XML_ORDERS (ID, XMLFILE) values (10, xmltype(bfilename(USER,'testcase.xml'),nls_charset_id('AL32UT
8')))
1 row created.
Elapsed: 00:00:00.11
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:59 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool testcase.log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> set pages 0 lines 140
SQL> --
SQL> -- Testcase code here
SQL> --
SQL> set autotrace on explain
SQL> --
SQL> create or replace view PROD_RUN_VIEW
2 (
3 PRODRUNNODE,
4 PRODRUNNR,
5 PRODRUNDATE,
6 PRODRUNID,
7 PRODRUNFINAL
8 )
9 as
10 select EXTRACT(XMLFILE,'/PickData/ProdRun'),
11 EXTRACTVALUE(XMLFILE , '/PickData/ProdRun/Nr'),
12 TO_DATE(EXTRACTVALUE(XMLFILE, '/PickData/ProdRun/Date'),'DDMMYYYY'),
13 ID,
14 EXTRACTVALUE(XMLFILE,'/PickData/ProdRun/Final')
15 from XML_ORDERS
16 /
View created.
Elapsed: 00:00:00.09
SQL> create or replace view PICK_WAVE_VIEW
2 (
3 PICKWAVENODE,
4 PICKWAVENR,
5 PICKWAVEPRODLINE,
6 PICKWAVETOUR,
7 PICKWAVETOURSEQ,
8 PRODRUNNR,
9 PRODRUNDATE,
10 PRODRUNID,
11 PRODRUNFINAL
12 )
13 as
14 select value(PW),
15 extractValue(value(PW),'/PickWave/Nr'),
16 TO_NUMBER(EXTRACTVALUE(value(PW),'/PickWave/ProdLine')),
17 extractValue(value(PW),'/PickWave/Tour'),
18 TO_NUMBER(extractValue(value(PW),'/PickWave/TourSeq')),
19 PRODRUNNR,
20 PRODRUNDATE,
21 PRODRUNID,
22 PRODRUNFINAL
23 FROM PROD_RUN_VIEW, table(xmlsequence(extract(PRODRUNNODE,'/ProdRun/PickWave'))) PW
24 /
View created.
Elapsed: 00:00:00.09
SQL> create or replace view CUSTOMER_VIEW
2 (
3 CUSTOMERNODE,
4 CUST,
5 MOD,
6 TOD,
7 SEQ,
8 PICKWAVENR,
9 PICKWAVEPRODLINE,
10 PICKWAVETOUR,
11 PICKWAVETOURSEQ,
12 PRODRUNNR,
13 PRODRUNDATE,
14 PRODRUNFINAL,
15 PRODRUNID
16 )
17 as
18 select value(CUST),
19 EXTRACTVALUE(VALUE(CUST), '/Customer/Cust'),
20 EXTRACTVALUE(VALUE(CUST), '/Customer/Mod'),
21 EXTRACTVALUE(VALUE(CUST), '/Customer/Tod'),
22 TO_NUMBER(EXTRACTVALUE(VALUE(CUST), '/Customer/Seq')),
23 PICKWAVENR,
24 PICKWAVEPRODLINE,
25 PICKWAVETOUR,
26 PICKWAVETOURSEQ,
27 PRODRUNNR,
28 PRODRUNDATE,
29 PRODRUNFINAL,
30 PRODRUNID
31 from PICK_WAVE_VIEW, table(xmlsequence(extract(PICKWAVENODE,'/PickWave/Customer'))) CUST
32 /
View created.
Elapsed: 00:00:00.10
SQL>
SQL> create or replace view INVOICE_ORDER_VIEW
2 (
3 INVORDERNR,
4 ITEM,
5 QTY,
6 PRIORITY,
7 REORDERING,
8 HLORDER,
9 DELDATE,
10 CUST,
11 MOD,
12 TOD,
13 SEQ,
14 PICKWAVENR,
15 PICKWAVEPRODLINE,
16 PICKWAVETOUR,
17 PICKWAVETOURSEQ,
18 PRODRUNNR,
19 PRODRUNDATE,
20 PRODRUNFINAL,
21 PRODRUNID
22 )
23 as
24 SELECT EXTRACTVALUE(VALUE(INV), '/InvOrder/Nr'),
25 EXTRACTVALUE(VALUE(INV), '/InvOrder/Item'),
26 EXTRACTVALUE(VALUE(INV), '/InvOrder/Qty'),
27 EXTRACTVALUE(VALUE(INV), '/InvOrder/Priority'),
28 EXTRACTVALUE(VALUE(INV), '/InvOrder/Reordering'),
29 EXTRACTVALUE(VALUE(INV), '/InvOrder/HlOrder'),
30 TO_DATE(EXTRACTVALUE(VALUE(INV), '/InvOrder/DelDate'),'DDMMYYYY'),
31 CUST,
32 MOD,
33 TOD,
34 SEQ,
35 PICKWAVENR,
36 PICKWAVEPRODLINE,
37 PICKWAVETOUR,
38 PICKWAVETOURSEQ,
39 PRODRUNNR,
40 PRODRUNDATE,
41 PRODRUNFINAL,
42 PRODRUNID
43 FROM CUSTOMER_VIEW, table(xmlsequence(extract(CUSTOMERNODE,'Customer/InvOrder'))) INV
44 /
View created.
Elapsed: 00:00:00.13
SQL> select * from INVOICE_ORDER_VIEW
2 /
IIO0000461 100000036 20 1 0 CSO000743 15-NOV-05 100000013
FO DDU 6 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000463 100000045 20 1 0 CSO000743 15-NOV-05 100000013
FO DDU 6 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000473 100000036 20 1 0 CSO000746 15-NOV-05 100000143
FO DDU 7 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000475 100000045 20 1 0 CSO000746 15-NOV-05 100000143
FO DDU 7 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000469 100000036 20 1 0 CSO000745 15-NOV-05 100000140
FO DDU 3 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000471 100000045 20 1 0 CSO000745 15-NOV-05 100000140
FO DDU 3 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000489 100000036 20 0 0 CSO000751 15-NOV-05 100000148
FO DDU 10 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000491 100000045 20 1 0 CSO000751 15-NOV-05 100000148
FO DDU 10 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000481 100000036 20 0 0 CSO000748 15-NOV-05 100000146
FO DDU 9 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000483 100000045 20 1 0 CSO000748 15-NOV-05 100000146
FO DDU 9 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000485 100000036 20 0 0 CSO000750 15-NOV-05 100000147
FO DDU 4 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000487 100000045 20 1 0 CSO000750 15-NOV-05 100000147
FO DDU 4 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000457 100000036 20 1 0 CSO000742 15-NOV-05 100000006
FO DDU 5 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000459 100000045 20 1 0 CSO000742 15-NOV-05 100000006
FO DDU 5 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000477 100000036 20 1 0 CSO000747 15-NOV-05 100000145
FO DDU 8 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000479 100000045 20 1 0 CSO000747 15-NOV-05 100000145
FO DDU 8 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000465 100000036 20 1 0 CSO000744 15-NOV-05 100000114
FO DDU 2 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000467 100000045 20 1 0 CSO000744 15-NOV-05 100000114
FO DDU 2 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
18 rows selected.
Elapsed: 00:00:00.22
Execution Plan
Plan hash value: 1730223965
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 18 | 10278 | 877 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 18 | 10278 | 877 (0)| 00:00:11 |
| 2 | NESTED LOOPS | | 18 | 8424 | 841 (0)| 00:00:11 |
| 3 | MERGE JOIN CARTESIAN | | 18 | 4680 | 805 (0)| 00:00:10 |
| 4 | TABLE ACCESS FULL | XML_ORDERS | 1 | 67 | 3 (0)| 00:00:01 |
| 5 | BUFFER SORT | | 18 | 3474 | 802 (0)| 00:00:10 |
| 6 | INDEX FAST FULL SCAN| SYS_IOT_TOP_64187 | 18 | 3474 | 802 (0)| 00:00:10 |
|* 7 | INDEX UNIQUE SCAN | SYS_IOT_TOP_64185 | 1 | 208 | 2 (0)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | SYS_C008783 | 1 | | 0 (0)| 00:00:01 |
|* 9 | INDEX UNIQUE SCAN | SYS_IOT_TOP_64183 | 1 | 103 | 2 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | SYS_C008785 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
7 - access("NESTED_TABLE_ID"="CUSTOMER_TAB"."SYS_NC0000800009$")
8 - access("NESTED_TABLE_ID"="CUSTOMER_TAB"."SYS_NC0000800009$")
9 - access("NESTED_TABLE_ID"="PICKWAVE_TAB"."SYS_NC0000800009$")
filter("NESTED_TABLE_ID"="XML_ORDERS"."SYS_NC0001000011$")
10 - access("NESTED_TABLE_ID"="PICKWAVE_TAB"."SYS_NC0000800009$")
Note
- dynamic sampling used for this statement
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
C:\oracle\xdb\otn\347125>You were sequencing the ProdRun node, which is a mistake. Only nodes which occur multiple times should be sequenced... -
Updating registered XML Schema
We're going to use Oracle XML DB (Oracle 9.2.0.5). We will register our XML Schema files to Oracle. In case we later want to update one of the registered schemas I tested updating some example schemas.
I found a thread here in the forum with some steps to update a registered schema we:
forum
>
For each table or column based on the schema
1. Create a table with a column of XMLType which is not based on the
XMLSchema. EG XMLType stored as CLOB
2. Copy the content of the existing table into the CLOB based table.
3. Delete the existing schema
4. REgister the New Schema.
5. Recreate teh tables and columns
6. COpy the data into the new tables using supplied XSL transformation where
necessary
7. Delete tempoarary tables....
I followed the steps and it works.
But there is one thing I want to know:
I have a schema A and a schema B and I want to use definitions of schema B in schema A, using the <import> element. Now I want to update schema B. When i follow the steps above i have to backup all tables/coloumns which contain elements defined in schema B. Then i delete the schema and reregister it. When trying to query data in schema A i get an error message: ORA-04045: errors during recompilation/revalidation. This is even if i reregister the previous schema with annotations.
For now i have to delete schema A too and reregister schema A and B. Is there a way to only update a single schema without affecting the schemas using definitions of this schema?
Imagine i use a library schema with a lot of type definitions and other schemas import this schema because they need to use some of these types, then i have to update/reregister all the schemas. So any suggestions are welcomed.Please check if this helps:
http://www.oracle.com/technology/oramag/oracle/03-jul/o43xml.html -
XML Schema based XMLType column leaves file open on error
Hello,
I have the following situation on both oracle 10.1.0.2.0 and 10.1.0.4.0:
insert into xml_products (xmlfile) values(bfilename(file_loc, char_id));
"xmlfile" is a xmltype column based on a registered xml schema.
When the file fails xml schema validation, the file remains open and I cannot move it until i close the session.
Is this a bug or an "intentional feature"?
Any workarounds?
Thanks,
FlavioAll right Mark,
thanks for your reply.
Meanwhile I fixed the problem and posted my workaround here:
http://oraclequirks.blogspot.com/2005/11/ora-29292-and-xmltype.html
Bye,
Flavio -
Register xml schema and store data
hi
i registered a schema in my DB and want to store data related to that scema.
is there any function which will allow me to create a relational table table from the XML document or we need to extract each and every value from the nodes using funcions like xmlsequence,extract,.....
i read somewhere that we can do this using structured storage of xml using xml db
but not sure if there is any function or just extracting the each value and storing ina apre created table...
can someone help??
Thank YouJust curious but any reason you did not post the URLs for the two schemas since they are publicly available via the URL contained within each one? You could have posted those URLs and then dropped in a snippet of the XML in the forum instead of hosting on an external site.
To post for everyone's knowledge, ifc2x3.xsd imports ex.xsd which contains common definitions for structures used in ifc2x3.xsd. The root node of the XML file is in ex.xsd; however; the schema defined in ex.xsd (which does not import/include ifc2x3.xsd) allows for the structures defined in ifc2x3.xsd to be used. Hence a stripped version of the XML file is
<ex:iso_10303_28 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ex="<removed URN>" xsi:schemaLocation="<removed URN>ex.xsd">
<ex:iso_10303_28_header/>
<uos id="uos_1" xmlns="<removed location>" xsi:schemaLocation="<removed location> IFC2X3.xsd">
<IfcCartesianPoint id="ID1"/>
</uos>
</ex:iso_10303_28>The following is based off what I've read in this forum over time.
Given your root node is defined in ex.xsd, this is what you should reference when creating your column in the table. I believe that since you have both schemas registered, Oracle should be able to find the ifc2x3.xsd when validating the XML.
I've never seen this schema setup before but maybe if you review some of the posts by Marco Gralike or mdrake where they RegisterSchema you may come across a similar example.
Sorry for not being more help but maybe someone else can build upon what I started. -
Hi,
can the XML schema located at a URL (location on internet) be registered
in the database for validation against XML data. (using 9iR2)
If yes , can you pls give example to do this.
currently i am using the dbms_xmlschema.registerSchema() to register
the XML schema (String/doc based) and using functions to validate the XML data while loading.
thanks,
melvinHi Melvin,
You can register the XML Schema located at a URL using 9iR2.
Please find below an example for registering a transaction.xsd Schema located at a URL using XML DB :
DECLARE
doc VARCHAR2(2000) := '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
<xs:element name="TRANSACTION">
<xs:complexType xdb:SQLType="XML_TRANSACTION">
<xs:sequence>
<xs:element name="TR_ID" type="xs:int" nillable="false"/>
<xs:element name="ACC_NO_DEBIT" type="xs:float"/>
<xs:element name="ACC_NO_CREDIT" type="xs:float"/>
<xs:element name="TR_AMOUNT" type="xs:float" default="0" nillable="false"/>
<xs:element name="TR_DATE" type="xs:date"/>
<xs:element name="TR_DESCRIPTION" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>';
BEGIN
dbms_xmlschema.registerSchema('http://otn.oracle.com/transaction.xsd', doc);
END;
Hope it solves your query.
Thanks
Shefali -
Generate + register xml schema
Hi,
I want to generate and register an xml schema based on the following object type :
CREATE TYPE STRAAT_T AS OBJECT
naam varchar2(50),
prv_cd number(1),
arr_cd number(1),
gem_cd number(3)
I ran the following pl/sql code :
begin
dbms_xmlschema.registerSchema(schemaURL=>'http://www.oracle.com/straat.xsd',
schemaDoc=>dbms_xmlschema.generateschema('TEST_RKW','STRAAT_T'));
end;
but got the following error code :
.ORA-31094: Incompatible SQL-type "STRAAT_T" for attribute of element "STRAAT_T".
What is wrong with this ???
tx for any help.Roger
Since the Type already exists you need to pass the value 'FALSE', as the fourth argument to registerSchema().
Eg
CREATE or replace TYPE STRAAT_T AS OBJECT
naam varchar2(50),
prv_cd number(1),
arr_cd number(1),
gem_cd number(3)
begin
dbms_xmlschema.registerSchema('http://www.oracle.com/straat.xsd', dbms_xmlschema.generateschema('SCOTT','STRAAT_T'),TRUE,FALSE);
end;
/ -
ORA-00600 error when registering XML Schema
Dear Mark!
1. Database version: 9.2.0.3.0
2. Operating system: Windows XP Prof
3. XML Schema: (it's too big to be posted_
4. Instance document: no
5. SQL statement used to register the schema
DBMS_XMLSCHEMA.registerSchema(schemaURL => aSchemaURL, schemaDoc => fBFile_Loc);
6. SQL statement that exposes the problem: above
Attempt to register XML Schema caused the following error:
ORA-00600: internal error code, arguments: [qmtsGetAttrElemName1], [], [], [], [], [], [], []
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 131
ORA-06512: at "DVLP.PRIME_BRIDGE", line 91
ORA-06512: at line 6
What does it mean?
Thank you in advance
Artem RodinIf you cannot post the schema please open a itar with oralce support so that the schema can be uploaded.
-
Error when registering XML Schema
When I try to register a schema with XDB I keep getting an ORA-31000 error. It says that the schema it references is not a valid XDB schema, but when I try to register that one it says the first one isn't valid.
Testing with 11g I get
I assume you have registered 'http://www.w3.org/2005/08/addressing/ws-addr.xsd'
SQL> set echo on
SQL> spool testcase.log
SQL> --
SQL> connect sys/ as sysdba
Enter password:
Connected.
SQL> set define on
SQL> set timing on
SQL> --
SQL> define USERNAME = IXSEMF01
SQL> --
SQL> def PASSWORD = IXSEMF01
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user IXSEMF01 cascade
drop user IXSEMF01 cascade
ERROR at line 1:
ORA-01918: user 'IXSEMF01' does not exist
Elapsed: 00:00:00.03
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to IXSEMF01 identified by IXSEMF01
Grant succeeded.
Elapsed: 00:00:00.01
SQL> grant create any directory, drop any directory to &USERNAME
2 /
old 1: grant create any directory, drop any directory to &USERNAME
new 1: grant create any directory, drop any directory to IXSEMF01
Grant succeeded.
Elapsed: 00:00:00.00
SQL> grant alter session, create view to &USERNAME
2 /
old 1: grant alter session, create view to &USERNAME
new 1: grant alter session, create view to IXSEMF01
Grant succeeded.
Elapsed: 00:00:00.00
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user IXSEMF01 default tablespace USERS temporary tablespace TEMP
User altered.
Elapsed: 00:00:00.00
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> alter session set events ='19027 trace name context forever, level 0x800'
2 /
Session altered.
Elapsed: 00:00:00.00
SQL> var schemaURL varchar2(700)
SQL> var schemaURL1 varchar2(700)
SQL> var schemaURL2 varchar2(700)
SQL> var xmlschema CLOB
SQL> --
SQL> begin
2 :schemaURL := 'http://www.w3.org/2005/08/addressing/ws-addr.xsd';
3 :xmlSchema :=
4 '<?xml version="1.0" encoding="utf-8"?>
5 <!--
6 <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd">
7 W3C XML Schema defined in the Web Services Addressing 1.0 specification
8 http://www.w3.org/TR/ws-addr-core
9
10 Copyright c 2005 World Wide Web Consortium,
11
12 (Massachusetts Institute of Technology, European Research Consortium for
13 Informatics and Mathematics, Keio University). All Rights Reserved. This
14 work is distributed under the W3Cr Software License [1] in the hope that
15 it will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
19
20 $Id: ws-addr.xsd,v 1.3 2005/08/09 13:17:35 hugo Exp $
21 -->
22 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.
org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
23
24 <!-- Constructs from the WS-Addressing Core -->
25
26 <xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
27 <xs:complexType name="EndpointReferenceType" mixed="false">
28 <xs:sequence>
29 <xs:element name="Address" type="tns:AttributedURIType"/>
30 <xs:element name="ReferenceParameters" type="tns:ReferenceParametersType" minOccurs="0"/>
31 <xs:element ref="tns:Metadata" minOccurs="0"/>
32 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
33 </xs:sequence>
34 <xs:anyAttribute namespace="##other" processContents="lax"/>
35 </xs:complexType>
36
37 <xs:complexType name="ReferenceParametersType" mixed="false">
38 <xs:sequence>
39 <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
40 </xs:sequence>
41 <xs:anyAttribute namespace="##other" processContents="lax"/>
42 </xs:complexType>
43
44 <xs:element name="Metadata" type="tns:MetadataType"/>
45 <xs:complexType name="MetadataType" mixed="false">
46 <xs:sequence>
47 <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
48 </xs:sequence>
49 <xs:anyAttribute namespace="##other" processContents="lax"/>
50 </xs:complexType>
51
52 <xs:element name="MessageID" type="tns:AttributedURIType"/>
53 <xs:element name="RelatesTo" type="tns:RelatesToType"/>
54 <xs:complexType name="RelatesToType" mixed="false">
55 <xs:simpleContent>
56 <xs:extension base="xs:anyURI">
57 <xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www
.w3.org/2005/08/addressing/reply"/>
58 <xs:anyAttribute namespace="##other" processContents="lax"/>
59 </xs:extension>
60 </xs:simpleContent>
61 </xs:complexType>
62
63 <xs:simpleType name="RelationshipTypeOpenEnum">
64 <xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
65 </xs:simpleType>
66
67 <xs:simpleType name="RelationshipType">
68 <xs:restriction base="xs:anyURI">
69 <xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
70 </xs:restriction>
71 </xs:simpleType>
72
73 <xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
74 <xs:element name="From" type="tns:EndpointReferenceType"/>
75 <xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
76 <xs:element name="To" type="tns:AttributedURIType"/>
77 <xs:element name="Action" type="tns:AttributedURIType"/>
78
79 <xs:complexType name="AttributedURIType" mixed="false">
80 <xs:simpleContent>
81 <xs:extension base="xs:anyURI">
82 <xs:anyAttribute namespace="##other" processContents="lax"/>
83 </xs:extension>
84 </xs:simpleContent>
85 </xs:complexType>
86
87 <!-- Constructs from the WS-Addressing SOAP binding -->
88
89 <xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
90
91 <xs:simpleType name="FaultCodesOpenEnumType">
92 <xs:union memberTypes="tns:FaultCodesType xs:QName"/>
93 </xs:simpleType>
94
95 <xs:simpleType name="FaultCodesType">
96 <xs:restriction base="xs:QName">
97 <xs:enumeration value="tns:InvalidAddressingHeader"/>
98 <xs:enumeration value="tns:InvalidAddress"/>
99 <xs:enumeration value="tns:InvalidEPR"/>
100 <xs:enumeration value="tns:InvalidCardinality"/>
101 <xs:enumeration value="tns:MissingAddressInEPR"/>
102 <xs:enumeration value="tns:DuplicateMessageID"/>
103 <xs:enumeration value="tns:ActionMismatch"/>
104 <xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
105 <xs:enumeration value="tns:DestinationUnreachable"/>
106 <xs:enumeration value="tns:ActionNotSupported"/>
107 <xs:enumeration value="tns:EndpointUnavailable"/>
108 </xs:restriction>
109 </xs:simpleType>
110
111 <xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
112 <xs:complexType name="AttributedUnsignedLongType" mixed="false">
113 <xs:simpleContent>
114 <xs:extension base="xs:unsignedLong">
115 <xs:anyAttribute namespace="##other" processContents="lax"/>
116 </xs:extension>
117 </xs:simpleContent>
118 </xs:complexType>
119
120 <xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
121 <xs:complexType name="AttributedQNameType" mixed="false">
122 <xs:simpleContent>
123 <xs:extension base="xs:QName">
124 <xs:anyAttribute namespace="##other" processContents="lax"/>
125 </xs:extension>
126 </xs:simpleContent>
127 </xs:complexType>
128
129 <xs:element name="ProblemHeader" type="tns:AttributedAnyType"/>
130 <xs:complexType name="AttributedAnyType" mixed="false">
131 <xs:sequence>
132 <xs:any namespace="##any" processContents="lax" minOccurs="1" maxOccurs="1"/>
133 </xs:sequence>
134 <xs:anyAttribute namespace="##other" processContents="lax"/>
135 </xs:complexType>
136
137 <xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
138
139 <xs:element name="ProblemAction" type="tns:ProblemActionType"/>
140 <xs:complexType name="ProblemActionType" mixed="false">
141 <xs:sequence>
142 <xs:element ref="tns:Action" minOccurs="0"/>
143 <xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
144 </xs:sequence>
145 <xs:anyAttribute namespace="##other" processContents="lax"/>
146 </xs:complexType>
147
148 </xs:schema>';
149 end;
150 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> declare
2 xmlschema xmltype := xmltype(:xmlschema);
3 begin
4 dbms_xmlschema.registerSchema
5 (
6 schemaURL => :schemaURL
7 ,schemaDoc => xmlschema
8 ,local => TRUE
9 ,genBean => false
10 ,genTypes => TRUE
11 ,genTables => TRUE
12 );
13 end;
14 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:03.07
SQL>
SQL> begin
2 :schemaURL1 := 'muws1-2.xsd';
3 :xmlSchema :=
4 '<?xml version="1.0" encoding="utf-8"?>
5 <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Dirk Grissett (Oracle Corp.) --> <xs:schema xmlns:muws1="http://docs.
oasis-open.org/wsdm/muws1-2.xsd" xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wsdm/muws1-2.xsd" elementFormDefault="qualified" att
ributeFormDefault="unqualified">
6 <xs:import namespace="http://docs.oasis-open.org/wsdm/muws2-2.xsd" schemaLocation="muws2-2.xsd"/>
7 <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
8 <xs:element name="ResourceId" type="xs:anyURI"/>
9 <xs:element name="ManageabilityCapability" type="xs:anyURI"/>
10 <xs:complexType name="CorrelatablePropertiesType">
11 <xs:sequence>
12 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
13 </xs:sequence>
14 <xs:attribute name="Dialect" type="xs:anyURI"/>
15 <xs:attribute name="NegativeAssertionPossible" type="xs:boolean"/>
16 <xs:anyAttribute namespace="##other"/>
17 </xs:complexType>
18 <xs:element name="CorrelatableProperties" type="muws1:CorrelatablePropertiesType"/>
19 <xs:complexType name="ComponentAddressType">
20 <xs:sequence>
21 <xs:element name="ManagementURL" type="xs:string"/>
22 <xs:any namespace="##any" processContents="lax"/>
23 </xs:sequence>
24 </xs:complexType>
25 <xs:complexType name="ComponentType">
26 <xs:sequence>
27 <xs:element name="ResourceId" type="xs:anyURI" minOccurs="0"/>
28 <xs:element name="ComponentAddress" type="muws1:ComponentAddressType" minOccurs="0"/>
29 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
30 </xs:sequence>
31 <xs:anyAttribute namespace="##other"/>
32 </xs:complexType>
33 <xs:complexType name="ManagementEventType">
34 <xs:sequence>
35 <xs:element name="EventId" type="xs:anyURI"/>
36 <xs:element name="SourceComponent" type="muws1:ComponentType"/>
37 <xs:element name="ReporterComponent" type="muws1:ComponentType" minOccurs="0"/>
38 <xs:element ref="muws2:Situation"/>
39 <xs:element name="ExtendedData" type="muws1:ExtendedDataType" minOccurs="0" maxOccurs="unbounded"/>
40 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
41 </xs:sequence>
42 <xs:attribute name="ReportTime" type="xs:dateTime" use="optional"/>
43 <xs:anyAttribute namespace="##other"/>
44 </xs:complexType>
45 <xs:element name="ManagementEvent" type="muws1:ManagementEventType"/>
46 <xs:element name="ManageabilityEndpointReference" type="wsa:EndpointReferenceType"/>
47 <xs:complexType name="ExtendedDataElementType">
48 <xs:sequence>
49 <xs:choice>
50 <xs:element name="values" minOccurs="0">
51 <xs:simpleType>
52 <xs:restriction base="xs:string">
53 <xs:maxLength value="1024"/>
54 </xs:restriction>
55 </xs:simpleType>
56 </xs:element>
57 <xs:element name="hexValue" type="xs:hexBinary" minOccurs="0"/>
58 <xs:element name="intValues" type="xs:int" minOccurs="0"/>
59 <xs:element name="longValues" type="xs:long" minOccurs="0"/>
60 <xs:element name="shortValues" type="xs:short" minOccurs="0"/>
61 <xs:element name="dateTimeValues" type="xs:dateTime" minOccurs="0"/>
62 <xs:element name="byteValues" type="xs:byte" minOccurs="0"/>
63 <xs:element name="booleanValues" type="xs:boolean" minOccurs="0"/>
64 <xs:element name="floatValues" type="xs:float" minOccurs="0"/>
65 <xs:element name="doubleValues" type="xs:double" minOccurs="0"/>
66 <xs:element name="largeStringValue" type="xs:string" minOccurs="0"/>
67 </xs:choice>
68 </xs:sequence>
69 <xs:attribute name="name" use="required">
70 <xs:simpleType>
71 <xs:restriction base="xs:Name">
72 <xs:maxLength value="64"/>
73 </xs:restriction>
74 </xs:simpleType>
75 </xs:attribute>
76 <xs:attribute name="type" use="required">
77 <xs:simpleType>
78 <xs:restriction base="xs:string">
79 <xs:enumeration value="noValue"/>
80 <xs:enumeration value="byte"/>
81 <xs:enumeration value="short"/>
82 <xs:enumeration value="int"/>
83 <xs:enumeration value="long"/>
84 <xs:enumeration value="float"/>
85 <xs:enumeration value="double"/>
86 <xs:enumeration value="string"/>
87 <xs:enumeration value="dateTime"/>
88 <xs:enumeration value="boolean"/>
89 <xs:enumeration value="byteArray"/>
90 <xs:enumeration value="shortArray"/>
91 <xs:enumeration value="intArray"/>
92 <xs:enumeration value="longArray"/>
93 <xs:enumeration value="floatArray"/>
94 <xs:enumeration value="doubleArray"/>
95 <xs:enumeration value="stringArray"/>
96 <xs:enumeration value="dateTimeArray"/>
97 <xs:enumeration value="booleanArray"/>
98 <xs:enumeration value="hexBinary"/>
99 <xs:enumeration value="largeStringValue"/>
100 </xs:restriction>
101 </xs:simpleType>
102 </xs:attribute>
103 </xs:complexType>
104 <xs:complexType name="ExtendedDataType">
105 <xs:sequence>
106 <xs:element name="ExtendedDataElement" type="muws1:ExtendedDataElementType" minOccurs="0" maxOccurs="unbounded"/>
107 </xs:sequence>
108 <xs:attribute name="profile" type="xs:ID"/>
109 </xs:complexType>
110 <!--
111 SCHEMA COPY Material Copy and paste element references below into the schema of a resource prope
rties document.
112 These references are provide to insure that the correct minOccurs/maxOccurs attributes are specified in a resource property document sc
hema.
113
114 NOTE: You must import the MUWS Part 1 schema namespace (MUWS1).
115
116 ** Identity Properties **
117 <xs:element ref="muws1:ResourceId"/>
118
119
120 ** ManageabilityCharacteristics Properties **
121 <xs:element ref="muws1:ManageabilityCapability"
122 minOccurs="0" maxOccurs="unbounded"/>
123
124 ** Correlatable Properties **
125 <xs:element ref="muws1:CorrelatableProperties"
126 minOccurs="0" maxOccurs="unbounded"/>
127
128 -->
129 </xs:schema>';
130 end;
131 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> declare
2 xmlschema xmltype := xmltype(:xmlschema);
3 begin
4 dbms_xmlschema.registerSchema
5 (
6 schemaURL => :schemaURL1
7 ,schemaDoc => xmlschema
8 ,local => TRUE
9 ,genBean => false
10 ,genTypes => TRUE
11 ,genTables => TRUE
12 ,force => TRUE
13 );
14 end;
15 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.35
SQL> begin
2 :schemaURL2 := 'muws2-2.xsd';
3 :xmlSchema :=
4 '<?xml version="1.0" encoding="utf-8"?>
5 <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Dirk Grissett (Oracle Corp.) -->
6 <xs:schema xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd" xmlns:ws
a="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wsdm/muws2-
2.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
7 <xs:import namespace="http://docs.oasis-open.org/wsdm/muws1-2.xsd" schemaLocation="muws1-2.xsd"/>
8 <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
9 <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
10 <xs:complexType name="LangString">
11 <xs:simpleContent>
12 <xs:extension base="xs:string">
13 <xs:attribute ref="xml:lang" use="required"/>
14 <xs:anyAttribute namespace="##other"/>
15 </xs:extension>
16 </xs:simpleContent>
17 </xs:complexType>
18 <!-- Begin properties for the Description capability -->
19 <xs:element name="Caption" type="muws2:LangString"/>
20 <xs:element name="Description" type="muws2:LangString"/>
21 <xs:element name="Version" type="xs:string"/>
22 <!-- End properties for the Description capability -->
23 <xs:complexType name="CategoryType">
24 <xs:sequence>
25 <xs:any namespace="##any" processContents="lax" minOccurs="0"/>
26 </xs:sequence>
27 </xs:complexType>
28 <xs:complexType name="StateType">
29 <xs:complexContent>
30 <xs:extension base="muws2:CategoryType"/>
31 </xs:complexContent>
32 </xs:complexType>
33 <xs:element name="State" type="muws2:StateType"/>
34 <xs:element name="EnteredState" type="muws2:StateType"/>
35 <xs:element name="PreviousState" type="muws2:StateType"/>
36 <xs:complexType name="StateTransitionType">
37 <xs:sequence>
38 <xs:element ref="muws2:EnteredState"/>
39 <xs:element ref="muws2:PreviousState" minOccurs="0"/>
40 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
41 </xs:sequence>
42 <xs:attribute name="TransitionIdentifier" type="xs:anyURI" use="optional"/>
43 <xs:attribute name="Time" type="xs:dateTime" use="required"/>
44 <xs:anyAttribute namespace="##other"/>
45 </xs:complexType>
46 <xs:element name="StateTransition" type="muws2:StateTransitionType"/>
47 <!-- Begin properties for the OperationalStatus capability -->
48 <xs:element name="OperationalStatus">
49 <xs:simpleType>
50 <xs:restriction base="xs:string">
51 <xs:enumeration value="Available"/>
52 <xs:enumeration value="PartiallyAvailable"/>
53 <xs:enumeration value="Unavailable"/>
54 <xs:enumeration value="Unknown"/>
55 </xs:restriction>
56 </xs:simpleType>
57 </xs:element>
58 <!-- End properties for the OperationalStatus capability -->
59 <xs:attributeGroup name="MetricAttributes">
60 <xs:attribute name="ResetAt" type="xs:dateTime"/>
61 <xs:attribute name="LastUpdated" type="xs:dateTime"/>
62 <xs:attribute name="Duration" type="xs:duration"/>
63 </xs:attributeGroup>
64 <!-- Begin properties for the Metrics capability -->
65 <xs:element name="CurrentTime" type="xs:dateTime"/>
66 <!-- End properties for the Metrics capability -->
67 <xs:complexType name="RelationshipTypeType">
68 <xs:complexContent>
69 <xs:extension base="muws2:CategoryType"/>
70 </xs:complexContent>
71 </xs:complexType>
72 <xs:element name="Self">
73 <xs:complexType/>
74 </xs:element>
75 <xs:complexType name="RelationshipParticipantType">
76 <xs:sequence>
77 <xs:element ref="muws2:Self" minOccurs="0"/>
78 <xs:element ref="muws1:ManageabilityEndpointReference" minOccurs="0" maxOccurs="unbounded"/>
79 <xs:element ref="wsa:EndpointReference" minOccurs="0" maxOccurs="unbounded"/>
80 <xs:element ref="muws1:ResourceId" minOccurs="0"/>
81 <xs:element name="Role" type="xs:anyURI"/>
82 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
83 </xs:sequence>
84 <xs:anyAttribute namespace="##other"/>
85 </xs:complexType>
86 <!-- Begin properties for the RelationshipResource capability -->
87 <xs:element name="Name" type="xs:string"/>
88 <xs:element name="Type" type="muws2:RelationshipTypeType"/>
89 <xs:element name="Participant" type="muws2:RelationshipParticipantType"/>
90 <!-- End properties for the RelationshipResource capability -->
91 <xs:complexType name="RelationshipType">
92 <xs:sequence>
93 <xs:element ref="muws2:Name" minOccurs="0"/>
94 <xs:element ref="muws2:Type"/>
95 <xs:element ref="muws2:Participant" minOccurs="2" maxOccurs="unbounded"/>
96 <xs:element name="AccessEndpointReference" type="wsa:EndpointReferenceType" minOccurs="0"/>
97 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
98 </xs:sequence>
99 <xs:anyAttribute namespace="##other"/>
100 </xs:complexType>
101 <!-- Begin properties for the Relationship capability -->
102 <xs:element name="Relationship" type="muws2:RelationshipType"/>
103 <!-- End properties for the Relationship capability -->
104 <xs:element name="RelationshipCreatedNotification">
105 <xs:complexType>
106 <xs:sequence>
107 <xs:element ref="muws2:Relationship"/>
108 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
109 </xs:sequence>
110 <xs:anyAttribute namespace="##other"/>
111 </xs:complexType>
112 </xs:element>
113 <xs:element name="RelationshipDeletedNotification">
114 <xs:complexType>
115 <xs:sequence>
116 <xs:element ref="muws2:Relationship"/>
117 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
118 </xs:sequence>
119 <xs:anyAttribute namespace="##other"/>
120 </xs:complexType>
121 </xs:element>
122 <xs:element name="QueryRelationshipsByType">
123 <xs:complexType>
124 <xs:sequence>
125 <xs:element name="RequestedType" type="xs:QName"/>
126 </xs:sequence>
127 </xs:complexType>
128 </xs:element>
129 <xs:element name="QueryRelationshipsByTypeResponse">
130 <xs:complexType>
131 <xs:sequence>
132 <xs:element ref="muws2:Relationship" minOccurs="0" maxOccurs="unbounded"/>
133 </xs:sequence>
134 </xs:complexType>
135 </xs:element>
136 <xs:element name="CreationNotification">
137 <xs:complexType>
138 <xs:sequence>
139 <xs:element ref="muws1:ManageabilityEndpointReference" minOccurs="0" maxOccurs="unbounded"/>
140 </xs:sequence>
141 <xs:anyAttribute namespace="##other"/>
142 </xs:complexType>
143 </xs:element>
144 <xs:element name="DestructionNotification">
145 <xs:complexType>
146 <xs:sequence>
147 <xs:element ref="muws1:ResourceId" minOccurs="0"/>
148 </xs:sequence>
149 <xs:anyAttribute namespace="##other"/>
150 </xs:complexType>
151 </xs:element>
152 <xs:complexType name="SituationCategoryType">
153 <xs:complexContent>
154 <xs:extension base="muws2:CategoryType">
155 <xs:sequence>
156 <xs:element name="SituationName" minOccurs="0"/>
157 </xs:sequence>
158 </xs:extension>
159 </xs:complexContent>
160 </xs:complexType>
161 <xs:element name="fred" type="xs:string"/>
162 <xs:complexType name="SubstitutableMsgType">
163 <xs:sequence>
164 <xs:element name="Value" type="xs:anySimpleType" minOccurs="0" maxOccurs="unbounded"/>
165 </xs:sequence>
166 <xs:attribute name="MsgId" type="xs:string" use="required"/>
167 <xs:attribute name="MsgIdType" type="xs:anyURI" use="required"/>
168 </xs:complexType>
169 <xs:complexType name="SituationType">
170 <xs:sequence>
171 <xs:element name="SituationCategory" type="muws2:SituationCategoryType"/>
172 <xs:element name="SuccessDisposition" minOccurs="0">
173 <xs:simpleType>
174 <xs:restriction base="xs:string">
175 <xs:enumeration value="Successful"/>
176 <xs:enumeration value="Unsuccessful"/>
177 </xs:restriction>
178 </xs:simpleType>
179 </xs:element>
180 <xs:element name="SituationTime" type="xs:dateTime"/>
181 <xs:element name="Priority" type="xs:short" minOccurs="0"/>
182 <xs:element name="Severity" type="xs:short" minOccurs="0"/>
183 <xs:element name="Message" type="muws2:LangString" minOccurs="0"/>
184 <xs:element name="SubstitutableMsg" type="muws2:SubstitutableMsgType" minOccurs="0"/>
185 </xs:sequence>
186 </xs:complexType>
187 <xs:element name="Situation" type="muws2:SituationType"/>
188 <xs:complexType name="EventCorrelationPropertiesType">
189 <xs:sequence>
190 <xs:element name="repeatCount" minOccurs="0">
191 <xs:simpleType>
192 <xs:restriction base="xs:short">
193 <xs:minInclusive value="0"/>
194 </xs:restriction>
195 </xs:simpleType>
196 </xs:element>
197 <xs:element name="elapsedTime" minOccurs="0">
198 <xs:simpleType>
199 <xs:restriction base="xs:long">
200 <xs:minInclusive value="0"/>
201 </xs:restriction>
202 </xs:simpleType>
203 </xs:element>
204 </xs:sequence>
205 <xs:attribute name="sequenceNumber" type="xs:unsignedLong"/>
206 </xs:complexType>
207 <xs:element name="EventCorrelationProperties" type="muws2:EventCorrelationPropertiesType"/>
208 <xs:complexType name="MsgCatalogInformationType">
209 <xs:sequence>
210 <xs:element name="msgCatalog" type="xs:anyURI"/>
211 <xs:element name="msgCatalogType" type="xs:anyURI" minOccurs="0"/>
212 </xs:sequence>
213 </xs:complexType>
214 <xs:element name="MsgCatalogInformation" type="muws2:MsgCatalogInformationType"/>
215 <!-- ##### Metadata description elements ##### -->
216 <xs:element name="Capability" type="xs:anyURI"/>
217 <xs:complexType name="DialectableExpressionType" mixed="true">
218 <xs:sequence>
219 <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
220 </xs:sequence>
221 <xs:attribute name="Dialect" type="xs:anyURI" use="required"/>
222 <xs:anyAttribute namespace="##other"/>
223 </xs:complexType>
224 <xs:element name="ValidWhile" type="muws2:DialectableExpressionType"/>
225 <xs:element name="Units" type="xs:string"/>
226 <xs:element name="ChangeType">
227 <xs:simpleType>
228 <xs:restriction base="xs:string">
229 <xs:enumeration value="Counter"/>
230 <xs:enumeration value="Gauge"/>
231 <xs:enumeration value="Unknown"/>
232 </xs:restriction>
233 </xs:simpleType>
234 </xs:element>
235 <xs:element name="TimeScope">
236 <xs:simpleType>
237 <xs:restriction base="xs:string">
238 <xs:enumeration value="Interval"/>
239 <xs:enumeration value="PointInTime"/>
240 <xs:enumeration value="SinceReset"/>
241 </xs:restriction>
242 </xs:simpleType>
243 </xs:element>
244 <xs:element name="GatheringTime">
245 <xs:simpleType>
246 <xs:restriction base="xs:string">
247 <xs:enumeration value="OnChange"/>
248 <xs:enumeration value="Periodic"/>
249 <xs:enumeration value="OnDemand"/>
250 <xs:enumeration value="Unknown"/>
251 </xs:restriction>
252 </xs:simpleType>
253 </xs:element>
254 <xs:element name="CalculationInterval" type="xs:duration"/>
255 <xs:element name="MetricGroup" type="xs:anyURI"/>
256 <xs:element name="PostCondition" type="muws2:DialectableExpressionType"/>
257 <!-- ========= StartSituation ============ -->
258 <xs:element name="StartSituation">
259 <xs:complexType>
260 <xs:complexContent>
261 <xs:restriction base="muws2:SituationCategoryType"/>
262 </xs:complexContent>
263 </xs:complexType>
264 </xs:element>
265 <xs:element name="StartInitiated">
266 <xs:complexType>
267 <xs:complexContent>
268 <xs:restriction base="muws2:SituationCategoryType">
269 <xs:sequence>
270 <xs:element ref="muws2:StartSituation"/>
271 </xs:sequence>
272 </xs:restriction>
273 </xs:complexContent>
274 </xs:complexType>
275 </xs:element>
276 <xs:element name="RestartInitiated">
277 <xs:complexType>
278 <xs:complexContent>
279 <xs:restriction base="muws2:SituationCategoryType">
280 <xs:sequence>
281 <xs:element ref="muws2:StartSituation"/>
282 </xs:sequence>
283 </xs:restriction>
284 </xs:complexContent>
285 </xs:complexType>
286 </xs:element>
287 <xs:element name="StartCompleted">
288 <xs:complexType>
289 <xs:complexContent>
290 <xs:restriction base="muws2:SituationCategoryType">
291 <xs:sequence>
292 <xs:element ref="muws2:StartSituation"/>
293 </xs:sequence>
294 </xs:restriction>
295 </xs:complexContent>
296 </xs:complexType>
297 </xs:element>
298 <!-- ========= StopSituation ============ -->
299 <xs:element name="StopSituation">
300 <xs:complexType>
301 <xs:complexContent>
302 <xs:restriction base="muws2:SituationCategoryType"/>
303 </xs:complexContent>
304 </xs:complexType>
305 </xs:element>
306 <xs:element name="StopInitiated">
307 <xs:complexType>
308 <xs:complexContent>
309 <xs:restriction base="muws2:SituationCategoryType">
310 <xs:sequence>
311 <xs:element ref="muws2:StopSituation"/>
312 </xs:sequence>
313 </xs:restriction>
314 </xs:complexContent>
315 </xs:complexType>
316 </xs:element>
317 <xs:element name="AbortInitiated">
318 <xs:complexType>
319 <xs:complexContent>
320 <xs:restriction base="muws2:SituationCategoryType">
321 <xs:sequence>
322 <xs:element ref="muws2:StopSituation"/>
323 </xs:sequence>
324 </xs:restriction>
325 </xs:complexContent>
326 </xs:complexType>
327 </xs:element>
328 <xs:element name="PauseInitiated">
329 <xs:complexType>
330 <xs:complexContent>
331 <xs:restriction base="muws2:SituationCategoryType">
332 <xs:sequence>
333 <xs:element ref="muws2:StopSituation"/>
334 </xs:sequence>
335 </xs:restriction>
336 </xs:complexContent>
337 </xs:complexType>
338 </xs:element>
339 <xs:element name="StopCompleted">
340 <xs:complexType>
341 <xs:complexContent>
342 <xs:restriction base="muws2:SituationCategoryType">
343 <xs:sequence>
344 <xs:element ref="muws2:StopSituation"/>
345 </xs:sequence>
346 </xs:restriction>
347 </xs:complexContent>
348 </xs:complexType>
349 </xs:element>
350 <!-- ========= RequestSituation ============ -->
351 <xs:element name="RequestSituation">
352 <xs:complexType>
353 <xs:complexContent>
354 <xs:restriction base="muws2:SituationCategoryType"/>
355 </xs:complexContent>
356 </xs:complexType>
357 </xs:element>
358 <xs:element name="RequestInitiated">
359 <xs:complexType>
360 <xs:complexContent>
361 <xs:restriction base="muws2:SituationCategoryType">
362 <xs:sequence>
363 <xs:element ref="muws2:RequestSituation"/>
364 </xs:sequence>
365 </xs:restriction>
366 </xs:complexContent>
367 </xs:complexType>
368 </xs:element>
369 <xs:element name="RequestCompleted">
370 <xs:complexType>
371 <xs:complexContent>
372 <xs:restriction base="muws2:SituationCategoryType">
373 <xs:sequence>
374 <xs:element ref="muws2:RequestSituation"/>
375 </xs:sequence>
376 </xs:restriction>
377 </xs:complexContent>
378 </xs:complexType>
379 </xs:element>
380 <!-- ========= DestroySituation ============ -->
381 <xs:element name="DestroySituation">
382 <xs:complexType>
383 <xs:complexContent>
384 <xs:restriction base="muws2:SituationCategoryType"/>
385 </xs:complexContent>
386 </xs:complexType>
387 </xs:element>
388 <xs:element name="DestroyInitiated">
389 <xs:complexType>
390 <xs:complexContent>
391 <xs:restriction base="muws2:SituationCategoryType">
392 <xs:sequence>
393 <xs:element ref="muws2:DestroySituation"/>
394 </xs:sequence>
395 </xs:restriction>
396 </xs:complexContent>
397 </xs:complexType>
398 </xs:element>
399 <xs:element name="DestroyCompleted">
400 <xs:complexType>
401 <xs:complexContent>
402 <xs:restriction base="muws2:SituationCategoryType">
403 <xs:sequence>
404 <xs:element ref="muws2:DestroySituation"/>
405 </xs:sequence>
406 </xs:restriction>
407 </xs:complexContent>
408 </xs:complexType>
409 </xs:element>
410 <!-- ========= CreateSituation ============ -->
411 <xs:element name="CreateSituation">
412 <xs:complexType>
413 <xs:complexContent>
414 <xs:restriction base="muws2:SituationCategoryType"/>
415 </xs:complexContent>
416 </xs:complexType>
417 </xs:element>
418 <xs:element name="CreateInitiated">
419 <xs:complexType>
420 <xs:complexContent>
421 <xs:restriction base="muws2:SituationCategoryType">
422 <xs:sequence>
423 <xs:element ref="muws2:CreateSituation"/>
424 </xs:sequence>
425 </xs:restriction>
426 </xs:complexContent>
427 </xs:complexType>
428 </xs:element>
429 <xs:element name="CreateCompleted">
430 <xs:complexType>
431 <xs:complexContent>
432 <xs:restriction base="muws2:SituationCategoryType">
433 <xs:sequence>
434 <xs:element ref="muws2:CreateSituation"/>
435 </xs:sequence>
436 </xs:restriction>
437 </xs:complexContent>
438 </xs:complexType>
439 </xs:element>
440 <!-- ========= ConnectSituation ============ -->
441 <xs:element name="ConnectSituation">
442 <xs:complexType>
443 <xs:complexContent>
444 <xs:restriction base="muws2:SituationCategoryType"/>
445 </xs:complexContent>
446 </xs:complexType>
447 </xs:element>
448 <xs:element name="ConnectInitiated">
449 <xs:complexType>
450 <xs:complexContent>
451 <xs:restriction base="muws2:SituationCategoryType">
452 <xs:sequence>
453 <xs:element ref="muws2:ConnectSituation"/>
454 </xs:sequence>
455 </xs:restriction>
456 </xs:complexContent>
457 </xs:complexType>
458 </xs:element>
459 <xs:element name="ReconnectInitiated">
460 <xs:complexType>
461 <xs:complexContent>
462 <xs:restriction base="muws2:SituationCategoryType">
463 <xs:sequence>
464 <xs:element ref="muws2:ConnectSituation"/>
465 </xs:sequence>
466 </xs:restriction>
467 </xs:complexContent>
468 </xs:complexType>
469 </xs:element>
470 <xs:element name="ConnectCompleted">
471 <xs:complexType>
472 <xs:complexContent>
473 <xs:restriction base="muws2:SituationCategoryType">
474 <xs:sequence>
475 <xs:element ref="muws2:ConnectSituation"/>
476 </xs:sequence>
477 </xs:restriction>
478 </xs:complexContent>
479 </xs:complexType>
480 </xs:element>
481 <!-- ========= ReportSituation ============ -->
482 <xs:element name="ReportSituation">
483 <xs:complexType>
484 <xs:complexContent>
485 <xs:restriction base="muws2:SituationCategoryType"/>
486 </xs:complexContent>
487 </xs:complexType>
488 </xs:element>
489 <xs:element name="PerformanceReport">
490 <xs:complexType>
491 <xs:complexContent>
492 <xs:restriction base="muws2:SituationCategoryType">
493 <xs:sequence>
494 <xs:element ref="muws2:ReportSituation"/>
495 </xs:sequence>
496 </xs:restriction>
497 </xs:complexContent>
498 </xs:complexType>
499 </xs:element>
500 <xs:element name="SecurityReport">
501 <xs:complexType>
502 <xs:complexContent>
503 <xs:restriction base="muws2:SituationCategoryType">
504 <xs:sequence>
505 <xs:element ref="muws2:ReportSituation"/>
506 </xs:sequence>
507 </xs:restriction>
508 </xs:complexContent>
509 </xs:complexType>
510 </xs:element>
511 <xs:element name="HeartbeatReport">
512 <xs:complexType>
513 <xs:complexContent>
514 <xs:restriction base="muws2:SituationCategoryType">
515 <xs:sequence>
516 <xs:element ref="muws2:ReportSituation"/>
517 </xs:sequence>
518 </xs:restriction>
519 </xs:complexContent>
520 </xs:complexType>
521 </xs:element>
522 <xs:element name="StatusReport">
523 <xs:complexType>
524 <xs:complexContent>
525 <xs:restriction base="muws2:SituationCategoryType">
526 <xs:sequence>
527 <xs:element ref="muws2:ReportSituation"/>
528 </xs:sequence>
529 </xs:restriction>
530 </xs:complexContent>
531 </xs:complexType>
532 </xs:element>
533 <xs:element name="TraceReport">
534 <xs:complexType>
535 <xs:complexContent>
536 <xs:restriction base="muws2:SituationCategoryType"&g -
Error while Registering XML Schema
Hi Team,
The mail purpose of my project is to load data from XML feed file into Oracle tables. I did following steps which went perfectly fine ...
I did following steps.
1)create DIRECTORY xml_dir as 'c:\xmldata';
2) create table xmltab of XMLType;
3) Following packages are executed through "Sys" Schema
1)dbmslob.sql;
2)prvtlob.plb;
4) An xmldata folder is created under "c:\" and file with data_file.xml is stored in it.
5) insert into xmltab values(XMLType(bfilename('XML_DIR ','data_file.xml'), nls_charset_id('AL32UTF8')));
When I try to execute following select statment "No Rows Selected" message is displayed; although there is one element in xml data file.
SELECT OBJECT_VALUE
FROM xmltab
WHERE existsNode(OBJECT_VALUE, '/ConsolidatedAssetHeader[AssetSourceSystem= "CAPS"]')=1
Now I think in order to use all functions like existsNode and exctractValue I will have to register Schema in DB.
Following is the XML Schema file.
<xsd:schema targetNamespace="schemas-dart-com:sql:ConsolidatedAssetHeader" xmlns:schema="schemas-dart-com:sql:ConsolidatedAssetHeader" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes" elementFormDefault="qualified">
<xsd:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd" />
- <xsd:element name="ConsolidatedAssetHeader">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="InternalId" type="sqltypes:int" />
- <xsd:element name="DCN">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="30" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="EventDateLastChanged" type="sqltypes:datetime" minOccurs="0" />
- <xsd:element name="FinancialStatusIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="InScopeIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationPriorityIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="PhysicalInstallDate" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetComment" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="255" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetContractExtension" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetContractNumber" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetDescription" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetFinancialInstallDate" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="AssetFinancialRemovalDate" type="sqltypes:datetime" minOccurs="0" />
- <xsd:element name="AssetFinancialStatus" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetName" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="255" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetParentSource" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetParentSourceID" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetPhysicalInstallDate" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="AssetPhysicalRemovalDate" type="sqltypes:datetime" minOccurs="0" />
- <xsd:element name="AssetPhysicalStatus" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetPhysicalStatusIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSerialIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSerialNumber" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSource" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceID" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceSystem" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceType" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetTag" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="BillabilityIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="InScopeFlag" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="IPAddress" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="NetworkNumber" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="SubnetAddress" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element ref="schema:ConsolidatedAssetLocation" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+ <xsd:element name="ConsolidatedAssetLocation">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="InternalId" type="sqltypes:int" minOccurs="0" />
<xsd:element name="ParentId" type="sqltypes:int" minOccurs="0" />
- <xsd:element name="AssetLocationIDBillTo" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetLocationIDShipTo" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetLocationIDSoldTo" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceDt" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceIDDt" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="AssetSourceSystemDt" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="ContractNumberExtensionDt" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToAddress" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToAddressLine2" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToAddressLine3" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToCity" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToCountry" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToAddressLine4" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToState" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationBillToZip" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationPriorityIndicator" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToAddress" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToAddressLine2" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToAddressLine3" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToAddressLine4" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToCity" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToCountry" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToState" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationShipToZip" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToAddress" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToAddressLine2" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToAddressLine3" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToAddressLine4" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToCity" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToCountry" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToState" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="LocationSoldToZip" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="PartySource" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="PartySourceID" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="RowCreateDateTime" type="sqltypes:datetime" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I use following package to register schema, which is giving error
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'schemas-dart-com:sql:ConsolidatedAssetHeader',
XDBURIType('http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd').getClob(),
TRUE,
TRUE,
FALSE,
TRUE);
END;
Following Error is displayed.
BEGIN
ERROR at line 1:
ORA-31001: Invalid resource handle or path name
"http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd"
ORA-06512: at "SYS.XDBURITYPE", line 4
ORA-06512: at line 2
Can you please tell me what changes I need to make in order to resolve this error?Is there any specific location where I should put my schema file?
Thanks in Advance
VaibhaviCreate a file in c:\xmldata with the name my_xmlschema.xsd with the following content
<xsd:schema targetNamespace="schemas-dart-com:sql:ConsolidatedAssetHeader" xmlns:schema="schemas-dart-com:sql:ConsolidatedAssetHeader" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes" elementFormDefault="qualified">
<xsd:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd" />
<xsd:element name="ConsolidatedAssetHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="InternalId" type="sqltypes:int" />
<xsd:element name="DCN">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="30" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="EventDateLastChanged" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="FinancialStatusIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="InScopeIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationPriorityIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="PhysicalInstallDate" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetComment" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="255" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetContractExtension" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetContractNumber" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetDescription" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetFinancialInstallDate" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="AssetFinancialRemovalDate" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="AssetFinancialStatus" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetName" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="255" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetParentSource" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetParentSourceID" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetPhysicalInstallDate" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="AssetPhysicalRemovalDate" type="sqltypes:datetime" minOccurs="0" />
<xsd:element name="AssetPhysicalStatus" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetPhysicalStatusIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSerialIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSerialNumber" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSource" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceID" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceSystem" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceType" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetTag" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="BillabilityIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="InScopeFlag" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="IPAddress" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="NetworkNumber" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="SubnetAddress" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element ref="schema:ConsolidatedAssetLocation" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+ <xsd:element name="ConsolidatedAssetLocation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="InternalId" type="sqltypes:int" minOccurs="0" />
<xsd:element name="ParentId" type="sqltypes:int" minOccurs="0" />
<xsd:element name="AssetLocationIDBillTo" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetLocationIDShipTo" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetLocationIDSoldTo" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceDt" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceIDDt" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="AssetSourceSystemDt" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ContractNumberExtensionDt" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToAddress" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToAddressLine2" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToAddressLine3" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToCity" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToCountry" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToAddressLine4" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToState" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationBillToZip" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationPriorityIndicator" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToAddress" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToAddressLine2" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToAddressLine3" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToAddressLine4" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToCity" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToCountry" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToState" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationShipToZip" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToAddress" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToAddressLine2" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToAddressLine3" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToAddressLine4" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="150" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToCity" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToCountry" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToState" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationSoldToZip" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="PartySource" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="PartySourceID" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="RowCreateDateTime" type="sqltypes:datetime" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema> -
How to create XML from relational tables based on an XML Schema ?
There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
SQL> drop table PURCHASEORDER_LINEITEM
2 /
Table dropped.
SQL> drop table PURCHASEORDER_REJECTION
2 /
Table dropped.
SQL> drop table PURCHASEORDER_SHIPPING
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_ACTION
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_TABLE
2 /
Table dropped.
SQL> create table PURCHASEORDER_TABLE
2 (
3 REFERENCE VARCHAR2(28),
4 PRIMARY KEY ("REFERENCE"),
5 REQUESTER VARCHAR2(48),
6 USERID VARCHAR2(32),
7 COSTCENTER VARCHAR2(3),
8 SPECIALINSTRUCTIONS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_ACTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 ACTIONEDBY VARCHAR2(32),
6 DATEACTIONED DATE
7 )
8 /
Table created.
SQL> create table PURCHASEORDER_SHIPPING
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 SHIPTONAME VARCHAR2(48),
7 ADDRESS VARCHAR2(512),
8 PHONE VARCHAR2(32)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_REJECTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 REJECTEDBY VARCHAR2(32),
7 DATEREJECTED DATE,
8 COMMENTS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_LINEITEM
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 LINENO NUMBER(10),
6 PRIMARY KEY ("REFERENCE","LINENO"),
7 UPC VARCHAR2(14),
8 DESCRIPTION VARCHAR2(128),
9 QUANTITY NUMBER(10),
10 UNITPRICE NUMBER(12,2)
11 )
12 /
Table created.
SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
2 /
1 row created.
SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
2 /
1 row created.
SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
5,USA','650 506 7800')
2 /
1 row created.
SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
2 /
1 row created.
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
3 :schemaPath := '/public/purchaseOrder.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
ue">
6 <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
7 <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
8 <xs:sequence>
9 <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
10 <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
11 <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
12 <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
13 <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
14 <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
15 <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
16 <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
17 <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
18 </xs:sequence>
19 </xs:complexType>
20 <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
21 <xs:sequence>
22 <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
INEITEM_V"/>
23 </xs:sequence>
24 </xs:complexType>
25 <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
26 <xs:sequence>
27 <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
28 <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
29 </xs:sequence>
30 <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
31 </xs:complexType>
32 <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
33 <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
34 <xs:simpleType>
35 <xs:restriction base="xs:string">
36 <xs:minLength value="10"/>
37 <xs:maxLength value="14"/>
38 </xs:restriction>
39 </xs:simpleType>
40 </xs:attribute>
41 <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
42 <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
43 </xs:complexType>
44 <xs:simpleType name="ReferenceType">
45 <xs:restriction base="xs:string">
46 <xs:minLength value="18"/>
47 <xs:maxLength value="30"/>
48 </xs:restriction>
49 </xs:simpleType>
50 <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
51 <xs:sequence>
52 <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
53 <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
54 <xs:sequence>
55 <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
56 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
57 </xs:sequence>
58 </xs:complexType>
59 </xs:element>
60 </xs:sequence>
61 </xs:complexType>
62 <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
63 <xs:all>
64 <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
65 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
66 <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
67 </xs:all>
68 </xs:complexType>
69 <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
70 <xs:sequence>
71 <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
72 <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
73 <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
74 </xs:sequence>
75 </xs:complexType>
76 <xs:simpleType name="moneyType">
77 <xs:restriction base="xs:decimal">
78 <xs:fractionDigits value="2"/>
79 <xs:totalDigits value="12"/>
80 </xs:restriction>
81 </xs:simpleType>
82 <xs:simpleType name="quantityType">
83 <xs:restriction base="xs:decimal">
84 <xs:fractionDigits value="4"/>
85 <xs:totalDigits value="8"/>
86 </xs:restriction>
87 </xs:simpleType>
88 <xs:simpleType name="UserType">
89 <xs:restriction base="xs:string">
90 <xs:minLength value="1"/>
91 <xs:maxLength value="10"/>
92 </xs:restriction>
93 </xs:simpleType>
94 <xs:simpleType name="RequestorType">
95 <xs:restriction base="xs:string">
96 <xs:minLength value="0"/>
97 <xs:maxLength value="128"/>
98 </xs:restriction>
99 </xs:simpleType>
100 <xs:simpleType name="CostCenterType">
101 <xs:restriction base="xs:string">
102 <xs:minLength value="1"/>
103 <xs:maxLength value="4"/>
104 </xs:restriction>
105 </xs:simpleType>
106 <xs:simpleType name="VendorType">
107 <xs:restriction base="xs:string">
108 <xs:minLength value="0"/>
109 <xs:maxLength value="20"/>
110 </xs:restriction>
111 </xs:simpleType>
112 <xs:simpleType name="PurchaseOrderNumberType">
113 <xs:restriction base="xs:integer"/>
114 </xs:simpleType>
115 <xs:simpleType name="SpecialInstructionsType">
116 <xs:restriction base="xs:string">
117 <xs:minLength value="0"/>
118 <xs:maxLength value="2048"/>
119 </xs:restriction>
120 </xs:simpleType>
121 <xs:simpleType name="NameType">
122 <xs:restriction base="xs:string">
123 <xs:minLength value="1"/>
124 <xs:maxLength value="20"/>
125 </xs:restriction>
126 </xs:simpleType>
127 <xs:simpleType name="AddressType">
128 <xs:restriction base="xs:string">
129 <xs:minLength value="1"/>
130 <xs:maxLength value="256"/>
131 </xs:restriction>
132 </xs:simpleType>
133 <xs:simpleType name="TelephoneType">
134 <xs:restriction base="xs:string">
135 <xs:minLength value="1"/>
136 <xs:maxLength value="24"/>
137 </xs:restriction>
138 </xs:simpleType>
139 <xs:simpleType name="DateType">
140 <xs:restriction base="xs:date"/>
141 </xs:simpleType>
142 <xs:simpleType name="CommentsType">
143 <xs:restriction base="xs:string">
144 <xs:minLength value="1"/>
145 <xs:maxLength value="2048"/>
146 </xs:restriction>
147 </xs:simpleType>
148 <xs:simpleType name="DescriptionType">
149 <xs:restriction base="xs:string">
150 <xs:minLength value="1"/>
151 <xs:maxLength value="256"/>
152 </xs:restriction>
153 </xs:simpleType>
154 </xs:schema>
155 ');
156 begin
157 if (dbms_xdb.existsResource(:schemaPath)) then
158 dbms_xdb.deleteResource(:schemaPath);
159 end if;
160 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
161 end;
162 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,FALSE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> create or replace view PURCHASEORDER_XML
2 of xmltype
3 xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
4 with object id
5 (
6 substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
7 )
8 as
9 select xmlElement
10 (
11 "PurchaseOrder",
12 xmlAttributes
13 (
14 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
15 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
16 ),
17 xmlElement("Reference",p.REFERENCE),
18 xmlElement
19 (
20 "Actions",
21 ( select xmlAgg
22 (
23 xmlElement
24 (
25 "Action",
26 xmlElement("User",ACTIONEDBY),
27 case
28 when DATEACTIONED is not null
29 then xmlElement("Date",DATEACTIONED)
30 end
31 )
32 )
33 from PURCHASEORDER_ACTION a
34 where a.REFERENCE = p.REFERENCE
35 )
36 ),
37 xmlElement
38 (
39 "Reject",
40 xmlForest
41 (
42 REJECTEDBY as "User",
43 DATEREJECTED as "Date",
44 COMMENTS as "Comments"
45 )
46 ),
47 xmlElement("Requestor",REQUESTER),
48 xmlElement("User",USERID),
49 xmlElement("CostCenter",COSTCENTER),
50 xmlElement
51 (
52 "ShippingInstructions",
53 xmlElement("name",SHIPTONAME),
54 xmlElement("address",ADDRESS),
55 xmlElement("telephone",PHONE)
56 ),
57 xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
58 xmlElement
59 (
60 "LineItems",
61 ( select xmlAgg
62 (
63 xmlElement
64 (
65 "LineItem",
66 xmlAttributes(LINENO as "ItemNumber"),
67 xmlElement("Description",DESCRIPTION),
68 xmlElement
69 (
70 "Part",
71 xmlAttributes
72 (
73 UPC as "Id",
74 QUANTITY as "Quantity",
75 UNITPRICE as "UnitPrice"
76 )
77 )
78 )
79 )
80 from PURCHASEORDER_LINEITEM l
81 where l.REFERENCE = p.REFERENCE
82 )
83 )
84 )
85 from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
86 where r.REFERENCE = p.REFERENCE
87 and s.REFERENCE = p.REFERENCE
88 /
View created.
SQL> set long 10000 pages 0 lines 140
SQL> --
SQL> select x.object_value.extract('/*')
2 from PURCHASEORDER_XML x
3 /
<PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Reference>SMCCAIN-20030109123335470PDT</Reference>
<Actions>
<Action>
<User>SVOLLMAN</User>
</Action>
</Actions>
<Reject/>
<Requestor>Samuel B. McCain</Requestor>
<User>SMCCAIN</User>
<CostCenter>A10</CostCenter>
<ShippingInstructions>
<name>Samuel B. McCain</name>
<address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
<telephone>650 506 7800</telephone>
</ShippingInstructions>
<SpecialInstructions>Courier</SpecialInstructions>
<LineItems>
<LineItem ItemNumber="1">
<Description>Life of Brian - Monty Python's</Description>
<Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="2">
<Description>The Night Porter</Description>
<Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="3">
<Description>Oliver Twist</Description>
<Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="4">
<Description>Notorious</Description>
<Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="5">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="6">
<Description>Alphaville</Description>
<Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="7">
<Description>General Idi Amin Dada</Description>
<Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="8">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="9">
<Description>Flesh for Frankenstein</Description>
<Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="10">
<Description>The Killer</Description>
<Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="11">
<Description>Ballad of a Soldier</Description>
<Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="12">
<Description>Ordet</Description>
<Part Id="37429158623" Quantity="2" UnitPrice="0"/>
</LineItem>
</LineItems>
</PurchaseOrder>
SQL> begin
2 for x in (select object_value from PURCHASEORDER_XML) loop
3 x.object_value.schemaValidate();
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL>There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
SQL> drop table PURCHASEORDER_LINEITEM
2 /
Table dropped.
SQL> drop table PURCHASEORDER_REJECTION
2 /
Table dropped.
SQL> drop table PURCHASEORDER_SHIPPING
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_ACTION
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_TABLE
2 /
Table dropped.
SQL> create table PURCHASEORDER_TABLE
2 (
3 REFERENCE VARCHAR2(28),
4 PRIMARY KEY ("REFERENCE"),
5 REQUESTER VARCHAR2(48),
6 USERID VARCHAR2(32),
7 COSTCENTER VARCHAR2(3),
8 SPECIALINSTRUCTIONS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_ACTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 ACTIONEDBY VARCHAR2(32),
6 DATEACTIONED DATE
7 )
8 /
Table created.
SQL> create table PURCHASEORDER_SHIPPING
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 SHIPTONAME VARCHAR2(48),
7 ADDRESS VARCHAR2(512),
8 PHONE VARCHAR2(32)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_REJECTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 REJECTEDBY VARCHAR2(32),
7 DATEREJECTED DATE,
8 COMMENTS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_LINEITEM
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 LINENO NUMBER(10),
6 PRIMARY KEY ("REFERENCE","LINENO"),
7 UPC VARCHAR2(14),
8 DESCRIPTION VARCHAR2(128),
9 QUANTITY NUMBER(10),
10 UNITPRICE NUMBER(12,2)
11 )
12 /
Table created.
SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
2 /
1 row created.
SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
2 /
1 row created.
SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
5,USA','650 506 7800')
2 /
1 row created.
SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
2 /
1 row created.
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
3 :schemaPath := '/public/purchaseOrder.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
ue">
6 <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
7 <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
8 <xs:sequence>
9 <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
10 <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
11 <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
12 <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
13 <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
14 <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
15 <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
16 <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
17 <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
18 </xs:sequence>
19 </xs:complexType>
20 <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
21 <xs:sequence>
22 <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
INEITEM_V"/>
23 </xs:sequence>
24 </xs:complexType>
25 <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
26 <xs:sequence>
27 <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
28 <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
29 </xs:sequence>
30 <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
31 </xs:complexType>
32 <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
33 <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
34 <xs:simpleType>
35 <xs:restriction base="xs:string">
36 <xs:minLength value="10"/>
37 <xs:maxLength value="14"/>
38 </xs:restriction>
39 </xs:simpleType>
40 </xs:attribute>
41 <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
42 <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
43 </xs:complexType>
44 <xs:simpleType name="ReferenceType">
45 <xs:restriction base="xs:string">
46 <xs:minLength value="18"/>
47 <xs:maxLength value="30"/>
48 </xs:restriction>
49 </xs:simpleType>
50 <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
51 <xs:sequence>
52 <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
53 <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
54 <xs:sequence>
55 <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
56 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
57 </xs:sequence>
58 </xs:complexType>
59 </xs:element>
60 </xs:sequence>
61 </xs:complexType>
62 <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
63 <xs:all>
64 <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
65 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
66 <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
67 </xs:all>
68 </xs:complexType>
69 <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
70 <xs:sequence>
71 <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
72 <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
73 <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
74 </xs:sequence>
75 </xs:complexType>
76 <xs:simpleType name="moneyType">
77 <xs:restriction base="xs:decimal">
78 <xs:fractionDigits value="2"/>
79 <xs:totalDigits value="12"/>
80 </xs:restriction>
81 </xs:simpleType>
82 <xs:simpleType name="quantityType">
83 <xs:restriction base="xs:decimal">
84 <xs:fractionDigits value="4"/>
85 <xs:totalDigits value="8"/>
86 </xs:restriction>
87 </xs:simpleType>
88 <xs:simpleType name="UserType">
89 <xs:restriction base="xs:string">
90 <xs:minLength value="1"/>
91 <xs:maxLength value="10"/>
92 </xs:restriction>
93 </xs:simpleType>
94 <xs:simpleType name="RequestorType">
95 <xs:restriction base="xs:string">
96 <xs:minLength value="0"/>
97 <xs:maxLength value="128"/>
98 </xs:restriction>
99 </xs:simpleType>
100 <xs:simpleType name="CostCenterType">
101 <xs:restriction base="xs:string">
102 <xs:minLength value="1"/>
103 <xs:maxLength value="4"/>
104 </xs:restriction>
105 </xs:simpleType>
106 <xs:simpleType name="VendorType">
107 <xs:restriction base="xs:string">
108 <xs:minLength value="0"/>
109 <xs:maxLength value="20"/>
110 </xs:restriction>
111 </xs:simpleType>
112 <xs:simpleType name="PurchaseOrderNumberType">
113 <xs:restriction base="xs:integer"/>
114 </xs:simpleType>
115 <xs:simpleType name="SpecialInstructionsType">
116 <xs:restriction base="xs:string">
117 <xs:minLength value="0"/>
118 <xs:maxLength value="2048"/>
119 </xs:restriction>
120 </xs:simpleType>
121 <xs:simpleType name="NameType">
122 <xs:restriction base="xs:string">
123 <xs:minLength value="1"/>
124 <xs:maxLength value="20"/>
125 </xs:restriction>
126 </xs:simpleType>
127 <xs:simpleType name="AddressType">
128 <xs:restriction base="xs:string">
129 <xs:minLength value="1"/>
130 <xs:maxLength value="256"/>
131 </xs:restriction>
132 </xs:simpleType>
133 <xs:simpleType name="TelephoneType">
134 <xs:restriction base="xs:string">
135 <xs:minLength value="1"/>
136 <xs:maxLength value="24"/>
137 </xs:restriction>
138 </xs:simpleType>
139 <xs:simpleType name="DateType">
140 <xs:restriction base="xs:date"/>
141 </xs:simpleType>
142 <xs:simpleType name="CommentsType">
143 <xs:restriction base="xs:string">
144 <xs:minLength value="1"/>
145 <xs:maxLength value="2048"/>
146 </xs:restriction>
147 </xs:simpleType>
148 <xs:simpleType name="DescriptionType">
149 <xs:restriction base="xs:string">
150 <xs:minLength value="1"/>
151 <xs:maxLength value="256"/>
152 </xs:restriction>
153 </xs:simpleType>
154 </xs:schema>
155 ');
156 begin
157 if (dbms_xdb.existsResource(:schemaPath)) then
158 dbms_xdb.deleteResource(:schemaPath);
159 end if;
160 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
161 end;
162 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,FALSE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> create or replace view PURCHASEORDER_XML
2 of xmltype
3 xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
4 with object id
5 (
6 substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
7 )
8 as
9 select xmlElement
10 (
11 "PurchaseOrder",
12 xmlAttributes
13 (
14 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
15 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
16 ),
17 xmlElement("Reference",p.REFERENCE),
18 xmlElement
19 (
20 "Actions",
21 ( select xmlAgg
22 (
23 xmlElement
24 (
25 "Action",
26 xmlElement("User",ACTIONEDBY),
27 case
28 when DATEACTIONED is not null
29 then xmlElement("Date",DATEACTIONED)
30 end
31 )
32 )
33 from PURCHASEORDER_ACTION a
34 where a.REFERENCE = p.REFERENCE
35 )
36 ),
37 xmlElement
38 (
39 "Reject",
40 xmlForest
41 (
42 REJECTEDBY as "User",
43 DATEREJECTED as "Date",
44 COMMENTS as "Comments"
45 )
46 ),
47 xmlElement("Requestor",REQUESTER),
48 xmlElement("User",USERID),
49 xmlElement("CostCenter",COSTCENTER),
50 xmlElement
51 (
52 "ShippingInstructions",
53 xmlElement("name",SHIPTONAME),
54 xmlElement("address",ADDRESS),
55 xmlElement("telephone",PHONE)
56 ),
57 xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
58 xmlElement
59 (
60 "LineItems",
61 ( select xmlAgg
62 (
63 xmlElement
64 (
65 "LineItem",
66 xmlAttributes(LINENO as "ItemNumber"),
67 xmlElement("Description",DESCRIPTION),
68 xmlElement
69 (
70 "Part",
71 xmlAttributes
72 (
73 UPC as "Id",
74 QUANTITY as "Quantity",
75 UNITPRICE as "UnitPrice"
76 )
77 )
78 )
79 )
80 from PURCHASEORDER_LINEITEM l
81 where l.REFERENCE = p.REFERENCE
82 )
83 )
84 )
85 from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
86 where r.REFERENCE = p.REFERENCE
87 and s.REFERENCE = p.REFERENCE
88 /
View created.
SQL> set long 10000 pages 0 lines 140
SQL> --
SQL> select x.object_value.extract('/*')
2 from PURCHASEORDER_XML x
3 /
<PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Reference>SMCCAIN-20030109123335470PDT</Reference>
<Actions>
<Action>
<User>SVOLLMAN</User>
</Action>
</Actions>
<Reject/>
<Requestor>Samuel B. McCain</Requestor>
<User>SMCCAIN</User>
<CostCenter>A10</CostCenter>
<ShippingInstructions>
<name>Samuel B. McCain</name>
<address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
<telephone>650 506 7800</telephone>
</ShippingInstructions>
<SpecialInstructions>Courier</SpecialInstructions>
<LineItems>
<LineItem ItemNumber="1">
<Description>Life of Brian - Monty Python's</Description>
<Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="2">
<Description>The Night Porter</Description>
<Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="3">
<Description>Oliver Twist</Description>
<Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="4">
<Description>Notorious</Description>
<Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="5">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="6">
<Description>Alphaville</Description>
<Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="7">
<Description>General Idi Amin Dada</Description>
<Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="8">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="9">
<Description>Flesh for Frankenstein</Description>
<Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="10">
<Description>The Killer</Description>
<Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="11">
<Description>Ballad of a Soldier</Description>
<Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="12">
<Description>Ordet</Description>
<Part Id="37429158623" Quantity="2" UnitPrice="0"/>
</LineItem>
</LineItems>
</PurchaseOrder>
SQL> begin
2 for x in (select object_value from PURCHASEORDER_XML) loop
3 x.object_value.schemaValidate();
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> -
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? -
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 -
Anyone register the full ACORD P&C XML schema in XDB?
Hi -
We are attempting to use Oracle’s XDB in a new project and are experiencing some issues. I am wondering if anyone has any experience with the following and could share or enlighten us as to the cause of our troubles.
We have two test servers set up (10gR1 & 11gR1) and are trying to register the ACORD P&C XML Schema. It is a very large schema and it references a number of other NS and DTD’s.
The most recent attempts to register this schema have resulted in out of memory errors.
Has anyone registered the ACORD P&C XML Schema in Oracle Xdb? 10g or 11g?
Has anyone attempted to register a schema that is 12 to 20MB in size?
While, the schema is very large, the XML documents will only implement a small portion of it and should be small in size, <1MB. We need to perform Inserts, Updates and Deletes on the XDB data in addition to Selects joining this data to relational tables. It appears that structured storage fits this scenario the best. However, if someone has had some practical experience with both structured and unstructured and can share their thoughts, that would be helpful as well.
I'm hoping someone has already faced and resolved this issue.
Thanks in advance for any help!
Mike
Edited by: mriley99 on Sep 30, 2009 8:45 AMYour best place to ask this question would be the {forum:id=34} forum since that is for XML DB related questions. I would also information regarding how you are registering the schemas and the exact error(s) you are getting.
-
Cannot see registered XML schema in user_objects
Hi,
I noticed that XML schema that I register do not appear in the user_objects view. But they appear in the all_objects view.
Joining all_objects with all_xml_schemas each XML schema appears to have two owners, the owner XDB and the account used to register the schema.
select schema_url,X.owner xml_owner,O.owner object_owner
from all_xml_schemas X, all_objects O
where int_objname = object_name
SCHEMA_URL XML_OWNER OBJECT_OWNER
ts-csg.com/group_alertAscii.xsd OPS$PHITCHMAN XDB
ts-csg.com/group_applicationId.xsd OPS$PHITCHMAN XDB
ts-csg.com/group_paraAsciiSimple.xsd OPS$PHITCHMAN XDB
ts-csg.com/group_paragraphAscii.xsd OPS$PHITCHMAN XDB
ts-csg.com/group_paraAscii.xsd OPS$PHITCHMAN XDB
ts-csg.com/group_coreAscii.xsd OPS$PHITCHMAN XDB
ts-csg.com/group_psList.xsd OPS$PHITCHMAN XDBIs this right?
Thanks
PeteUSER_XML_SCHEMAS is the view you need to query.
USER_XML_SCHEMAS describes the registered XML schemas owned by the current user. Its columns (except for OWNER) are the same as those in ALL_XML_SCHEMAS.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_4491.htm#REFRN26307
Maybe you are looking for
-
Can I use the same user accounts for both Lion & SL?
I have one Mac that I can upgrade to Lion but it is the one that the entire family uses every day (I only can use it (and administer it) on weekends), so I have to make sure that there are no problems and no issues so my plan is to: Move all of the u
-
Short-cut key to rotate current page
In Acrobat Pro 9, Is there a single key stroke to rotate current page clockwise/counter clockwise 90°? Not Shift+Ctrl-R, because you have to select some parametes. It is not a single key stroke. If not, then how to do that by some ways, e.g., macro,
-
Better format for the AppDefinition XML file
Hello, We are using CVS as our source control and are having some problems with the merge process on a AppDefinition file. Is there a way to achieve a better-readable format (i.e. shorter lines, better element indentation, perhaps even attributes ind
-
I am trying to create an html file for access by a client computer through the LabVIEW Web Server. I want to enable the client to control the vi, so am chosing "Embedded" for the Viewing Option in the Web Publishing Tool. The small preview screen in
-
Hardware config and componenets : raid, gpu and monitor choices
Right, I've almost finalised my decisions about a new build I'm putting together to use cs4 design premium prgrammes (mainly photoshop, InDesign, Illustrator, fireworks and flash) and in the near future 3d Max and possibly a video editing programme.