Defining entities using XML schema
Hi,
We have defined an XML schema for our data by converting a DTD, but I cannot figure out how to allow for entity definitions that
are non-standard. e.g. we have a entity called "°", defined in the DTD as "°". How would I allow for such entries
in the data when parsing it against a schema?
Thanks
Pete
Hi,
Interesting how the character gets displayed as an actual degree.
The unicode is u00B0.
Any ideas anyone?
Thanks
Pete
Similar Messages
-
Defining entities with XML schema
Hi,
I came across a problem with XML schema's apparent lack of support for entities. e.g. we define an entity like this:
<!ENTITY le "≤" >.
First off I was trying in my XML instance to include an external entity file like this:
<!DOCTYPE wpi [
<!ENTITY % DerwentXmlEntities PUBLIC "-//Derwent//Derwent XML General ENTITIES 20000214//EN"
"derwent-xml-entities.ent">
%DerwentXmlEntities;
]>
<WPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.derwent.co.uk/wpi.xsd">
but I am not clear on where I should place the file derwent-xml-entities.ent. Everything I tried ended up with:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00202: could not open file "derwent-xml-entities.ent"
Is it possible to include a file like this?
So I tried just defining an entity like this:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE wpi [
<!ENTITY times "×">
<!ENTITY le "≤">
]>
The "times" seems OK, but for "le" I get:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00217: invalid character 8804 (\u2264)
What sort of encoding should I use?
Thanks
Pete<xsd:element name="PsL">
<xsd:annotation>
<xsd:documentation>
**Pseudo List, required as in D-types, the editors often used the
{H control sequence to force an indent to make lists of compounds more
legible. We can't be sure that they are always lists but there is
useful mark-up there that we wouldn't want to lose**
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="PsE" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PsE">
<xsd:annotation>
<xsd:documentation>
Pseudo List Entry
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="PsP" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="PsS" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PsP">
<xsd:annotation>
<xsd:documentation>
Pseudo List Prefix
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="PsP" type="xsd:string"/>
<xsd:element ref="Sub" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Sup" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Em" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="PsS">
<xsd:annotation>
<xsd:documentation>
Pseudo List Suffix
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="PsS" type="xsd:string"/>
<xsd:element ref="Sub" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Sup" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Em" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="Prt">
<xsd:annotation>
<xsd:documentation>
************************ Part Container Element **************
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="PrtNo" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="PrtNm" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PrtNo">
<xsd:annotation>
<xsd:documentation>
PartNo
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="PrtNo" type="xsd:string"/>
<xsd:element ref="Sub" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Sup" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Em" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
xsd:element name="PrtNm">
<xsd:annotation>
<xsd:documentation>
PartName
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="PrtNm" type="xsd:string"/>
<xsd:element ref="Sub" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Sup" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Em" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="L">
<xsd:annotation>
<xsd:documentation>
************************ List Container Element *************
Attribute typ=used by the composition software to decide how to prefix
the list entries, e.g. (a), (A), (i), (1), etc.
AL for AlphaLower
AU for AlphaUpper
RL for RomanLower
RU for RomanUpper
No for Number
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element ref="LP" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="LS" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="typ" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AL"/>
<xsd:enumeration value="AU"/>
<xsd:enumeration value="RL"/>
<xsd:enumeration value="RU"/>
<xsd:enumeration value="No"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="LP">
<xsd:annotation>
<xsd:documentation>
List Paragraph
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="LP" type="xsd:string"/>
<xsd:element ref="Sub" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Sup" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Em" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="RefD" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="RefF" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="LS">
<xsd:annotation>
<xsd:documentation>
1st level sublist
Attribute typ=used by the composition software to decide how to prefix
the list entries, e.g. (a), (A), (i), (1), etc.
AL for AlphaLower
AU for AlphaUpper
RL for RomanLower
RU for RomanUpper
No for Number
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element ref="LP" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="LSS" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="typ" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AL"/>
<xsd:enumeration value="AU"/>
<xsd:enumeration value="RL"/>
<xsd:enumeration value="RU"/>
<xsd:enumeration value="No"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="LSS">
<xsd:annotation>
<xsd:documentation>
2nd level list
Attribute typ=used by the composition software to decide how to prefix
the list entries, e.g. (a), (A), (i), (1), etc.
AL for AlphaLower
AU for AlphaUpper
RL for RomanLower
RU for RomanUpper
No for Number
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="LP" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="typ" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AL"/>
<xsd:enumeration value="AU"/>
<xsd:enumeration value="RL"/>
<xsd:enumeration value="RU"/>
<xsd:enumeration value="No"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="IndexingCorePt">
<xsd:annotation>
<xsd:documentation>
******** ROOT ELEMENT for Core Patent Indexing *********
** Indexing is composed of Derwent Classification (DC),IPCs,
Fragmentation Coding (Frags), Polymer Indexing, Unlinked Registry numbers
and Keyword Indexing (KI).
Any combination is these three elements is allowed.
Attribute vs =Version number starting at 0
Attribute co =Patent country
Attribute se =Patent serial
Attribute ki =Patent Kind
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="DC" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="IPCs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="Frag" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="Polymer" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="IdxU" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="KI" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="vs" type ="xsd:NMTOKEN" use="optional"/>
<xsd:attribute name="co" type ="xsd:NMTOKEN" use="required"/>
<xsd:attribute name="se" type ="xsd:NMTOKEN" use="required"/>
<xsd:attribute name="ki" type ="xsd:NMTOKEN" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DC">
<xsd:annotation>
<xsd:documentation>
************* DERWENT CLASSIFICATION *******************
** Derwent Classification is divided in 3 main areas:
Chemical(CPI),General & Mechanical (EngPI),
Electronic & Electronical (EPI)
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="CPIs" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="EngPIs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="EPIs" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="EngPIs" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="EPIs" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:element ref="EPIs" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="CPIs">
<xsd:annotation>
<xsd:documentation>
UNIQUE ELEMENT DC
** Container element for CPI**
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="CPI" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CPI">
<xsd:annotation>
<xsd:documentation>
UNIQUE ELEMENT CPIs
** CPI is composed of sections A to N (no section I)
Any combination is allowed, there has to be at least one section.
No section can appear twice. The DTD does not enforce this.
Section N can't be on his own. The DTD does not enforce this.
Each single Chemical section is composed of one main class (DCCM)
and zero to many secondary classes (DCCSs). One to many Manual
code (MCCs) has to be applied to a given chemical section.
Attribute section= an allowed Derwent CPI section **
Note that content MCCs is optional as its optional in the backfile
before 19??
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="DCCM" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="DCCSs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="MCCs" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:element ref="MCCs" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
<xsd:attribute name="sct" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="A"/>
<xsd:enumeration value="B"/>
<xsd:enumeration value="C"/>
<xsd:enumeration value="D"/>
<xsd:enumeration value="E"/>
<xsd:enumeration value="F"/>
<xsd:enumeration value="G"/>
<xsd:enumeration value="H"/>
<xsd:enumeration value="J"/>
<xsd:enumeration value="K"/>
<xsd:enumeration value="L"/>
<xsd:enumeration value="M"/>
<xsd:enumeration value="N"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="DCCM" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
** Derwent Class Chemical Main element **
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="DCCSs">
<xsd:annotation>
<xsd:documentation>
** Derwent Classes Chemical Secondary Container element**
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="DCCS" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DCCS" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
** A Derwent Class Chemical Secondary (DCCS) **
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="MCCs">
<xsd:annotation>
<xsd:documentation>
** Manual Codes CPI Container Element **
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="MCC" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MCC" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
** A Manual Code CPI **
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="EngPIs">
<xsd:annotation>
<xsd:documentation>
**General & Mechanical Sections Container element**
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="EngPI" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EngPI">
<xsd:annotation>
<xsd:documentation>
UNIQUE ELEMENT EngPIs
** General & Mechanical Sections EngPI is composed of sections
P and Q. Any combination is allowed, with at least one section.
There are no manual codes for these sections.
Each single EngPI section is composed of
one or more Derwent Class Engineering (DCEng) elements.
No section can appear twice. The DTD does not enforce this.
Attribute section= an allowed Derwent EngPI section **
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="DCEngs" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="sct" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="P"/>
<xsd:enumeration value="Q"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="DCEngs">
<xsd:annotation>
<xsd:documentation>
** Derwent Class Engineering Container eement **
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="DCEng" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DCEng" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
** Derwent Class Engineering **
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="EPIs">
<xsd:annotation>
<xsd:documentation>
** Electronic & Electrical Sections EPI **
Container element for EPI
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="EPI" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EPI">
<xsd:annotation>
<xsd:documentation>
UNIQUE ELEMENT EPIs
** EPI is composed of sections R to X. Any combination is allowed,
with at least one section.
Section R can't be on his own. The DTD does not enforce this.
Each single is composed of one or more Derwent Class Electronic
and Electrical (DCE) elements.
No section can appear twice. The DTD does not enforce this. **
Attribute sct = an allowed Derwent EPI section
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="EPIgp" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="sct" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="R"/>
<xsd:enumeration value="S"/>
<xsd:enumeration value="T"/>
<xsd:enumeration value="U"/>
<xsd:enumeration value="V"/>
<xsd:enumeration value="W"/>
<xsd:enumeration value="X"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="EPIgp">
<xsd:annotation>
<xsd:documentation>
** A Container element to group the related DCE & MCEs elements **
Note that content MCEs is optional as its optional in the backfile
before 19??
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="DCE" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="MCEs" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DCE" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
** Derwent Class Electronic & Electrical (DCE) contains
Manual Codes Electronic & Electrical (MCE) **
** Derwent Class EPI **
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="MCEs">
<xsd:annotation>
<xsd:documentation>
** Manual Codes EPI container element **
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="MCE" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MCE" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
** A Manual Code EPI **
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="IPCs">
<xsd:annotation>
<xsd:documentation>
********************IPCs Container element *************
** The following xlink construct is a link to the IPC codes on
the WIPO site, this could be added to the DTD to provide the link
without adding any thing to the individual instances
xlink:type (locator) #FIXED "locator"
xlink:rl NMTOKEN #FIXED "IPCs"
xlink:href CDATA #FIXED "http://classifications.wipo.int/fulltext/new_ipc/"
xlink:title CDATA #FIXED "IPC Codes" **
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="IPC" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="IPC">
<xsd:annotation>
<xsd:documentation>
UNIQUE ELEMENT IPCs
** An IPC Code **
** Attribute rnk= Derwent assigned character to indicate type
of IPC:
A= Main IPC
B= Other, unlinked IPCs
C to Y = Linked IPCs and Index Terms
Z= IPC Index Terms
-= Additional terms **
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="rnk" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="A"/>
<xsd:enumeration value="B"/>
<xsd:enumeration value="C"/>
<xsd:enumeration value="D"/>
<xsd:enumeration value="E"/>
<xsd:enumeration value="F"/>
<xsd:enumeration value="G"/>
<xsd:enumeration value="H"/>
<xsd:enumeration value="I"/>
<xsd:enumeration value="J"/>
<xsd:enumeration value="K"/>
<xsd:enumeration value="L"/>
<xsd:enumeration value="M"/>
<xsd:enumeration value="N"/>
<xsd:enumeration value="O"/>
<xsd:enumeration value="P"/>
<xsd:enumeration value="Q"/>
<xsd:enumeration value="R"/>
<xsd:enumeration value="S"/>
<xsd:enumeration value="T"/>
<xsd:enumeration value="U"/>
<xsd:enumeration value="V"/>
<xsd:enumeration value="W"/>
<xsd:enumeration value="X"/>
<xsd:enumeration value="Y"/>
<xsd:enumeration value="Z"/>
<xsd:enumeration value="-"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="Frag">
<xsd:annotation>
<xsd:documentation>
***************BCE INDEXING OR FRAGMENTATION ************
** Fragmentation Container element**
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="FragSub" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="FragSub">
<xsd:annotation>
<xsd:documentation>
UNIQUE ELEMENT Frag
** Fragmentation Sub heading **
** Attribute sjct=The main BCE chemical subject categories
defined by Derwent as subsets. The subsets are designated by the
subheadings MO through M6:
MO Agricultural, pharmaceutical 1963-1969
M1 Agricultural, pharmaceutical natural products
and polymers 1970 to present
M2 Agricultural, pharmaceutical 1970 to present
M3 General chemicals 1970 to present
M4 Dyes 1970 to present
M5 Steroids 1963 to present
M6 Galenicals 1976 to present"**
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="CardRec" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="sjct" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="M0"/>
<xsd:enumeration value="M1"/>
<xsd:enumeration value="M2"/>
<xsd:enumeration value="M3"/>
<xsd:enumeration value="M4"/>
<xsd:enumeration value="M5"/>
<xsd:enumeration value="M6"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="CardRec">
<xsd:annotation>
<xsd:documentation>
** Card Record **
Attribute no =Derwent assigned record number
Attribute mc = Markush DARC Control Code
Attribute trc = Fragmentaion Control Time ranging codes:
M900 Pre-1970
M901 1970-1971
M902 1972-1981 (8126)
M903 1981 (8127) onward
M905
Attribute rn = 910 Codes generated from registry numbers.
Only searchable from 1981
Attribute wd = 911 Wide Disclosure. Only searchable from 1981
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element ref="FCodes" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="RINs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="SCNs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="MCNs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DRNs" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DCRs" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
-
Can't i use xml schema and oledb data connection at the same time?
Hello to all and thanks in advance.I use xml schema and oledb data connection at the same time and the problem is that when I try to export the xml, the outcome is not what i expect.Without the oledb connection everything is ok (just the schema) and the xml complies with the schema.
Can't i have both schema and oledb and the exported xml be as i want it?You can use both at the same time, but not gor Internet access if that's what you're asking.
Now there is a thing called Link Aggregation, which combines a number of interfaces for speed/redundancy, but it really only works locally, and then only with ALL special equipment in the route, and most likely OSX Server involved.
Sorry. -
PL/SQL web service - how to use XML schema to define inputs/outputs?
Hello,
let us say I want to publish a PL/SQL web service. The package spec that I want to expose is:
CREATE OR REPLACE PACKAGE myWebService AS
FUNCTION loadResults(
username IN VARCHAR2,
password IN VARCHAR2,
resultData IN XMLType)
RETURN XMLType;
END;When I use JDeveloper's wizard to publish my PL/SQL web service, the resulting WSDL contains this:
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://uk/co/weatherbys/aapws/AAPWS.wsdl/types/"
targetNamespace="http://uk/co/weatherbys/aapws/AAPWS.wsdl/types/"
elementFormDefault="qualified">
<element name="loadresultsElement">
<complexType>
<sequence>
<element name="username" type="string" nillable="true"/>
<element name="password" type="string" nillable="true"/>
<element name="resultdata" nillable="true">
<complexType>
<sequence>
<any/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="loadresultsResponseElement">
<complexType>
<sequence>
<element name="result" nillable="true">
<complexType>
<sequence>
<any/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>It is specifying that anything at all can be passed in and out from the two XMLType arguments, which is fair enough: it has no way of knowing what I am expecting and what I shall return.
My question is, how do I tell JDeveloper that actually I want either or both of those XMLTypes to conform to a particular XML schema?You cannot format the date as a string, unless you do the conversion on the PL-SQL side, before you use it in your WebService mapping. It should be handled as a string.
The only way to convert the XML from SOAP, using this encoding, into literal XML is to apply XSLT to the payload. Not sure why you would like to do this, as the payload should be consumed by another SOAP-awared stack.
Hope this helps,
Eric -
Using xml schema problem (SAP MDM 7.1 Syndicator)
Good day !
I try to syndicate directory which correspond to some xml-schema and I have a problem.
I want to syndicate data from hierarchy table which have one field which have a type like lookup <Flat> (multivalued).
In XML-schema element "DEF_PRODUCT" and "DEF_PRODUCT_CODE" - attribute presents hierarchy table.
"CREDIT_PRODUCT" and childs presents linked flat table.
According idea and business rules I must get the result like this: each "DEF_PRODUCT" have N-"CREDIT_PRODUCT". One - to- many.
But when I set up all map completely and look to xml result file I start to be disappointed.
XML result file approximately must be like this:
<DEF_PRODUCT>
<CREDIT_PRODUCT/>
<CREDIT_PRODUCT/>
<CREDIT_PRODUCT/>
</DEF_PRODUCT>
but in result I have all <CREDIT_PRODUCT> in one node and child attributes.
I attach 3 pics which explain my situation.
xml-schema :[http://xmages.net/storage/10/1/0/6/3/upload/42ca6ca8.jpg]
field mapping: [http://xmages.net/storage/10/1/0/6/a/upload/bbbc09f2.jpg]
example: [http://xmages.net/storage/10/1/0/c/c/upload/817b0e23.jpg]
Anybody can help me?
About software : SAP MDM 7.1 (7.1.04.139)
P.S: My problem can be resolved succesfully if I will use 1 <main> table and 1 <qualified flat> table.
But in my case I must use hierarchy - structure because it most usable for business - users>
Christian Heuer wrote:
> Hi,
>
> now I understood and you really have got a point here. But the question is whether you need key mapping then on the remote key level with a tuple anymore. If yes, you won
>
> Best regards
> Christian
If SAP MDM will present many opportunities to me I will be very glad.
I repeat I must get output xml which have the pair like "RemoteKey"="RemoteSystem" in tuple subnode.
In tuple, after your advices.
Ideally, Syndicator must present to each user ability to choose pair "RemoteKey" = "RemoteSystem" in each subnode like <LookUp> table in root (look at my example pic).
Imagine you have one root table and N-linked <lookup> tables.
Tree like this :
<main tbl>
<subtbl1/>
<subtbl2/>
<subtbl3>
<childtbl1/>
<childtbl2/>
</subtbl3>
</main tbl>
It's dangerous to deprive SAP MDM user to select pair "RemoteKey" = "RemoteSystem" from ROOT to ALL and LAST LEAF in abstract hierarchy. How do you think ?
Now, I haven't abilities to solve my problem using standard resources. Really ? -
Using XML schema in a Java application
Hi,
I need to parse and use an XML schema in an application, mainly for helping a user to build an XPATH.
For that, I want to use the Schema classes bundled with Oracle's parser. Is there any documentation about that ? Or are the source code available ?
Thank's
Phil.See the JavaHelp article on my site.
I had developers saying they had to have JavaHelp for their
Java application. After discussion we established that for where
this was going to be used, webhelp was just as acceptable. Being
easier for us that won the day. -
Generating a XML using XML Schema
Hi,
I have a requirement where I need to generate a XML which should follow XML Schema. If XML schema changes, i should still be able to generate XML file. Any sample code or idea will help me.http://java.sun.com/webservices/jaxb/users-guide/jaxb-using.html
This tutorial is a good place to start. ideally you will use the xjc.bat file present in
jwsdp-2.0 (thats whaty i use) to generate a package full of classes that corresponds to your
schema.
Use ANT-build script to generate this package then you will do some marshalling
followed by validating against a DTD, and unmarshalling - to do get java objects out of XML -
Xform validation by using Xml-schema
Hello,
I want to validate XForm by using XForm Schema. In an xform example attached below , there are two input fields zip and zip2.
I am not getting why zip in xform attached below cannot be validated.But zip2 is working fine. I am using mozilla firefox browser.
XForm and XMLSchema is attached below.
XForm is
<?xml version="1.0" encoding="UTF-8"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ftype="http://www.example.com/my-file-types">
<head>
<title>Validate Postal Codes</title>
<style type="text/css">
@namespace xf url("http://www.w3.org/2002/xforms");
xf|input {
display: table-row;
line-height: 2em;
xf|label {
display: table-cell;
text-align: right;
font-family: Arial, Helvetica, sans-serif;;
font-weight: bold;
padding-right: 5px;
width: 150px;
*:required {
background-color: yellow;
*:invalid {
background-color: pink;
</style>
<xf:model schema="schema.xsd">
<xf:instance>
<data xmlns="http://www.example.com/my-file-types">
<zip/>
<zip2/>
</data>
</xf:instance>
<xf:bind id="zip" required="true()" type="ftype:zipType" nodeset="ftype:zip" />
<xf:bind id="zip2" required="true()" type="ftype:zip2Type" nodeset="ftype:zip2" />
</xf:model>
</head>
<body>
<xf:input bind="zip" incremental="true">
<xf:label>Zip Code: </xf:label>
<xf:hint>Validation is not correctly specified for this field</xf:hint>
<xf:alert>The 'Zip Code' failed to validate!</xf:alert>
</xf:input>
<xf:input bind="zip2" incremental="true">
<xf:label>Zip Code 2: </xf:label>
<xf:hint>Validation is correctly specified for this field</xf:hint>
<xf:alert>
<xf:output value="concat('The "', name(), '" failed to validate!')" />
</xf:alert>
</xf:input>
</body>
</html>--------------------------------------------------------------------------------
And XML Schema is
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ftype="http://www.example.com/my-file-types" targetNamespace="http://www.example.com/my-file-types" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element name="zipType">
<xs:simpleType id="zipType">
<xs:restriction base="xs:string">
<xs:enumeration value="b"/>
<xs:enumeration value="computer"/>
<!-- bad pattern: matches any sequence of 5 digits, even if there are more digits or non-numeric. -->
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="zip2Type">
<xs:restriction base="xs:string">
<xs:pattern value="^\d{2}$"/>
<!-- good pattern: matches only 2 digits, nothing extra -->
</xs:restriction>
</xs:simpleType>
</xs:schema>Looking for some reply.
Best Regards
TabbasumHi Otto,
The form data output directly send to the PI system via Email.
But we change the interface field names closer to PI requirement.
Thanks for your response.
I am closing this thread.
Cheers
Sam -
XML generation with SAP data using XML schema - Reg
Hello experts,
My requirement is , SAP( ztable data ) data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
Generating XML file with their Schema should be underlined.
I studied that call transformation statement helps for this.
Even then i don't have clear idea about this topic.
Please brief me about how to use their XML schema to generate XML with my own sap data.
Thanks in advance experts.
Kumarplease try this same program and see it ....
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:temporders_dtd.xml'.
* Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
* wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
size = l_xml_table_size ).
* Creating a document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
* Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
* upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
* attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
* advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
reward points if it is use fulll ....
Girish -
Using XML Schema in SFP.
Hi..
We have requirement to send the form output in xml file.
The xml file has been picked up PI system and post it in SAP.
But the PI conversion routine looking for specific field names which are usually more than 30 Char. length.
So its not possible to go for DDIC interface in SFP. rather we are thinking of going for a xml schema based interface.
Calling an XSLT routine to swap the field names required by the PI system.
one more thing is we also have some default values populated in the form fields which is also should be populated in the new xml fields.
Is XSLT routine is a solution for this issue ?! or any other ideas ?
Thanks
SamHi Otto,
The form data output directly send to the PI system via Email.
But we change the interface field names closer to PI requirement.
Thanks for your response.
I am closing this thread.
Cheers
Sam -
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> -
Specifying Case-Insensitive Element Names in XML Schema
Hope someone knows this!
Is it possible to define an an XML Schema Definition so that Element names in the target XML File can be case insensitive.
At the moment my Parser throws an error if the element names in the XML file do not have the exact same case as the definition in the XML schema.
E.g
In Schema i have:
<xsd:element name="HOSTINVENTORYLINE" type="HostInventoryLineType" maxOccurs="unbounded" minOccurs="0"/>
but in xml file i have
<HostInventoryLine field=""/>
or
<hostinventoryline field=""/>
Does anyone know anyway to get around this, so that the parser accepts the HostInventoryLine element in the xml as an instance of the HOSTINVENTORYLINE element defined in the schema.
Thanks in Advance
JJ
Message was edited by:
[email protected]You could use substitution groups to handle this. You would need an entry in the schema for each valid capitalization. This won't scale well if you want to be completely case insensitive, but if you only support lower case, upper case, and camel case it should do the trick.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="HostInventoryLineType">
<xs:sequence>
<xs:element name="an-element" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="HostInventoryLine" type="HostInventoryLineType"/>
<xs:element name="HOSTINVENTORYLINE" type="HostInventoryLineType" substitutionGroup="HostInventoryLine"/>
<xs:element name="hostinventoryline" type="HostInventoryLineType" substitutionGroup="HostInventoryLine"/>
</xs:schema>-Blaise -
Issues faced with XML (Objt-Rel) - Plan to move to Binary XML (schema-less)
Hi All,
Our Production DB has Oracle XMLDB implementation using 9 XMLDB Object-Relational
Tables. These have been implemented almost since a year, and we faced several issues,
have listed some of the most important ones:
Obviously it is Object-Relational implementation, so we have 4-5 XSDs to start with that
support the Object-Relational schema
1) copyEvolve Issues : Due to changing Business Requirements constantly, we had to constantly
and continuously modify/upgrade XSDs and then use "copyEvolve" to apply new XSDs
Encountered several issues with CopyEvolve
2) "Home-grown" solution to evolve XSD/Schema:
We came up with our own Solution to migrate/evolve XSD schema.
a) Backup all data from 9 XML DB Tables to 9 CLOB Tables (data is thus "dereferenced" and "delinked"
from underlying XSDs
b) Since data is backed up to CLOB Tables, go ahead and drop the entire schema and register
new XSDs and recreate Tables. (GRANTS and PUBLIC SYNONYMS reappled, needless to say)
c) Reload data from backed up CLOB Tables to newly created XMLDB (Obj-Relational) Tables
Above approach (without "copyEvolve") has worked fine so far and helped in each Release/ every migration
With our data sets becoming increasingly huge, downtime is not sufficient to follow this successful, home-grown
approach and as a result we would like to get away from Object-Relational XMLDB Tables altogether.
3) Our Application currently uses XPath heavily on all 9 XMLDB Tables and we understand XPath is already
deprecated by Oracle (as of 11.2.0.2)
We are seriously considering doing the following:
1) Migrate all 9 XMLDB Tables and modify underlying Storage from "Object-Relational" to Binary XML (Schema-less)
2) Modify Appln code with all XPath replaced by corresponding XQuery constructs
3) Replace existing "B-TREE" based Indexes in Object-Relational XMLDB Tables with either a) Indexes on Virtual DB Columns to enforce Primary Key and Unique Constraints and b) XMLIndex on all other Non-Unique Columns instead of
the corresponding "B-TREE" based Indexes
What we hope to achieve with the above:
1) Eliminate XSD Usage completely (and copyEvolve nightmares thereby)
2) Eliminate Usage of XPath totally
3) Better Performance overall :-)
Would like to get some advice and feedback on our Proposed Plan and mainly are we taking the
right direction especially in respect of Performance, Point 3) listed above
Any feedback or tips would be truly appreciated
Regards and Thanks
AuroWRT to XPATH Vs XQuery.
1. XPATH is a subset of XQuery.. Any XPATH expression is, by definition, an example of simple XQuery expression, so XPATH is not depricated.
2. What we are depricateing are the older, oracle specific XML operators (EXTRACT(), EXTRACTVALUE(), EXISTSNODE()), that ONLY support XPATH. We are depricating these in favour of the new SQL/XML operators (XMLTABLE, XMLQUERY, XMLEXISTS) defined by the SQL standards committee. These operators provide support for the full XQquery standard, and implicitly all of the XPATH expressions that were supported by the older operators. This menas we strongly recommned that new code, developed to work with 11g make use of nrw newer operators. Personally I cannot see a point where we would ever consider de-supportting the older operators, we are well aware of how much code makes use of them.
What this means is that any code that is written using the older operators will continue to work, unmodified. However should a bug surface in the use of the older operators, we would strongly recommend that the code in question be migrated to the new operators as part of the remidiation process.
Also, once the initial pain of learning the new syntax is overcome, I truely believe that the new operators result in much more efficient and mantainable code, so taking the time to do code renevation when possible will probably pay off in the long term...
WRT to moving away from Schema-Based OR storage, I would look at the kind of changes you have made to the XML Schema. If they are the kind of changes that would be supported by in-place evolution in 11g then you might want to re-consider this. If, on the other hand you are regularly making changes to the XML schema that are not backwardsly compatable with your older XML Schema then Schema-Based binary XML storeage (which is more flexible than Schema-Based Object-Relational storage) or even non-schema based Binary XML may be a better choice for your applicaiton..
I would experment by registering the oldest version of your XML Schema in 11gR2, and then testing each of the evolutions you have gone through to see if 11GR2 inplace evolution would have managed them. Also, ask yourself do you expect your XML Schema to keep changing so drastically moving forward, or were some of these changes the results of the growing pains associated with learning how to use XML schema effectively. BTW the approach you outline is effectively what CopyEvolve is doing under the covers...
Bear in mind that for the use-cases Object-Relational storage addesses, when all of the XPATH expressions are correctly re-written into SQL operations on the underlying tables, and where the majority of queries end up accessing or updating leaf-level nodes in the XML, it is unlikely that a Binary XML / Unstructured XML Index combination will deliver similar performance. If you are only accesss a small subset of the leaf-level nodes, creating structured XML Indexes that project out the nodes in question may be able to deliver similar performance to an Object-Relational storage model, but you will need to get the index definitions correct.
-Mark
Edited by: mdrake on Mar 7, 2011 7:40 PM -
XML schema together with XHTML
Hi there,
I have the following situation:
I want to create an XML document that contains 2 parts:
a) a XHTML part (it can be either version 1.0 or 1.1 )
b) a non XHTML part that contains some information about the first part - like the location of that content or some other info on different constituents of the first part
The elements of the second part are defined by an XML schema.
My question is how to do this in an elegant manner?
Should I import somehow (I have no idea how) the XHTML schema on the part 2 schema? Or should I deal only on the instance XML file with this issue (if yes - how)?
Thanks a lot for the help.
DanielDownload the newest version at http://xml.apache.org
and try again...Unfortunately I'm already using the latest version. It just doesn't seem to work. -
I was wondering what size restrictions there are on XML schemas? I'm developing a schema that has just raised the following error on registration.
ERROR at line 1:
ORA-31084: error while creating table "CAS"."swift564357_TAB" for element "swift564"
ORA-01792: maximum number of columns in a table or view is 1000
ORA-02310: exceeded maximum number of allowable columns in table
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 151
ORA-06512: at line 828
On removing a few elements from the schema it registers fine, but querying the generated table swift564xxx_TAB there is only ever one column, typed with an ADT that itself only has 5 elements. In fact there doesn't seem to be, on the face of it, any type that has more than 20-30 elements. Where does this error come from then?
Unfortunately the schema exceeds the 20k limit on postings. I can split it up and post it in two parts if this would help.
Thanks
MarcEach attribute in the ADT and each attribute of attributes which are an ADT count as one column
Here's a snippet from the next version of the doc that may help...
3-20 Oracle XML DB Developer’s Guide, Rel. 1(10.1) Beta 2 Draft
A number of issues can arise when working with large, complex XML Schemas.
Sometimes the error "ORA-01792: maximum number of columns in a table or view
is 1000" will be ecountered when registering an XML Schema or creating a table
based on a global element defined by an XML Schema. This error occurs when an
attempt is made to create an XMLType table or column based on a global element
and the global element is defined as a complexType that contains a very large
number of element and attribute definitions.
The errors only occurs when creating an XMLType table or column that uses object
relational storage. When object relational storage is selected the XMLType is
persisted as a SQL Type. When a table or column is based on a SQL Type, each
Registering an XML Schema with Oracle XML DB
attribute defined by the Type counts as a column in the underlying table. If the SQL
Type contains attributes that are based on other SQL Types, the attributes defined
by those Types also count as columns in the underlying table. If the total number of
attributes in all the SQL types exceeds the Oracle limits of 1000 columns in a table
the storage table cannot be created.
This means that as the total number of elements and attributes defined by a
complexType approaches 1000, it is no longer possible to create a single Table that
can manage the SQL Objects generated when an instance of the Type is stored in the
database.
In order to resolve this problem it is necessary to reduce the total number of
attributes in the SQL Types that are used create the storage tables. Looking at the
schema there are two approaches that can be used to achieve this:
The first approach uses a ’top-down’ technique that uses multiple XMLType
tables to manage the XML documents. This technique reduces the number of
SQL attributes in the SQL Type heirarchy for a given storage table. As long as
none of the tables need manage more than 1000 attributes the problem is
resolved.
The second approach uses a ’bottom-up’ technique that reduces the number of
SQL attributes in the SQL Type herirarchy collapsing some of elements and
attributes defined by the XMLSchema so that they are stored as a single CLOB.
Both techniques rely on annotating the XML Schema to define how a particular
complexType will stored in the database.
In the case of the top down techniqueby the annotations SQLInline="false" and
defaultTable are used to force some sub-elements within the XML Document to
be stored as rows in a seperate XMLType table. Oracle XML DB maitains the
relationship between the two tables using a REF of XMLType Good candidates
for this approach are XML Schemas that define a choice where each element
within the choice is defined as a complexType, or where the XML Schema
defines an element based on a complexType that contains a very large number
of element and attribute definitions.
The bottom up technique involves reducing the total number of attributes in the
SQL object types by choosing to store some of the lower level complexTypes as
CLOBs, rather than objects. This is acieved by annotating the complexType or
the usage of the complexType with SQLType="CLOB".
Which technique is best depends on the application, and the kind of queries and
updates that need to be performed against the data.
Maybe you are looking for
-
BO XI 3.1 DeskI report Calculation mismatch in record values
Hi , I have an Calculation issue in one report after migrated from BO 5.1.6 to BO XI 3.1. After refreshing two reports parallelly, BO XI 3.1 report 1st 3 records of two columns are not at all there in BO 5.1.6 report. in XI 3.1 i am getting 3 more re
-
Optical drive Not Recognized in Windows 7??!
Hi All, I'm having problim using iMac 27" 2012 optical drive on windows 7!! I can't find any driver for that with bootcamp package!! Please help, i really need to use it for my work! Thanks ALL
-
Moving to Mac from PC: Question about using external HD
I am trying to figure out how I will move my files from my PC to my new iMac when I get it. This would include favorites/bookmarks, music, document files, pictures, etc. I was looking for clarification regarding the use of an external HD as I have go
-
Reports 9i/10g J2EE Thin Client for Websphere Application Server 5.x /6.x
We are having Reports developed in 6i which needs to be migrated to Reports 9i/10G and we want to deploy these reports in web using Websphere Application Server 5.x /6.x without Oracle iAS. Do we have Reports 9i/10g J2EE Thin Client for Websphere App
-
What i use to develop complex tree and table in my web application?
hi guys simply most of my work in my web application will be depend on: 1-tree 2-table i need this tree and table deal with database table (or even tables) must be able to do every thing like add node/row/column, delete, update, drag-n-drop, various