Mapping rich XML to a single table
In order to support searching and update of documents using plain SQL (a customer requirement), I want to map a rich (multilevel) XML data structure to a single relational table with a structure somewhat like
(ID varchar2(4),
Element_Name varchar2(20),
Element_Data varchar2(20))
I'll use a dot convention for nesting the structure so subelements will have names like:
"subelement.dataelement1"
"subelement.dataelement2"
Problem is this requires some work to turn it back into XML and I cannot use default tools to import and export the results.
Is there a better way to do this?
I want to be able to retrieve xml documents of the form:
<DATAELEMENTNAME>value</DATAELEMENTNAME>
where DATAELEMENTNAME is held in one col of the table and value is held in another col. BUT must be able to support value lists in the resulting document. This will allow a flexible document format while leaving the data searchable and modifyable using standard SQL. The data is mainly of the form
name1:value1
name2:value2
I can afford to store all the values as text and convert later to numbers, dates as required.
I have designed a simple relational table sturcture that can handle XML, in 4 brief tables. Email me [email protected] if interested.
null
Similar Messages
-
Total XML structure into single table field
Hello All,
I want to send total XML structure(including Tags and Data) into single field in a Table.
Ex: <MaterialDetails>
<MaterialNumber>00111</MaterialNumber>
<MaterialQuantity>200</MaterialQuantity>
</MaterialDetails>
Plz Can anyone tell me How to do this indetail?
Thanks
SanGenerate this entire string in a UDF and assign it to the respective element.
VJ -
TopLink Question - Mutliple Object to Single Table mapping
Just a short question,
Does toplink support mapping feature as such that it can map two distinct objects with single table that when in insertion or selection those two objects can be manipulated, selected in single operation? I know that TopLink mapping supports single object from multiple table mapping, but I'm not sure about multiple objects being associated with single table.
Secondly, does Hibernate has something like what I described above?
Howard.Hi Howard,
You can map two objects to a single table if the objects are related by aggregation.
In TopLink, two objectsa source (parent or owning) object and a target (child or owned) objectare related by aggregation if there is a strict one-to-one relationship between them, and all the attributes of the target object can be retrieved from the same data source representation as the source object. This means that if the source object exists, then the target object must also exist, and if the source object is destroyed, then the target object is also destroyed.
http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/tutbuild004.htm#sthref2325
-Blaise -
How to save sections of a single XML Document to multiple tables ?
Firstly, I apologise for the long e-mail but I feel it's necessary in order to clarify my problem/question.
The XML document representation below stores information about a particular database. From the information in the XML document you can tell that there is a single database called "tst" which contains a single table called "tst_table". This table in turn has two columns called "CompanyName" & "Country".
I want to use Oracle's XML SQL Utility to store this information into three seperate database tables. Specifically, I want to store the information pertaining to the database (i.e. name etc.) in one table, the information pertaining to the table (name, no. of columns etc.) in another and the information pertaining to the columns (name, type etc.) in yet another table.
I have seen samples where an entire XML Document is saved to a database table but I cannot find any examples where different sections of a single XML Document are saved into different database tables using the XML SQL Utility.
Can you please tell me the best approach to take in order to accomplish this . Does it involve creating an XMLDocument and then extracting the relevant sections as XMLDocumentFragment's, retrieving the String representations of these XMLDocumentFragment's and passing these strings to the OracleXMLSave.insertXml() method.
Is this the best approach to take or are there any other, perhaps more efficient or elegant, ways of doing this ?
Thanks in advance for your help
- Garry
<DATABASE id="1" name="tst">
<TABLES>
<TABLE name="tst_table">
<NAME>Customers</NAME>
<COLUMNS>
<COLUMN num="1"> <COLID>2</COLID>
<COLNAME>CompanyName</COLNAME>
<COLTYPE>Text</COLTYPE>
</COLUMN>
<COLUMN num="2">
<COLID>3</COLID>
<COLNAME>Country</COLNAME>
<COLTYPE>Text</COLTYPE>
</COLUMN>
</COLUMNS>
</TABLE>
</TABLES>
</DATABASE>
nullSee this thread;
{thread:id=2180799}
Jeff -
Xml to ABAP internal table mapping and schema validation
Hi Experts,
I'm trying to get data from an xml file into internal tables in ABAP. My requirement is to validate xml against an xsd schema, how can i do it?
My other question is, if there are any possible ways to map the fields of a table so that once the xml file is read, the fields automatically get populated depending on the different elements and attributes in the xml file.
-joeHi,
check out :
http://help.sap.com/saphelp_nw70/helpdata/en/fd/9d734b389211d596a200a0c94260a5/frameset.htm
Terry -
How to convert xml file into internal table in ABAP Mapping.
Hi All,
I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
<BookingCode>2KY34R</BookingCode>
- <Passenger>
<Name>SARVESH</Name>
<Address>THANE</Address>
</Passenger>
- <Passenger>
<Name>RAJESH</Name>
<Address>POWAI</Address>
</Passenger>
- <Passenger>
<Name>CARRON</Name>
<Address>JUHU</Address>
</Passenger>
- <Flight>
<Date>03/03/07</Date>
<AirlineID>UA</AirlineID>
<FlightNumber>125</FlightNumber>
<From>LAS</From>
<To>SFO</To>
</Flight>
</ns0:MTO_ABAP_MAPPING>
AT the receiver side I wnat to concatenate the NAME & ADDRESS.
I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
but couldnt succeed to convert the xml file into internal table perfectly.
Can anybody help on this.
Thanks in advance!!
SarveshHi Sarvesh,
The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
Just in case you have not seen this
regards
Vijaya -
HI Everybody,
Could you help me a bit? I've got an XML schema (.xsd) and a corresponding XML document (.xml) file. I've registered the schema with Oracle XDB and loaded the XML document into XDB Repository using the object-relational storage technique. Fine--I can access it from SQL and PL/SQL using XPath. However, this is to be an integral part of a Java EE application, where I must be able to read specific fragments and nodes from my XML table and use the values in my Java classes for computations and to display them in different views. How to preceed? Which technology should I choose to map the table to classes?
In Toplink, I can unmarshal the document but since it is very big, this is no good practice to keep all data in memory. It should behave like an ordinary lookup table (as it is indeed).
Please state if you have an idea.
Thanks in advance, regards
Miklos HERBOLYI have designed a simple relational table sturcture that can handle XML, in 4 brief tables. Email me [email protected] if interested.
null -
Mapping with xml-schema XML-data to relational tables
Hello,
is it possible to map data from xml documents to relational tables with xml-schema?
I mean not in nested tables but in relational tables with primary and foreign keys!
With SQL Server 2005 it is very easy, I dont believe that Oracle couldn't do this!
I searched but i cant find anything about that!
Thx
user445232indeed, oracle does this for xml schema based xmltype data, however, these underlying tables are not accessable to the application. Maybe It should for next version, so folks who like to use relational model can use it without mapping it manually.
Actually, nested tables, are the same, their underlying tables (segments) are indeed relational tables, oracle manages them internally and not visiable to the application. You can find them in the user_segments, user_objects views though. -
How to display appcmd /config xml data into a single table
Hi,
I extracted my IIS sites using appcmd
appcmd /site /config /xml > c:\temp\iisconfig.xml
afterwhich I would like to grab the data from this xml and export into excel file
[xml]$iisconfig = get-content c:\temp\iisconfig.xml
I would like to get the Site Name, Bindings, Physical Directory Path and AppPool from this xml file and output to a excel file
#Physical Path Directory
$iisPhysicalPath = $iisconfig.appcmd.site.site.application.VirtualDirectory.PhysicalPath
#Application Pool
$iisAppPool = $iisconfig.appcmd.site.site.application.applicationPool
#Site Details (Site Name, Binding)
$iisSite = $iisconfig.appcmd.site
It doesn't have a single command to output into a table. How do I combine all these code and display in a single table?
JeronTry it like this:
$sites=[xml](c:\windows\system32\inetsrv\appcmd.exe list site /xml)
$sites.appcmd.site
\_(ツ)_/ -
To load an XML document into 40 tables
How do I load a large XML document into 40 tables. Most of the exmaples, I see only load one table into the Orcale database?
From the above document:
Storing XML Data Across Tables
Question
Can XML- SQL Utility store XML data across tables?
Answer
Currently XML-SQL Utility (XSU) can only store to a single table. It maps a canonical representation of an XML document into any table/view. But of course there is a way to store XML with the XSU across table. One can do this using XSLT to transform any document into multiple documents and insert them separately. Another way is to define views over multiple tables (object views if needed) and then do the inserts ... into the view. If the view is inherently non-updatable (because of complex joins, ...), then one can use INSTEAD-OF triggers over the views to do the inserts.
-- I've tried this, works fine. -
View a single table-row as multiple rows in a GridControl
Hi,
is it possible to distribute the entries of a single row of a table/RowSetInfo over multiple lines of a GridControl?
I've seen an example on the Internet (http://www2.gol.com/users/tame/swing/examples/JTableExamples4.html) which does this without database connection but it seems as if it's necessary to replace the default JTable, TableModel and UI by customized ones. As far as I've seen it's not possible to replace the JTable which is used by a GridControl? So is there any other way to do this? (A modification of the JTable-UI itself doesn't suffice as the JTable yields wrong row- and column-numbers on mousclick-events and therefore the components of the second row are not enabled properly).
Thanks in advance
null|I've seen an example on the Internet |(http://www2.gol.com/users/tame/swing/exampl|es/JTableExamples4.html) which does this |without database connection but it seems as |if it's necessary to replace the default |JTable, TableModel and UI by customized |ones.
You wont be able to replace the JTable. But you can change all the attributes on the internal table which the grid uses (see getTable() method). The datamodel for the grid is impemented by oracle.dacf.control.swing.GridDataSource. You can possibly extend this class. You can also change the Table column model and the renderers used by the Table.
|So is there any other way to do this? (A |modification of the JTable-UI itself doesn't |suffice as the JTable yields wrong row- and |column-numbers on mousclick-events and |therefore the components of the second row |are not enabled properly).
Could you expain how the mapping between cell renderer and the table (row, col) is done in the extended JTable - which class ?.
(http://www2.gol.com/users/tame/swing/exampl|es/JTableExamples4.html)
null -
How to display data from 2 different groups in a single table
Hi,
Following is the requirement:
The XML Content is below
ListOf_ssAssetMgmtAsset>
-<ssAssetMgmtAsset>
<ssAccountName>1-1D09-83031</ssAccountName>
<ssAccountPrimaryCountry>USA</ssAccountPrimaryCountry>
<ssAssetNumber>13111027</ssAssetNumber>
<ssNaiAssetNumber>123</ssNaiAssetNumber>
<ssNaiGrantNumber>ABC</ssNaiGrantNumber>
<ssNaiProductType>System Security Software</ssNaiProductType>
<ssNaiSuperceded>123</ssNaiSuperceded>
<ssProductDescription>Upgrade extract local DB</ssProductDescription>
<ssProductName>1-1M5H-296</ssProductName>
<ssStatus>ABC</ssStatus>
<ssId>1X-ZY</ssId>
<ssCreated>01/01/1980</ssCreated>
<ssUpdated>01/01/1980</ssUpdated>
<ssCreatedBy>1X-ZY</ssCreatedBy>
<ssUpdatedBy>1X-ZY</ssUpdatedBy>
-<ListOf_ssAgreementEntitlement>
-<ssAgreementEntitlement>
<ssEntitlementEndDate>16/12/2009</ssEntitlementEndDate>
<ssEntitlementStartDate>16/11/2009</ssEntitlementStartDate>
<ssEntitlementType>Services</ssEntitlementType>
<ssNaiQuantity>2</ssNaiQuantity>
</ssAgreementEntitlement>
</ListOf_ssAgreementEntitlement>
-<ListOf_ssAgreementEntitlement>
-<ssAgreementEntitlement>
<ssEntitlementEndDate>10/12/2009</ssEntitlementEndDate>
<ssEntitlementStartDate>10/11/2009</ssEntitlementStartDate>
<ssEntitlementType>ServicePortal</ssEntitlementType>
<ssNaiQuantity>1</ssNaiQuantity>
</ssAgreementEntitlement>
</ListOf_ssAgreementEntitlement>
</ssAssetMgmtAsset>
</ListOf_ssAssetMgmtAsset>
The data needs to be displayed in the below manner where first grouping is by Account Country, then by Account Name. Then the table with 9 columns where in the first 5 columns are from first group and the next 4 are from second group.
Account Country
Account Name
ProductType Grant # Asset # Product SKU Product Name Entitlement Type Quantity /Nodes EntitlementStart Date Entitlement EndDate
I have the coding as
first for loop: <?for-each-group:ssAssetMgmtAsset;./ssAccountPrimaryCountry?>
second for loop: <?for-each-group:current-group();./ssAccountName?>
third which is for the table : <?for-each:current-group()?>
I close the above grp after product description.
One table with the first 5 columns and below second table is placed adjacent to the first to display the 4 columns with the grp <?for-each:ssAgreementEntitlement?>
how do I get all the 9 columns in a single row in a single table.
Any help is appreciated.
thanksWhat is the lnk between the two
ssAssetMgmtAsset and ssAgreementEntitlement ?
you want to display all the ssAgreementEntitlement for every ssAssetMgmtAsset group ?
there shud be a link between them, you have link them and display. -
Adding a single table without a logical join to another table (OBIEE 10g)
Sometimes I want to just display a single table without a logical join to another table in the repository. However, everytime I move it to the Business Model and Mapping layer and perform a Global Consistency Check, it tells me that it needs a logical join and I am forced to create another table to join to it. Thus creating a dimension-fact relationship. There are times I don't need this relationship and just want to display some data. Is there anyway to get around this?
Thanks in advance!Yes,You have to create a join.You cannot take single table to BMM layer.You can create an alias of the table.Join this alias and base table through any common column and take both tables to BMM and desired table to presentation layer.
Another way is to create a view in physcial layer.Write a select statement like
Select primary_key from Table
Where primary_key is primary key of base table.Join this view ith base table and repeat the steps defined for Alias.
Regards,
Sandeep -
Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field
Hello,
I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
Table structures are mentioned below:
OP:
Name Null Type
OP_NBR NOT NULL NUMBER(4) (Primary Key)
OP_DESC VARCHAR2(50)
OP_PAYLOD_XML CLOB
GM:
Name Null Type
GM_NBR NOT NULL NUMBER(4) (Primary Key)
GM_DESC VARCHAR2(40)
OP_NBR NOT NULL NUMBER(4) (Foreign Key)
GM_PAYLOD_XML CLOB
DM:
Name Null Type
DM_NBR NOT NULL NUMBER(4) (Primary Key)
DM_DESC VARCHAR2(40)
GM_NBR NOT NULL NUMBER(4) (Foreign Key)
DM_PAYLOD_XML CLOB
DE:
Name Null Type
DE_NBR NOT NULL NUMBER(4) (Primary Key)
DE_DESC NOT NULL VARCHAR2(40)
DM_NBR NOT NULL NUMBER(4) (Foreign Key)
DE_PAYLOD_XML CLOB
+++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT
j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
FROM
DE g, DM h, GM i, OP j
WHERE
h.dm_nbr = g.dm_nbr(+) and
i.gm_nbr = h.gm_nbr(+) and
j.op_nbr = i.op_nbr(+)
+++++++++++++++++++++++++++++++++++++++++++++++++++++
I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
Current O/P:
<resultSet>
<Record1>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<DM_PAYLOD_XML1>
<DE_PAYLOD_XML1>
</Record1>
<Record2>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML2>
<DM_PAYLOD_XML2>
<DE_PAYLOD_XML2>
</Record2>
<RecordN>
<OP_PAYLOD_XMLN>
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XMLN>
</RecordN>
</resultSet>
Now i want to change my SQL query so that i get following output structure:
<resultSet>
<Record>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<GM_PAYLOD_XML2> .......
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XML1>
<DM_PAYLOD_XML2> .......
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XML1>
<DE_PAYLOD_XML2> .......
<DE_PAYLOD_XMLN>
</Record>
<Record>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML1'>
<GM_PAYLOD_XML2'> .......
<GM_PAYLOD_XMLN'>
<DM_PAYLOD_XML1'>
<DM_PAYLOD_XML2'> .......
<DM_PAYLOD_XMLN'>
<DE_PAYLOD_XML1'>
<DE_PAYLOD_XML2'> .......
<DE_PAYLOD_XMLN'>
</Record>
<resultSet>
Appreciate your help in this regard!Hi,
A few questions :
How's your first query supposed to give you an XML output like you show ?
Is there something you're not telling us?
What's the content of, for example, <OP_PAYLOD_XML1> ?
I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
What's the db version BTW? -
Mapping an XML structure into one field
Make use of XSLT mapping (available on SDN...just search with CDATA...i think there is a new feature in PI7.1 (Copy XMl to subtree....something like that).
Regards,
Abhishek.Hi,
Chk this:
/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
Re: Conversion of source XML structure to single string using PI 7.1
Thanks
Amit
Maybe you are looking for
-
How can I make sure my data add on doesn't automatically renew?
I bought the 1.99 100 MB of data, don't want this to anutorenew, how can i stop it from doing that?
-
Creating a report using ttx file format
<font size="2"><p>Hello All </p><p>I have downloaded the professional version of the Crystal Reports for Eclipse. I wanted to know if a report template can be created using a ttx file format and passing recordsets at run time to the reports. If an ex
-
UCCX script editor not working
1-The loading bar down of the screen always loading and never finishes.Please take a look to the attached picture. 2-When i go to the uccx and want to change the server from hostname to ip address,i always get update failed. I am so new in uccx,help
-
IMac G5 Garbled Screen / Loud Fan / Overheating
When I try to start up my iMac G5 (pre iSight), I get the usual chime, and when the screen starts up, I get a surprise every time. Completely garbled, sometimes it looks like fog, other times like garbled information, other times like an old, badly t
-
How to setup startup script in Solaris 10
Could anyone point me out how to setup a startup script at run level 3 or 2 in solaris 10 ? Any previous solaris such as 9, 8, I just write a script and put in /etc/init.d/, then link it to run level 3 or 2. But in solaris 10 is different now. I coul