Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XML/XSD question (using ODI)

604709Dec 22 2011 — edited Dec 23 2011
Hi all.
I have posted this in the ODI forum as well, but this may be a more proper place to ask for help.
I'm working on a new dwh solution where the main source of data will come from XML-files. The problem is that we are having difficulties with the use of abstract types in the xsd-file. We currently use ODI to read the XML-files and to store the data in our database, but all fields from the XML-files are not visible in the target tables.

The problem can be simplified like this example:

We have a main element, testElement, which can contain one or more publications.
Publication is of type PublicationType, and PublicationType is an abstract that contains title, author and date.
We have four other types which extends PublicationType; BookType, MagazineType, NewspaperType and AdsType. They all contain additional fields.

XSD-file
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:testing:kontroll:example:oppgave:v1"
xmlns:tns="urn:testing:kontroll:example:oppgave:v1"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="qualified">
<element name="testElement" type="tns:TestElementType" xdb:defaultTable="TEST_TAB" />
<complexType name="TestElementType">
<sequence>
<element name="publication" type="tns:PublicationType" minOccurs="1"
maxOccurs="unbounded" />
</sequence>
</complexType>
<complexType name="PublicationType" abstract="true">
<sequence>
<element name="title" type="string"/>
<element name="author" type="string" minOccurs="0"
maxOccurs="unbounded" />
<element name="date" type="string"/>
</sequence>
</complexType>
<complexType name="BookType">
<complexContent>
<extension base="tns:PublicationType">
<sequence>
<element name="ISBN" type="string"/>
<element name="publisher" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="MagazineType">
<complexContent>
<extension base="tns:PublicationType">
<sequence>
<element name="editor" type="string"/>
<element name="period" type="string" minOccurs="0"
maxOccurs="1"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="NewspaperType">
<complexContent>
<extension base="tns:PublicationType">
<sequence>
<element name="daily" type="boolean"/>
<element name="owner" type="string" minOccurs="0"
maxOccurs="1"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="AdsType">
<complexContent>
<extension base="tns:PublicationType">
<sequence>
<element name="company" type="string"/>
<element name="article" type="string" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>

XML-file
<?xml version="1.0" encoding="UTF-8"?>
<tns:testElement xmlns:tns="urn:testing:kontroll:example:oppgave:v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:testing:kontroll:example:oppgave:v1 ExampleXMLSchema.xsd ">
<tns:publication xsi:type="tns:BookType">
<tns:title>Boken</tns:title>
<tns:author>Arne Svendsen</tns:author>
<tns:date>2001</tns:date>
<tns:ISBN>78979797</tns:ISBN>
<tns:publisher>The Company Ltd</tns:publisher>
</tns:publication>
<tns:publication xsi:type="tns:MagazineType">
<tns:title>Fancy Magazine</tns:title>
<tns:author>Mads Madsen</tns:author>
<tns:date>2011</tns:date>
<tns:editor>Svante Svantesen</tns:editor>
<tns:period>weekly</tns:period>
</tns:publication>
</tns:testElement>

When tables are generated in the database through ODI I'm not getting all the attributes present in the xml-file.
Can anybody tell me if this should work (and, if yes, why it doesn`t)? Or if the XSD/XML looks wrong in some way?
Is this a known limitation in Oracle or ODI etc.?
Any pointers to documentation describing similar problems would also be helpful.

Thanks,
Bjørn
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 20 2012
Added on Dec 22 2011
5 comments
1,207 views