Nesting xml in Oracle 8i
How to generate nested xml/ complex xml in Oracle 8i using 8i packages dbms_xmlquery or xmlgen .
The xml might be looked like this..
if any body have idea then pls let me know.
i am trying to write Stored procedure on that i am using query like select c1,c2, cursor(c3,c4 from xyb) from ABC
but not getting required output
<?xml version="1.0" ?>
- <File>
<File_Type>ETNL_TRAVELR_PAYMENTS</File_Type>
- <File_Header_Record>
<File_Format_Version>0002</File_Format_Version>
<Creation_Module />
</File_Header_Record>
- <Transaction>
<Transaction_Type>FT_TRANS_IMP</Transaction_Type>
- <Transaction_Header>
<Record_Number>1</Record_Number>
<Urgent>N</Urgent>
</Transaction_Header>
- <Model_Info>
- <Model_ID>
- <![CDATA[ FF DOM EXT PAY
]]>
</Model_ID>
</Model_Info>
- <Transfer_Info>
<Charges>15</Charges>
</Transfer_Info>
- <Amounts>
- <Transaction_Amount>
<Amount>154.00</Amount>
<Currency>GBP</Currency>
</Transaction_Amount>
</Amounts>
- <Dates>
<Trusted_Source>N</Trusted_Source>
<Value_Date />
</Dates>
- <Bank_Account>
<Bank_Account_Type>DR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>K</Code_Type>
</Bank_Route_Code>
</Bank>
- <Account>
<Account_ID>D562</Account_ID>
</Account>
</Bank_Account>
- <Bank_Account>
<Bank_Account_Type>CR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>K</Code_Type>
- <Code>
- <![CDATA[ 538111
]]>
</Code>
</Bank_Route_Code>
- <Bank_Address_Info>
- <Name>
- <![CDATA[ Natwest
]]>
</Name>
- <Street1>
- <![CDATA[ Long Sutton Branch
]]>
</Street1>
- <Street2>
- <![CDATA[ 25 market Place
]]>
</Street2>
- <City>
- <![CDATA[ Spalding
]]>
</City>
<Country>GB</Country>
</Bank_Address_Info>
</Bank>
- <Account>
- <Account_Number>
- <![CDATA[ 12345678
]]>
</Account_Number>
- <Account_Address_Info>
- <Name>
- <![CDATA[ John Doe
]]>
</Name>
- <Street1>
- <![CDATA[ Employee Addr1
]]>
</Street1>
- <Street2>
- <![CDATA[ Employee Addr2
]]>
</Street2>
- <City>
- <![CDATA[ EmployeeCity
]]>
</City>
<Country_Sub_Entity />
<Postal>CF375YL</Postal>
<Country>GB</Country>
</Account_Address_Info>
</Account>
</Bank_Account>
- <Payment_Details_Or_Addenda>
- <Details_Text>
- <![CDATA[ PAY OHRID: 100000999
]]>
</Details_Text>
</Payment_Details_Or_Addenda>
- <Comments>
- <Comment_Text>
- <![CDATA[ NONE
]]>
</Comment_Text>
</Comments>
- <References>
- <Reference>
<Reference_Type>FBNF</Reference_Type>
- <Reference_Value>
- <![CDATA[ INVOICE 20021004001542
]]>
</Reference_Value>
</Reference>
- <Reference>
<Reference_Type />
- <Reference_Value>
- <![CDATA[
]]>
</Reference_Value>
</Reference>
- <Reference>
<Reference_Type>FMAILEN</Reference_Type>
- <Reference_Value>
- <![CDATA[ [email protected]
]]>
</Reference_Value>
</Reference>
</References>
</Transaction>
+ <Transaction>
<Transaction_Type>FT_TRANS_IMP</Transaction_Type>
+ <Transaction_Header>
<Record_Number>2</Record_Number>
<Urgent>N</Urgent>
</Transaction_Header>
+ <Model_Info>
- <Model_ID>
- <![CDATA[ FF DOM EXT PAY
]]>
</Model_ID>
</Model_Info>
+ <Transfer_Info>
<Charges>15</Charges>
</Transfer_Info>
- <Amounts>
- <Transaction_Amount>
<Amount>46.00</Amount>
<Currency>EUR</Currency>
</Transaction_Amount>
</Amounts>
- <Dates>
<Trusted_Source>N</Trusted_Source>
<Value_Date />
</Dates>
- <Bank_Account>
<Bank_Account_Type>DR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>G</Code_Type>
</Bank_Route_Code>
</Bank>
- <Account>
<Account_ID>D202</Account_ID>
</Account>
</Bank_Account>
- <Bank_Account>
<Bank_Account_Type>CR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>G</Code_Type>
- <Code>
- <![CDATA[ 234543
]]>
</Code>
</Bank_Route_Code>
- <Bank_Address_Info>
- <Name>
- <![CDATA[
]]>
</Name>
- <Street1>
- <![CDATA[
]]>
</Street1>
- <Street2>
- <![CDATA[
]]>
</Street2>
- <City>
- <![CDATA[
]]>
</City>
<Country />
</Bank_Address_Info>
</Bank>
- <Account>
- <Account_Number>
- <![CDATA[ DE65100700000123456789
]]>
</Account_Number>
- <Account_Address_Info>
- <Name>
- <![CDATA[ Test User
]]>
</Name>
- <Street1>
- <![CDATA[ Employee Addr1
]]>
</Street1>
- <Street2>
- <![CDATA[ Employee Addr2
]]>
</Street2>
- <City>
- <![CDATA[ Berlin
]]>
</City>
<Country_Sub_Entity />
<Postal>1234323</Postal>
<Country>DE</Country>
</Account_Address_Info>
</Account>
</Bank_Account>
- <Payment_Details_Or_Addenda>
- <Details_Text>
- <![CDATA[ PAY OHRID: 100000888
]]>
</Details_Text>
</Payment_Details_Or_Addenda>
- <Comments>
- <Comment_Text>
- <![CDATA[ NONE
]]>
</Comment_Text>
</Comments>
- <References>
- <Reference>
<Reference_Type>FBNF</Reference_Type>
- <Reference_Value>
- <![CDATA[ INVOICE 20021101001053
]]>
</Reference_Value>
</Reference>
- <Reference>
<Reference_Type />
- <Reference_Value>
- <![CDATA[
]]>
</Reference_Value>
</Reference>
- <Reference>
<Reference_Type>FMAILEN</Reference_Type>
- <Reference_Value>
- <![CDATA[ [email protected]
]]>
</Reference_Value>
</Reference>
</References>
</Transaction>
+ <Transaction>
<Transaction_Type>FT_TRANS_IMP</Transaction_Type>
+ <Transaction_Header>
<Record_Number>3</Record_Number>
<Urgent>N</Urgent>
</Transaction_Header>
+ <Model_Info>
- <Model_ID>
- <![CDATA[ FF INTL EXT PAY
]]>
</Model_ID>
</Model_Info>
+ <Transfer_Info>
<Charges>15</Charges>
</Transfer_Info>
+ <Amounts>
+ <Transaction_Amount>
<Amount>265.00</Amount>
<Currency>EUR</Currency>
</Transaction_Amount>
</Amounts>
+ <Dates>
<Trusted_Source>N</Trusted_Source>
<Value_Date />
</Dates>
+ <Bank_Account>
<Bank_Account_Type>DR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>S</Code_Type>
</Bank_Route_Code>
</Bank>
- <Account>
<Account_ID>D202</Account_ID>
</Account>
</Bank_Account>
+ <Bank_Account>
<Bank_Account_Type>CR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>S</Code_Type>
- <Code>
- <![CDATA[
]]>
</Code>
</Bank_Route_Code>
+ <Bank_Address_Info>
- <Name>
- <![CDATA[
]]>
</Name>
- <Street1>
- <![CDATA[
]]>
</Street1>
- <Street2>
- <![CDATA[
]]>
</Street2>
- <City>
- <![CDATA[
]]>
</City>
<Country />
</Bank_Address_Info>
</Bank>
+ <Account>
- <Account_Number>
- <![CDATA[ NL02ABNA0123456789
]]>
</Account_Number>
- <Account_Address_Info>
- <Name>
- <![CDATA[ New User
]]>
</Name>
- <Street1>
- <![CDATA[ Employee Addr1
]]>
</Street1>
- <Street2>
- <![CDATA[ Employee Addr2
]]>
</Street2>
- <City>
- <![CDATA[ Ansterdam
]]>
</City>
<Country_Sub_Entity />
<Postal>34242</Postal>
<Country>NL</Country>
</Account_Address_Info>
</Account>
</Bank_Account>
+ <Payment_Details_Or_Addenda>
- <Details_Text>
- <![CDATA[ PAY OHRID: 100000777
]]>
</Details_Text>
</Payment_Details_Or_Addenda>
+ <Comments>
+ <Comment_Text>
- <![CDATA[ NONE
]]>
</Comment_Text>
</Comments>
+ <References>
+ <Reference>
<Reference_Type>FBNF</Reference_Type>
- <Reference_Value>
- <![CDATA[ INVOICE 20021101001025
]]>
</Reference_Value>
</Reference>
+ <Reference>
<Reference_Type />
- <Reference_Value>
- <![CDATA[
]]>
</Reference_Value>
</Reference>
+ <Reference>
<Reference_Type>FMAILEN</Reference_Type>
- <Reference_Value>
- <![CDATA[ [email protected]
]]>
</Reference_Value>
</Reference>
</References>
</Transaction>
+ <Transaction>
<Transaction_Type>FT_TRANS_IMP</Transaction_Type>
- <Transaction_Header>
<Record_Number>4</Record_Number>
<Urgent>N</Urgent>
</Transaction_Header>
- <Model_Info>
- <Model_ID>
- <![CDATA[ FF INTL EXT PAY
]]>
</Model_ID>
</Model_Info>
- <Transfer_Info>
<Charges>15</Charges>
</Transfer_Info>
- <Amounts>
- <Transaction_Amount>
<Amount>34.70</Amount>
<Currency>EUR</Currency>
</Transaction_Amount>
</Amounts>
- <Dates>
<Trusted_Source>N</Trusted_Source>
<Value_Date />
</Dates>
- <Bank_Account>
<Bank_Account_Type>DR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>S</Code_Type>
</Bank_Route_Code>
</Bank>
- <Account>
<Account_ID>D202</Account_ID>
</Account>
</Bank_Account>
- <Bank_Account>
<Bank_Account_Type>CR</Bank_Account_Type>
- <Bank>
- <Bank_Route_Code>
<Code_Type>S</Code_Type>
- <Code>
- <![CDATA[
]]>
</Code>
</Bank_Route_Code>
- <Bank_Address_Info>
- <Name>
- <![CDATA[
]]>
</Name>
- <Street1>
- <![CDATA[
]]>
</Street1>
- <Street2>
- <![CDATA[
]]>
</Street2>
- <City>
- <![CDATA[
]]>
</City>
<Country />
</Bank_Address_Info>
</Bank>
- <Account>
- <Account_Number>
- <![CDATA[ FR313000400828000123456789
]]>
</Account_Number>
- <Account_Address_Info>
- <Name>
- <![CDATA[ French User
]]>
</Name>
- <Street1>
- <![CDATA[ Employee Addr1
]]>
</Street1>
- <Street2>
- <![CDATA[ Employee Addr2
]]>
</Street2>
- <City>
- <![CDATA[ Paris
]]>
</City>
<Country_Sub_Entity />
<Postal>54333</Postal>
<Country>FR</Country>
</Account_Address_Info>
</Account>
</Bank_Account>
- <Payment_Details_Or_Addenda>
- <Details_Text>
- <![CDATA[ PAY OHRID: 100000666
]]>
</Details_Text>
</Payment_Details_Or_Addenda>
- <Comments>
- <Comment_Text>
- <![CDATA[ NONE
]]>
</Comment_Text>
</Comments>
- <References>
- <Reference>
<Reference_Type>FBNF</Reference_Type>
- <Reference_Value>
- <![CDATA[ INVOICE 20021101001481
]]>
</Reference_Value>
</Reference>
- <Reference>
<Reference_Type />
- <Reference_Value>
- <![CDATA[
]]>
</Reference_Value>
</Reference>
- <Reference>
<Reference_Type>FMAILEN</Reference_Type>
- <Reference_Value>
- <![CDATA[ [email protected]
]]>
</Reference_Value>
</Reference>
</References>
</Transaction>
- <File_Trailer_Record>
<File_Name>ETNL_TRAVELR_PAYMENTS</File_Name>
<Total_Records>4</Total_Records>
</File_Trailer_Record>
</File>
regards
Ramashankar Sahu
As I recall from my 8i days (it's been many years), the only way to do this is to install the XML XDK. From http://www.oracle.com/technology/tech/xml/xdk/xdk_java.html, it says "The Oracle9i versions of the XDK can also be used to build applications designed to interface with Oracle8i databases." I had thought the 10g version could do that as well but I'm not seeing it now.
Since XMLType was not part of 8i, you will need to use PL/SQL to take your Select statement results and build them into a DOMDocument structure.
Hope that helps.
Similar Messages
-
Nested XML structure from Oracle
Using the SQL Adapter i BizTalk, calling a SQL Stored procedure on a MS SQL DB, I can get a nice nested XML structure using p JOIN ii and FOR XML AUTO, like this
<p code="DK003">
<ii stamp="2013-01-14T10:27:38.790"value="180.702052"price="184.000000">
<d Dividend="2.50"DividendDate="2012-03-29T00:00:00" />
</ii>
<ii stamp="2013-01-14T10:27:38.790"value="181.702052"price="14.000000">
<d Dividend="2.50"DividendDate="2012-03-29T00:00:00" />
</ii>
</p>
How can I get the same on Oracle ??Hi E.,
I guess this an XML namespace issue. I'm creating XmlForms-style documents and had to add an XML namespace to my root element to make them visible as such:
Namespace xf = Namespace.getNamespace("xf", "http://www.sapportals.com/wcm/app/xmlforms");
root.addNamespaceDeclaration(xf);
So what I'd suggest to you is reading out the IResource and treating the content as XML:
Document document = new SAXBuilder().build(content.getInputStream());
Element root = document.getRootElement();
Namespace xf = Namespace.getNamespace("xf", "http://www.sapportals.com/wcm/app/xmlforms");
root.removeNamespaceDeclaration(xf);
Hope this helps!
regards,
Christian -
Generating multi-level xml in oracle
Hi,
I want to create a multi-level XML structure from oracle, is there a way?
Presently oracle provides DBMS_XMLQUERY and XMLGEN package to generated XML structure given a query. But the structure so generated is of single level. That is say I use
select XMLGEN.getXML('select * from employees') from dual;
the output is
<EMPLOYEE>
<ROW num="1">
<NAME>Mark</NAME>
<TEL>451-638191</TEL>
</ROW>
</EMPLOYEE>
That I call a single level output.
To create a multiple level XML I went in for object type in oracle. But the problem with this is that if I want to have multiple children for a single parent then object types fail. The structure below is not possible with object type.
<EMPLOYEE>
<ROW num="1">
<NAME>Mark</NAME>
<CONTACT>
<ROW>
<RESIDENCE>
<ADDRESS>
<ROW>
Fifth Avenue, New York
</ROW>
</ADDRESS>
<TEL>
<ROW>451-638191</ROW>
<ROW>451-638192</ROW>
<ROW>451-638193</ROW>
</TEL>
</RESIDENCE>
</ROW>
<ROW>
<RESIDENCE>
<ADDRESS>
<ROW>
Fouth Avenue, New York
</ROW>
</ADDRESS>
<TEL>
<ROW>452-638191</ROW>
<ROW>452-638192</ROW>
<ROW>452-638193</ROW>
</TEL>
</RESIDENCE>
</ROW>
</CONTACT>
</ROW>
</EMPLOYEE>
Then I tried nested tables. Here one needs to create an object type to create a table type. One cannot create a table type out of another table type. So that leavs me with 2 levels
object type
used by
table type
used by
table.
Presently to generated a multi-level output as shown above I'm using cursors and build it in a clob variable.
Is there any other way that one can build a multi-level structure. Or is there a build in package that comes with orace 8i (and higher).
Regards,
Milton.Milton,
I was able to generate hierarchical XML from Oracle using object views and XML-SQL Utility (XSU).
Here is a simplified version of my OR schema:
/* Physical spec object */
create or replace type physical_specifications_object as object (
physical_specifications_id number(15),
page_count number(10),
product_id number(10),
four_color_count number(10),
two_color_count number(10),
table_count number(10),
binding_type varchar2(100),
height varchar2(20),
width varchar2(20)
/* Market object */
create or replace type market_object as object (
market_id number(15),
master_class_name varchar2(50),
market_name varchar2(100),
market_type varchar2(100),
market_description varchar2(500),
level_rank varchar2(15),
market_code varchar2(100),
product_id number(10)
/* List of markets */
create or replace type market_table as table of market_object;
/* Market object view */
create or replace view market_object_view of market_object
with object identifier (market_id) as
select mkt.market_id,
class.master_class_name,
mkt.market_name,
mkt.market_type,
mkt.market_description,
prod_mkt.level_rank,
mkt.market_code,
p.product_id
from market mkt,
product p,
product_market prod_mkt,
master_class class
where p.product_id = prod_mkt.product_id
and prod_mkt.market_id = mkt.market_id
and mkt.master_class_id = class.master_class_id(+);
/* Feature object */
create or replace type product_feature_object as object (
feature_id number(15),
feature_text varchar2(3500),
feature_type varchar2(100)
/* List of features */
create or replace type product_feature_table as table of product_feature_object;
/* Product object */
create or replace type product_object as object (
product_id number(10),
title varchar2(150),
media_type varchar2(20),
standard_number varchar2(100),
physical_specifications physical_specifications_object,
markets market_table,
product_features product_feature_table
/* Product object view */
create or replace view product_object_view of product_object
with object identifier (product_id) as
select p.product_id,
p.title,
p.media_type,
p.standard_number,
physical_specifications_object(spec.physical_specifications_id,
spec.page_count,
spec.product_id,
spec.four_color_count,
spec.two_color_count,
spec.table_count,
spec.binding_type,
spec.height,
spec.width),
cast(multiset(select *
from market_object_view mkt
where mkt.product_id(+) = p.product_id) as market_table) as markets,
cast(multiset(select f.feature_id, f.feature_text, f.feature_type
from feature f
where f.product_id = p.product_id) as product_feature_table) as product_features
from product p,
physical_specifications spec
where p.product_id = spec.product_id(+)
The objective is to generate XML for a product list with all the product subelements. The simple query "select * from product_object_view" when fed to the XML-SQL utility generates multi-level SQL. Note that Oracle 8i allows up to two level collection nesting in object types. Oracle 9i removes this limitation.
Check XSU documentation at http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/xsu/xsu_userguide.html#1014886
Hi,
I want to create a multi-level XML structure from oracle, is there a way?
Presently oracle provides DBMS_XMLQUERY and XMLGEN package to generated XML structure given a query. But the structure so generated is of single level. That is say I use
select XMLGEN.getXML('select * from employees') from dual;
the output is
<EMPLOYEE>
<ROW num="1">
<NAME>Mark</NAME>
<TEL>451-638191</TEL>
</ROW>
</EMPLOYEE>
That I call a single level output.
To create a multiple level XML I went in for object type in oracle. But the problem with this is that if I want to have multiple children for a single parent then object types fail. The structure below is not possible with object type.
<EMPLOYEE>
<ROW num="1">
<NAME>Mark</NAME>
<CONTACT>
<ROW>
<RESIDENCE>
<ADDRESS>
<ROW>
Fifth Avenue, New York
</ROW>
</ADDRESS>
<TEL>
<ROW>451-638191</ROW>
<ROW>451-638192</ROW>
<ROW>451-638193</ROW>
</TEL>
</RESIDENCE>
</ROW>
<ROW>
<RESIDENCE>
<ADDRESS>
<ROW>
Fouth Avenue, New York
</ROW>
</ADDRESS>
<TEL>
<ROW>452-638191</ROW>
<ROW>452-638192</ROW>
<ROW>452-638193</ROW>
</TEL>
</RESIDENCE>
</ROW>
</CONTACT>
</ROW>
</EMPLOYEE>
Then I tried nested tables. Here one needs to create an object type to create a table type. One cannot create a table type out of another table type. So that leavs me with 2 levels
object type
used by
table type
used by
table.
Presently to generated a multi-level output as shown above I'm using cursors and build it in a clob variable.
Is there any other way that one can build a multi-level structure. Or is there a build in package that comes with orace 8i (and higher).
Regards,
Milton. -
Generating multi-level XML in Oracle 8i using XML-SQL utility
Oracle 8i has a limitation when it comes to the object types. Only one-level nesting of collection is allowed. Oracle 9i apparently removes this limitation.
I am trying to generate XML for a hierarchical (conceptually) structure. To do that I am using XML-SQL utility (XSU) running agains an object view build on top of the relational data. The problem is the limit to onelevels of colelction nesting. Oracle 8i gives you a way to create a view with more levels of nesting by using references (REF). The problem is that when XSU runs agains a view with the references, it inserts the references into the XML document (instead of dereferencing them).
Is there a way to generate XML with Oracle 8i with more than two levels of collection nesting?
Thank you.
MichaelOracle 8i has a limitation when it comes to the object types. Only one-level nesting of collection is allowed. Oracle 9i apparently removes this limitation.
I am trying to generate XML for a hierarchical (conceptually) structure. To do that I am using XML-SQL utility (XSU) running agains an object view build on top of the relational data. The problem is the limit to onelevels of colelction nesting. Oracle 8i gives you a way to create a view with more levels of nesting by using references (REF). The problem is that when XSU runs agains a view with the references, it inserts the references into the XML document (instead of dereferencing them).
Is there a way to generate XML with Oracle 8i with more than two levels of collection nesting?
Thank you.
Michael -
I have data in an Oracle8i-database and will use Java to export
it to XML. I’m trying to use XML Developer’s Kit’s (XDK’s) XML
SQL Utility’s (XSU’s) OracleXMLQuery class. But I’ve problems to
get the nested XML-structure I need!
Oracle says there’s two good ways to do this:
“Source Customization
This category incompases customizations done by altering the
query or the database schema. Among the simplest and the most
powerful source customizations are:
* over the database schema, create an object-relational view
which maps to the desired XML document structure.
* in your query, use cursor subqueries, or cast-multiset
constructs to get nesting in the XML document which comes from a
flat schema.”
They then have an example how to create an object-relational
view. But this is done with an empty database, and I already
have tables with data so I don’t know how to do this.
I’ve tried with some simple subqueris like
SELECT name, id,
(SELECT COUNT(*) FROM order o WHERE c.id = o.id) AS
NumOfOrders
FROM cust c
But it adds just another colum.
Could somebody help me or direct me to some resource, please?
Thanks!I have data in an Oracle8i-database and will use Java to export
it to XML. I’m trying to use XML Developer’s Kit’s (XDK’s) XML
SQL Utility’s (XSU’s) OracleXMLQuery class. But I’ve problems to
get the nested XML-structure I need!
Oracle says there’s two good ways to do this:
“Source Customization
This category incompases customizations done by altering the
query or the database schema. Among the simplest and the most
powerful source customizations are:
* over the database schema, create an object-relational view
which maps to the desired XML document structure.
* in your query, use cursor subqueries, or cast-multiset
constructs to get nesting in the XML document which comes from a
flat schema.”
They then have an example how to create an object-relational
view. But this is done with an empty database, and I already
have tables with data so I don’t know how to do this.
I’ve tried with some simple subqueris like
SELECT name, id,
(SELECT COUNT(*) FROM order o WHERE c.id = o.id) AS
NumOfOrders
FROM cust c
But it adds just another colum.
Could somebody help me or direct me to some resource, please?
Thanks! -
Database data to nested xml structure
Hi All,
I need to convert the data in the oracle database to nested xml tree structure as below:
Data in the database is in the following structure:
1 branch1 13-JAN-11 a.txt
1 branch1 25-JAN-11 b.txt
1 branch1 25-JAN-11 c.txt
1 branch2 20-JAN-11 d.txt
2
XML for the above data should be in the format:
<Root>
<Account_no value="1">
<Desc value="branch1">
<Date value="13-JAN-11">
<Name value="a.txt"/>
</Date>
<Date value="25-JAN-11">
<Name value="b.txt"/>
<Name value="c.txt"/>
</Date>
</Desc>
<Desc value="branch2">
<Date value="20-JAN-11">
<Name value="d.txt"/>
</Date>
</Desc>
</Account_no>
<Account_no value="2">
</Account_no>
</Root>
I am able to get this kind of xml structure using java after storing the database data in a n-ary tree. But it takes more time to execute.
Can this kind of same xml format be achieved using pl/sql programming?
Please help me with your valuable insights.
Thanks,
AlagappanHi,
Please always mention your db version (select * from v$version).
Here's one solution using SQL/XML functions :
Sample data used :
create table sample_data
account_no number,
description varchar2(30),
dt date,
name varchar2(30)
insert into sample_data values(1, 'branch1', to_date('13-JAN-11','DD-MON-RR'), 'a.txt');
insert into sample_data values(1, 'branch1', to_date('25-JAN-11','DD-MON-RR'), 'b.txt');
insert into sample_data values(1, 'branch1', to_date('25-JAN-11','DD-MON-RR'), 'c.txt');
insert into sample_data values(1, 'branch2', to_date('20-JAN-11','DD-MON-RR'), 'd.txt');
insert into sample_data values(2, 'branch3', to_date('20-JAN-11','DD-MON-RR'), 'e.txt');Query :
SELECT xmlserialize(document
xmlelement("Root",
xmlagg(
xmlelement("Account_no", xmlattributes(account_no as "value"),
xmlagg(
xmlelement("Desc", xmlattributes(description as "value"), dt)
order by description
) order by account_no
as clob indent ) doc
FROM (
SELECT account_no, description,
xmlagg(
xmlelement("Date", xmlattributes(to_char(dt,'DD-MON-RR') as "value"), name)
order by dt
) dt
FROM (
SELECT account_no, description, dt,
xmlagg(
xmlelement("Name", xmlattributes(name as "value"))
order by name
) name
FROM sample_data
GROUP BY account_no, description, dt
GROUP BY account_no, description
GROUP BY account_no
DOC
<Root>
<Account_no value="1">
<Desc value="branch1">
<Date value="13-JAN-11">
<Name value="a.txt"/>
</Date>
<Date value="25-JAN-11">
<Name value="b.txt"/>
<Name value="c.txt"/>
</Date>
</Desc>
<Desc value="branch2">
<Date value="20-JAN-11">
<Name value="d.txt"/>
</Date>
</Desc>
</Account_no>
<Account_no value="2">
<Desc value="branch3">
<Date value="20-JAN-11">
<Name value="e.txt"/>
</Date>
</Desc>
</Account_no>
</Root>
Here, I used XMLSerialize function with indent option to format the output (available starting with 11g). -
Producing nested xml with querying attributes from a nested table
How can one produce nested xml querying columns from a nested table? Looking at the object documentation, I can readily unnest the tables. Using your examples in the book, unnesting is select po.pono, ..., l.* from purchaseorder_objtab po, table (po.lineitemlist_ntab) l where l.quantity = 2;
what if I don't want to unnest and don't want a cursor. I would like to produce nested xml.Gail,
Although you can use XSU (XML-SQL Util) in 8.1.7, I would recommend that you upgrade to 9i for much better support (both in functionality and performance) of XML in the database. For example, in Oracle9i there are:
- a new datatype - XMLType for storing and retrieving XML documents
- DBMS_XMLGEN package and SYS_XMLGEN, SYS_XMLAGG functions for generating XML document from complex SQL queries
- A pipelined table function to break down large XML documents into rows.
You can check out some examples using SYS_XMLGEN and DBMS_XMLGEN for your specific needs at http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88894/adx05xml.htm#1017141
Regards,
Geoff -
Hello, could anyone help me on this? I have a XML file as below:
<Feed>
<svc>enr1</svc>
<report_email>[email protected]</report_email>
<requisition id="12">
<email>[email protected]</email>
<Name>Joseph</Name>
<PRODUCT>
<PROD_ID>532343234</PROD_ID>
<NAME>KID'S WEAR </NAME>
<DATE_ORDERED>09/04/2009</DATE_ORDERED>
</PRODUCT>
<PRODUCT>
<PROD_ID>67045434</PROD_ID>
<NAME>SHOES</NAME>
<DATE_ORDERED>09/04/2009</DATE_ORDERED>
</PRODUCT>
</requisition>
<requisition id="13">
<email>[email protected]</email>
<Name>Sarah</Name>
<PRODUCT>
<PROD_ID>11111111</PROD_ID>
<NAME>LOST IN FOREST</NAME>
<DATE_ORDERED>10/05/2008</DATE_ORDERED>
</PRODUCT>
<PRODUCT>
<PROD_ID>222222222</PROD_ID>
<NAME>TRY IT NOW</NAME>
<DATE_ORDERED>09/04/2007</DATE_ORDERED>
</PRODUCT>
</requisition>
</Feed>You could flatten the XML into table style output using XMLTABLE...
WITH t as (select XMLTYPE('
<RECSET>
<REC>
<COUNTRY>1</COUNTRY>
<POINT>1800</POINT>
<USER_INFO>
<USER_ID>1</USER_ID>
<TARGET>28</TARGET>
<STATE>6</STATE>
<TASK>12</TASK>
</USER_INFO>
<USER_INFO>
<USER_ID>5</USER_ID>
<TARGET>19</TARGET>
<STATE>1</STATE>
<TASK>90</TASK>
</USER_INFO>
</REC>
<REC>
<COUNTRY>2</COUNTRY>
<POINT>2400</POINT>
<USER_INFO>
<USER_ID>3</USER_ID>
<TARGET>14</TARGET>
<STATE>7</STATE>
<TASK>5</TASK>
</USER_INFO>
</REC>
</RECSET>') as xml from dual)
-- END OF TEST DATA
select x.country, x.point, y.user_id, y.target, y.state, y.task
from t
,XMLTABLE('/RECSET/REC'
PASSING t.xml
COLUMNS country NUMBER PATH '/REC/COUNTRY'
,point NUMBER PATH '/REC/POINT'
,user_info XMLTYPE PATH '/REC/*'
) x
,XMLTABLE('/USER_INFO'
PASSING x.user_info
COLUMNS user_id NUMBER PATH '/USER_INFO/USER_ID'
,target NUMBER PATH '/USER_INFO/TARGET'
,state NUMBER PATH '/USER_INFO/STATE'
,task NUMBER PATH '/USER_INFO/TASK'
) y
COUNTRY POINT USER_ID TARGET STATE TASK
1 1800 1 28 6 12
1 1800 5 19 1 90
2 2400 3 14 7 5Or you could shread the XML into Oracle nested tables...
e.g.
(Based on response from mdrake on this thread: Re: XML file processing into oracle
Reading XML using a schema...
declare
SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
<xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
<xs:complexType name="groupType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="item" type="itemType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:byte" use="required"/>
</xs:complexType>
<xs:complexType name="itemType" xdb:maintainDOM="false">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:short" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="cust_orderType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="group" type="groupType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="cust_id" type="xs:short" use="required"/>
</xs:complexType>
</xs:schema>';
INSTANCE CLOB :=
'<cust_order cust_id="12345">
<group id="1">
<item id="1" name="Standard Mouse">100</item>
<item id="2" name="Keyboard">100</item>
<item id="3" name="Memory Module 2Gb">200</item>
<item id="4" name="Processor 3Ghz">25</item>
<item id="5" name="Processor 2.4Ghz">75</item>
</group>
<group id="2">
<item id="1" name="Graphics Tablet">15</item>
<item id="2" name="Keyboard">15</item>
<item id="3" name="Memory Module 4Gb">15</item>
<item id="4" name="Processor Quad Core 2.8Ghz">15</item>
</group>
<group id="3">
<item id="1" name="Optical Mouse">5</item>
<item id="2" name="Ergo Keyboard">5</item>
<item id="3" name="Memory Module 2Gb">10</item>
<item id="4" name="Processor Dual Core 2.4Ghz">5</item>
<item id="5" name="Dual Output Graphics Card">5</item>
<item id="6" name="28inch LED Monitor">10</item>
<item id="7" name="Webcam">5</item>
<item id="8" name="A3 1200dpi Laser Printer">2</item>
</group>
</cust_order>';
begin
dbms_xmlschema.registerSchema
schemaurl => SCHEMAURL
,schemadoc => XMLSCHEMA
,local => TRUE
,genTypes => TRUE
,genBean => FALSE
,genTables => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
end;
desc CUST_ORDER_TBL
SQL> desc CUST_ORDER_TBL
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
set autotrace on explain
set pages 60 lines 164 heading on
col cust_id format a8
select extract(object_value,'/cust_order/@cust_id') as cust_id
,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
from CUST_ORDER_TBL
,XMLTABLE('/cust_order/group'
passing object_value
columns id number path '@id'
,item xmltype path 'item'
) grp
,XMLTABLE('/item'
passing grp.item
columns id number path '@id'
,inm varchar2(30) path '@name'
,qty number path '.'
) itm
CUST_ID GROUP_ID ITEM_ID ITEM_NAME ITEM_QTY
12345 1 1 Standard Mouse 100
12345 1 2 Keyboard 100
12345 1 3 Memory Module 2Gb 200
12345 1 4 Processor 3Ghz 25
12345 1 5 Processor 2.4Ghz 75
12345 2 1 Graphics Tablet 15
12345 2 2 Keyboard 15
12345 2 3 Memory Module 4Gb 15
12345 2 4 Processor Quad Core 2.8Ghz 15
12345 3 1 Optical Mouse 5
12345 3 2 Ergo Keyboard 5
12345 3 3 Memory Module 2Gb 10
12345 3 4 Processor Dual Core 2.4Ghz 5
12345 3 5 Dual Output Graphics Card 5
12345 3 6 28inch LED Monitor 10
12345 3 7 Webcam 5
12345 3 8 A3 1200dpi Laser Printer 2
17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
On 10.2.0.1:
Execution Plan
Plan hash value: 3741473841
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 24504 | 89M| 873 (1)| 00:00:11 |
| 1 | NESTED LOOPS | | 24504 | 89M| 873 (1)| 00:00:11 |
| 2 | NESTED LOOPS | | 3 | 11460 | 805 (1)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3777 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | SYS_IOT_TOP_774117 | 3 | 129 | 1 (0)| 00:00:01 |
| 5 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
filter("SYS_NC_TYPEID$" IS NOT NULL)
Note
- dynamic sampling used for this statementOn 10.2.0.3:
Execution Plan
Plan hash value: 1048233240
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 17 | 132K| 839 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 17 | 132K| 839 (0)| 00:00:11 |
| 2 | MERGE JOIN CARTESIAN | | 17 | 131K| 805 (0)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3781 | 3 (0)| 00:00:01 |
| 4 | BUFFER SORT | | 17 | 70839 | 802 (0)| 00:00:10 |
|* 5 | INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 | 17 | 70839 | 802 (0)| 00:00:10 |
|* 6 | INDEX UNIQUE SCAN | SYS_IOT_TOP_56152 | 1 | 43 | 2 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | SYS_C006701 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
filter("SYS_NC_TYPEID$" IS NOT NULL AND
"NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
Note
- dynamic sampling used for this statementCLEAN UP...
DROP TABLE CUST_ORDER_TBL purge;
exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd'); -
Just trying to clarify some issues as I try and learn about XML, and specifically how it integrates into the DB.
1 - Is there a way with Oracle tools for me to get an XSD of an existing 9i relational schema? We are not currently using the XML DB, but our middleware developers would like to have an up to date XSD to use for their internal mapping.
2 - Is there any way that I can keep that XSD up-to-date automatically, so I get a new one whenever the schema gets updated?
3 - If I wanted to investigate storing XML docs within the DB in native XML format, I need to have an XML DB, correct? Is this DB construct maintained seperatelly from my "normal" relational schema? or are they kept in sync by Oracle?
I know these may all be real basic questions, but as I said, I'm new to XML and Oracle. I am reading as much as I can, but there are a lot of docs out there.
Thanks,
MikeHi
1. On my opinion such a tool doesn't exists. Some parts can be implemented elsewhere, but not as described by you... e.g. with XSU if you specify the parameter "withschema" the XSD of the executed statement is generated. Another example is to use DBMS_METADATA to dump the data dictionary in XML (but not XSD, of course you could write your own XSLT to do this transformation...).
2. -
3. If you use XSD-based tables the XSD and the relational model are stored separately in the data dictionary. Therefore if you change the XSD you have to drop/create the XSD-based table... no schema evolution yet.
Chris -
Unable to retrieve data from a nested table in Oracle 8i from JSP
How do i retrieve data from a nested table in Oracle 8i from my JSP code?
When i try to execute the query , a general error is thrown.
Kindly advice as soon as possible.How do i retrieve data from a nested table in Oracle 8i from my JSP code?
When i try to execute the query , a general error is thrown.
Kindly advice as soon as possible. -
How to store data from xml in oracle database
Hello All
Could anyone tell me ways of storing XML in Oracle and whats the best one in terms of performance issues.
any URL to this q/s would be great.
thanks
kedarBen,
The following link as some information regarding DOM API and XSQL.
http://asktom.oracle.com/pls/ask/f?p=4950:8:2923508047773696280::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:17309127931717
For XML DB, you may want to create an XMLSchema and build a table off the schema definition. Then use WEBDAV to load the xml into a folder (ie object table) Once the xml is in the database you could build a view for a relational look at the data.
Example from XMLDB Techical White Paper doc.
create or replace view PURCHASEORDER_MASTER_VIEW
(reference, requestor, userid, costcenter,...)
as select extractValue(Value(p),'/PurchaseOrder/Reference'),
extractValue(value(p),'/PurchaseOrder/Requestor'),
extractValue(value(p),'/PurchaseOrder/User'),
extractValue(value(p),'/PurchaseOrder/CostCenter'),...
from PURCHASEORDER p -
Spry Menu Using Nested XML Dataset (Spry 1.6)
I have a vertical menu with a few items. One of which is
labeled Products which has submenus. I want to have that submenu
read from a Nested XML dataset. Using a single dataset for one
level in a menu is easy enough, but the subenu will have submenus.
Example Menu:
Home
Company
Products
|-- Product 1
|-- Item 1
|-- Item 2
|-- Item 3
|-- Product 2
|-- Item 1
|-- Item 2
|-- Product 3
|-- Item 1
|-- Item 2
|-- Item 3
|-- Item 4
|-- Product 4
|-- Item 1
|-- Item 2
|-- Product 5
I have been looking for an easy way to use the Spry Nested
XML Dataset to create the Product/Item menu. The number of Products
may vary as well as the number of Items in each Product submenu
(also, some Products may not have Items).
I already have an ASP page that creates the XML data from a
database.
Schema follows (XSD ):
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<xsd:element name="products">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="product_type"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="type_name" maxOccurs="1"
type="xsd:string"/>
<xsd:element name="type_url" maxOccurs="1"
type="xsd:anyURI"/>
<xsd:element name="product_name"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item_name" maxOccurs="1"
type="xsd:string"/>
<xsd:element name="item_url" maxOccurs="1"
type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I have been programming for 17 years but am new to Spry. If
this cannot be done easily with the Spry framework, I'll probably
wind up splitting the XML data into 2 files (Products and Items)
then writing a nested loop and call each by row, but then I have to
find out how Spry Datasets reference XML data. Figuring out how to
call rows from the XML data shouldn't be so bad, but this method
just seems like such a hassle for something that should be easy.
Pseudocode follows:
j=1
i=1 to TotalNumberProducts
display Product i from Products
ItemsExist=true
While ItemsExist
if j > TotalNumberItems | Item j is not for Product then
ItemsExist=false
else
display Item j from Items
j++
Wend
Next
Thanks in advance for any help or direction!That's exactly what I'm trying to do. However, I implemented
that code and the submenus won't appear. I suspect the submenus
aren't finding the field names from the Nested XML Dataset. The
first level of Product menus work great (this is a submenu of the
overall menu) and correctly identify products that do not have
submenus, so I know it's picking up the number of records in the
Nested Dataset correctly - it just won't display the data in the
next level of menu.
variable and script declarations:
<script src="SpryAssets/SpryMenuBar.js"
type="text/javascript"></script>
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryNestedXMLDataSet.js"
type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css"
rel="stylesheet" type="text/css">
<script type="text/javascript">
<!--
var productMenuData = new
Spry.Data.XMLDataSet("products.asp", "products/product_type");
var productMenuDataItems = new
Spry.Data.NestedXMLDataSet(productMenuData, "product_name");
//-->
</script>
Code for menus:
<ul id="NavMenu" class="MenuBarVertical">
<li><a
href="index.html">Home</a></li>
<li><a
href="company.html">Company</a></li>
<li><a href="franco_giberti.html">Franco
Giberti</a></li>
<li><a class="MenuBarItemSubmenu"
href="products.asp">Products</a>
<ul spry:region="productMenuData
productMenuDataItems">
<li spry:repeat="productMenuData"><a
class="MenuBarItemSubmenu" href="{type_url}"
spry:if="{productMenuDataItems::ds_RowCount} !=
0">{type_name}</a> <a href="{type_url}"
spry:if="{productMenuDataItems::ds_RowCount} ==
0">{type_name}</a>
<ul spry:if="{productMenuDataItems::ds_RowCount} !=
0">
<li spry:repeat="productMenuDataItems"><a
href="{productMenuDataItems::item_url}">{productMenuDataItems::item_name}</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="contact.html">Contact Us</a>
<!-- end #sidebar1 -->
</li>
</ul>
XML:
<products
xsi:noNameSpaceSchemaLocation="products.xsd">
−
<product_type>
<type_name>Pasta Sauce</type_name>
<type_url>pt_2.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_3.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_4.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_5.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_6.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_7.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_8.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Olive Oil</type_name>
<type_url>pt_3.asp</type_url>
−
<product_name>
<item_name>Original</item_name>
<item_url>pn_9.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil</item_name>
<item_url>pn_10.asp</item_url>
</product_name>
−
<product_name>
<item_name>Herbs</item_name>
<item_url>pn_11.asp</item_url>
</product_name>
−
<product_name>
<item_name>Sun Dried Tomato</item_name>
<item_url>pn_12.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Spreads</type_name>
<type_url>pt_4.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_13.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_14.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_15.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_16.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_17.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_18.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Grilled Vegetables</type_name>
<type_url>pt_5.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_19.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_20.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_21.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_22.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_23.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_24.asp</item_url>
</product_name>
</product_type>
−
<product_type>
<type_name>Truffle Products</type_name>
<type_url>pt_6.asp</type_url>
</product_type>
</products>
Any further guidance would be very much appreciated! -
How to construct the where clause for a nested xml target file
Post Author: jlpete72
CA Forum: Data Integration
I'm having some problems getting the desired results creating a multi-level nested xml file. Specifically, it does not seem that the where clause in the child schemas respects values from parent schemas. I'm sure I'm constructing something incorrectly, but am running out of ideas.
I am working with the classic company/order/line hierarchy and there are three levels of output schemas in my target xml file, one for company, order header and order line information.
For testing, I have hardcoded a restriction at the order header line to deal with only one order. But unless I hardcode values into the where clause at the order line level of the schema, all values are returned for orders belonging to the company defined in the company level.
I'm trying a where clause at the order line level similar to:
order_line.customer = order_header.customer and order_line.order_num = order_header.order_num
If the customer has more than one order in the data file, then all orders for that customer are placed in the detail for the order header. Only if I hard code the order number in the where clause do I get only the lines for the order specified in the header section. Not very practical.
What am I missing?An External Parsed Entity could be used to reference a schema.
In your DTD:
<!ENTITY datamodules SYSTEM "file:///c:/Datamodules/Datamodules.xsd">
Refer the external entity in xml document:
<datamodules>&datamodules;</datamodules> -
XML in Oracle 9i (best method to return a xml file from a table query)
Hello.
What is the best method to query a table, or set of tables (that will return thousands of rows) using xml in oracle? (best performance)
I'm currently using DBMS_XMLGen, is there a better method ?I think, if your talking about generating XML, that you should use XMLElement, XMLForest, etc. to create your XML.
Lets assume that you base is relational data, then maybe the following great example will give you an idea how to do it : Re: Generate XML Schema from oracle tables
As michaels pointed out (did you read the link/ URL given?), the general expectancy is that the packages will be less and less important. So also maintenance wise the XMLElement, etc way will be the best, also for the future, maintainable method. -
Generating Deeply nested XML from a flat file
Hi All,
I am working on a MQ to IDOC scenario.
I am getting a flat file as input. I need to convert it into XML( so that XI can understand it).
But conversion is into a "Deeply Nested XML from a Flat File" at sender side (JMS Adapter).
Any inputs on this.
Regards,
VikasYou can only convert flat file into xml structure with 3 levels.
If you need to convert flat file into deep nested xml structure, you have to do java mapping or xslt or abap mapping. There is a tool, I think it's called conversion agent by itemfield (bought by SAP), which can do pretty everything with conversion. Never used it though.
Jayson
Maybe you are looking for
-
My I POD is at least 6 years old - functions well - 60 GB version I only use it for music and PodCASTS which uses little room say 5 GB However, I have a yellow " OTHER " band which is impossible to me as I have not recorded anything else, However it
-
How can I run a java-application on starting of Windows 2000
How can I run a java-application without any user on starting of Windows 2000? For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway. How can I do that?
-
Hi I am supporting a set of web pages which display data to the user based on XML transformed by a set of style sheets. Currently when the user does something and fires the doPost method we get the "File Download" box appear with the message "Some fi
-
How to see SAP NOTES ( asking for username & password )
Hi all, where to check for SAP NOTES? it is asking for user name & password. how to get this USERNAME & PASSWORD to read all SAP NOTES ?? Regards pabitra
-
Hi Guruz, One of my consultant has scheduled a job in bacjground which runs on daily basis.But what I noticed that It ran successfully on 4th of November last.After that it didn't run.It was rescheduled today. From SM37 I can't see why the job didn't