XSLT to convert XML into Tables
Hi,
I'm trying to import my XML data into a table format. After adding an XSL file to my Structure Application as a Preprocessing Stylesheet, and importing my XML instance file with the Template file opened, the "Unknown File Type" error window appeared asking for a file format to Convert From. Picking any one doesn't create a table.
The XSL file tranforms the XML data into an HTML file that has a table with columns corresponding to the XML data. I was thinking using that type of XSL because it renders tables.
Below is the XSL markup:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Products</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Number</th>
<th>Date</th>
</tr>
<xsl:for-each select="Products/Product">
<tr>
<td><xsl:value-of select="Title"/></td>
<td><xsl:value-of select="Number"/></td>
<td><xsl:value-of select="Date"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Title, Number, and Date are child elements of the Product element, which is a child element of the Products root element in my XML file.
Am I applying the stylesheet correctly here? Am I using the write kind of stylesheet?
Thanks,
zeb
Hi Michael, Van,
Thank you for responding to my post. Your feedback was very helpful!
I was able to get the table to generate in FrameMaker but no data from the XML file is flowing into it. All that appears is the header row with "Title," "Number," and "Date" in the cells, and a row with blank cells underneath it. The Structure View pane has a red "<no value>" for the "Cols" and "Widths" attributes of the Table element. Only the Title column is affected by the width value.
The XSL, RW, and EDD files are as a follows: (The structure for the XML is a "Products" root element with mulitple "Product" child elements that each have a "Title," "Name," "Date" child element.)
==========================XSL==================
<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" doctype-system="products_DTD3.dtd" />
<xsl:template match="/">
<products>
<Table cols="3" width="150">
<TableHeading>
<TableRow>
<TableCell>Title</TableCell>
<TableCell>Number</TableCell>
<TableCell>Date</TableCell>
</TableRow>
</TableHeading>
<TableBody>
<TableRow>
<TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Title"/></xsl:for-each></TableCell>
<TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Number"/></xsl:for-each></TableCell>
<TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Date"/></xsl:for-each></TableCell>
</TableRow>
</TableBody>
</Table>
</products>
</xsl:template>
</xsl:stylesheet>
==========================EDD==================
Element (Container): products
General rule: Table
Valid as the highest-level element.
Element (Table): Table
General rule: TableHeading,TableBody
Attribute list
Name: cols String Required
Name: width String Required
Element (Table Heading): TableHeading
General rule: TableRow
Element (Table Row): TableRow
General rule: TableCell+
Element (Table Cell): TableCell
General rule: <TEXT>
Element (Table Body): TableBody
General rule: TableRow
==========================RW===================
fm version is "10.0";
element "Table" {
is fm table element;
attribute "cols" is fm property columns;
attribute "width" is fm property column widths;
element "TableRow" is fm table row element;
element "TableHeading" is fm table heading element;
element "TableBody" is fm table body element;
element "TableCell" is fm table cell element;
===============================================
I'm having trouble placing the "<xsl:for-each select="Products/Product">" tag in the XSL file. When I put it under TRow, FrameMaker gives an error that "TRow is not a valid for content (TCell)+". Only when I place it within the TCell tags (as I have above) does the above-mentioned Table with a Header row and a row with empty cells generate.
Is the XSL the problem here?
Thanks,
Zeb
Similar Messages
-
Convert xml into SAP using dataset
Hi All,
How to convert XML into itab using dataset, in this conversion have any function module available? please give me a sample program (having any). and material also.
Thanks,
Suresh maniarasuHi,
First you need to get the XML file Data into SAP using the Function Module and can populate the data into an inernal table.
TEXT_CONVERT_XML_TO_SAP
DMC_CONVERT_XML_TO_TABLE
or you can use the following classes
CL_RSRD_CONVERTER_XML
CL_WDR_XML_CONVERT_UTIL
CL_EXM_IM_ISHCM_CONV_XML_SAP
Thank U,
Jay.... -
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'); -
Problem writing a XSLT to convert XML in desired format from a table having self join
Hello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
DHello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
D -
Converting XML as table to XML as string
All,
I am successfully able to convert XML table from Internal Table. Now, I would like to convert this XML Table into XML string.
Any help on this will be appreciated.
Regards,
Salil
Moderator message: please search for available information/documentation before asking.
Edited by: Thomas Zloch on Dec 7, 2010 11:57 AMHowdy,
CONCATENATE LINES OF lt_table into l_string SEPARATED BY cl_abap_char_utilities=>cr_lf.
This will create a string of the lines of the internal table with a carriage return after each line.
Cheers
Alex -
How to convert XML into idocs and post in ECC using PI
Hello All,
I want to configure the scenario like this MDM->PI->ECC. Using FTP I am getting able to fetch the xml file from MDM Server Ready folder. Now, I need to convert this XML file into Idocs and post it in ECC. Can anyone provide me step by step configuration in PI to achieve this. I have configured communication channel with adapter type Idoc in Itegration Builder. But, I am not sure where it will do the conversion of XML into Idoc and how do post it to ECC. I am working first time on PI 7.1. I have worked on XI 3.0 in 2006-2007. Any help to configure this step by step shall be appreciated.
Thanks & Regards,
HemalIn you have the XML from MDM you have to use the mapping provided by the funtionals in the Funtional specification documents. once you did it you must configure the Receiver IDoc Adapter. and later dont fonget to configure properly the ReceiverAgreement.
as you receive the docuement from MDM via FTP, thats not a SAP System that means that you have to define PI as the sender of the IDoc,otherwise you will have the Error "Unable to convert the sender service to an ALE logical system"
to do that in the receiver Agreement>Header Mapping>Sender System-->Select PI server.
Take in mind to send IDocs to any SAP System, the system that send it must be a SAP system too. thats why you configure it
http://help.sap.com/saphelp_nw04/helpdata/en/5d/112d20f6ce6c46ba66afb98d278fbd/frameset.htm
Another thing is you have configure the ALE distribution Model.
se this:
http://wiki.sdn.sap.com/wiki/display/XI/FileToIDOC
/people/michal.krawczyk2/blog/2005/03/29/xi-error--unable-to-convert-the-sender-service-to-an-ale-logical-system
/people/venugopalarao.immadisetty/blog/2007/01/24/troubleshooting-file-to-idoc-scenario-in-xi
Let us know
Rodrigo P-. -
Interface to get inbond XML into tables
We have Oracle 7.3 and HP-UX. We have a requirement to get XML from client and get the data into our tables.
I think we need to install Oracle XDK and parse the XML and put it in Oracle using JDBC.
I need to know which version of XDK I should install in HP-UX/Oracle 7.3?
Can anyone provide a sample code to insert data from XML to tables?
We have a standard XML with data in tags. No attributes.We have Oracle 7.3 and HP-UX. We have a requirement to get XML from client and get the data into our tables.
I think we need to install Oracle XDK and parse the XML and put it in Oracle using JDBC.
I need to know which version of XDK I should install in HP-UX/Oracle 7.3?
Can anyone provide a sample code to insert data from XML to tables?
We have a standard XML with data in tags. No attributes. -
Hi,
Recently, I got converted query into an XML file, but when I
try to convert this XML file to XSL file in Dreamweaver. It doesn't
work. It said "An exception occurred! Type:UTFDataFormatException,
Message:invalid byte 2 (n) of a 3-byte sequence.(1,1). What happed?
Thanks in advance!Closed (no answer)
-
How to convert XML into word doc or pdf
hi all ,
i ve to create a xml with specified alignment,but while taking print out alignments changing according to IE's alignment.
So, Plz some one tel me whether any solution is there in xml itself or it have to be convert into word doc or PDF.If so, tell me an idea for how to convert xml file into Word doc or PDF.thanx ,i saw about FOP in xml.apache.org site and i learned something abt tat . But i dont know how to download FOP package from apache..
Actually they gave links to download
like http://ftp.wayne.edu/apache/xml/fop
inside tat link they mentioned as parent,Directory,binaries,sources and tar files.From this i dont know how to download?
Plz can someone tell a solution.. -
How to convert Templates into tables under Smartforms
Hi Gurus,
I need to print internal table data onto a Template. But I'm wondering as how to convert a Template into Table. It is very urgent.
Answers are rewardable.
-Syed.Hi ,
Why do you wantto use templates as table control .
You should use table control in place of template to dipslay contents of an internal table .
To use table control as template put template inside a loop . Im not sure it works or not .
Regards -
How to convert XML into XSD Using Altova XML Spy
Hi,
How to convert XML file into XSD Using Altova XML Spy.
I want to use that XSD as an External Def in my IR
Regards
Sumanhi
Following is the path where you could get the PDF's and zip file.
https://www.sdn.sap.com/irj/sdn/howtoguides?rid=/webcontent/uuid/5024a59a-4276-2910-7580-f52eb789194b [original link is broken]
please check out the following Heading, and at the bottom corner you will find the download option where you will get the zip file:
How to Generate XSD Schemas from Existing MDM 5.5 Repositories
You can download xomlite45.jar from sdn
copy the jar file to your java installation location like c:>java in
Java jar xomLite45.jar MyFile.xml
then you get correspondig MyFile.xsd
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf0e8a97-0d01-0010-f0a2-af3b18b7f4eb -
Optimize a data parser that converts CLOB into table
I am importing complex array data from Cold Fusion into ORACLE using a stored procedure. What I've done is convert the data into a CLOB, pass it into ORACLE, then parse it into a temporary table using a pipelined function. Unfortunately the array is large (16k rows) and it's taking a while to run.
What I'm looking is a better optimization for the data conversion. I've tried XML and the dbms_xmlstore but it was too slow. I am on 10g and don't have access to the log files or even the ability to trace anything. All I can do is look for better ways to do things and then try them.
Any suggestions or help to improve things would be welcome.
Warren Koch
The function converts the array of object into a custom delimited CLOB ( ; betwen values, | between rows) that looks like this:
prop1;prop2;prop3|prop1;prop2;prop3|prop1;prop2;prop3|prop1;prop2;prop3|
Here is the code I created.
CREATE OR REPLACE TYPE THE_IMAGE_TYPE AS OBJECT
IMAGE_NAME VARCHAR2(100),
IMAGE_SIZE INTEGER,
IMAGE_LOC INTEGER
CREATE OR REPLACE TYPE THE_IMAGE_TABLE AS TABLE OF THE_IMAGE_TYPE
CREATE GLOBAL TEMPORARY TABLE IMAGE_IMPORT
image_name VARCHAR2(25 BYTE),
loc NUMBER(11),
image_size NUMBER(11)
ON COMMIT PRESERVE ROWS
NOCACHE;
FUNCTION convert_image_data(
in_image_clob IN CLOB
RETURN the_image_table PIPELINED
AS
image_clob CLOB := in_image_clob;
image_delim_index PLS_INTEGER;
image_index PLS_INTEGER := 1;
row_string VARCHAR2(1000);
out_rec THE_image_type;
BEGIN
out_rec := the_image_type(NULL, NULL, NULL);
IF SUBSTR(in_image_clob, -1, 1) != '|'
THEN
image_clob := image_clob || '|';
END IF;
image_delim_index := INSTR(image_clob, '|', image_index);
WHILE image_delim_index > 0
LOOP
row_string := SUBSTR(image_clob, image_index, image_delim_index - image_index);
row_string := REPLACE(row_string || '::::', ':', ' :');
out_rec.image_name := SUBSTR(TRIM(REGEXP_SUBSTR(row_string, '[^:]+', 1, 1)), 1, 25);
out_rec.image_loc := make_number(REGEXP_SUBSTR(row_string, '[^:]+', 1, 2));
out_rec.image_size := make_number(REGEXP_SUBSTR(row_string, '[^:]+', 1, 3));
PIPE ROW(out_rec);
image_index := image_delim_index + 1;
image_delim_index := INSTR(image_clob, '|', image_index);
END LOOP;
RETURN;
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END;
Used in my code like this:
EXECUTE IMMEDIATE 'TRUNCATE TABLE image_import';
FOR x IN (SELECT * FROM TABLE(convert_image_data(in_imagelist))
WHERE image_name IS NOT NULL)
LOOP
INSERT INTO image_import (image_name, loc, image_size)
VALUES (x.image_name, x.image_loc, x.image_size);
END LOOP;Is there any chance you can just use 1 SQL statement here? I gave it a shot based on the string you posted, not by trying to reverse engineer your code so it's possible i got it entirely wrong :)
select
regexp_substr(image_row, '[^;]+', 1, 1) as image_name,
regexp_substr(image_row, '[^;]+', 1, 2) as image_size,
regexp_substr(image_row, '[^;]+', 1, 3) as image_loc
from
select
regexp_substr(the_data, '[^|]+', 1, level) as image_row
from
select
'prop1;prop2;prop3|prop4;prop5;prop6|propa;propb;propc|propd;prope;propf|' as the_data
from dual
connect by level <= length (regexp_replace(the_data, '[^|]+')) + 1
17 where image_row is not null;
IMAGE_NAME IMAGE_SIZE IMAGE_LOC
prop1 prop2 prop3
prop4 prop5 prop6
propa propb propc
propd prope propf
4 rows selected.
Elapsed: 00:00:00.00 -
XML into table: Why do all my insert values are NULL?
Hello,
I'm pretty new in XML ... then I still learn a lot by myself !!!
I surfed to a lot of forums and examples ....
I have a XML file. I built a XSL file in order to insert a part of my XML file into a table.
The 2 files are loaded as CLOB into a DB table.
I wrote a PLSQL procedure for this job.
We are on a DB 10gR2.
As a result, all the inserted columns are loaded with NULL !!!! ....
I must have done something wrong ... for sure !!! but I cannot figure out.
Here are the files and procedures:
*<?xml version="1.0" ?>*
*<purchaseOrder orderDate="1999-10-20">*
*<shipTo country="US">*
*<name>Alice Smith</name>*
*<street>123 Maple Street</street>*
*<city>Mill Valley</city>*
*<state>CA</state>*
*<zip>90952</zip>*
*</shipTo>*
*<billTo country="US">*
*<name>Robert Smith</name>*
*<street>8 Oak Avenue</street>*
*<city>Old Town</city>*
*<state>PA</state>*
*<zip>95819</zip>*
*</billTo>*
*<comment>Hurry, my lawn is going wild!</comment>*
*<items>*
*<item partNum="872-AA">*
*<productName>Lawnmower</productName>*
*<quantity>1</quantity>*
*<USPrice>148.95</USPrice>*
*<comment>Confirm this is electric</comment>*
*</item>*
*<item partNum="926-AA">*
*<productName>Baby Monitor</productName>*
*<quantity>1</quantity>*
*<USPrice>39.98</USPrice>*
*<shipDate>1999-05-21</shipDate>*
*</item>*
*</items>*
*</purchaseOrder>*
The XLS file is :
*<?xml version="1.0"?>*
*<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">*
*<xsl:output method="xml" media-type="text/xml" />*
*<xsl:template match="/">*
*<insert>*
*<Table>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_club'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*<Columns>*
*<Column>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_code'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*</Column>*
*<Column>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_name'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*</Column>*
*<Column>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_price'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*</Column>*
*</Columns>*
*<xsl:for-each select="purchaseOrder/items">*
*<Rowset>*
*<xsl:for-each select="item">*
*<Row>*
*<Column>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_code'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*<xsl:value-of select="@partNum" />*
*<!--layer=Default-->*
*</Column>*
*<Column>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_name'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*<xsl:value-of select="productName" />*
*<!--layer=Default-->*
*</Column>*
*<Column>*
*<xsl:attribute name="source">*
*<xsl:value-of select="'item_price'" />*
*<!--layer=Default-->*
*</xsl:attribute>*
*<xsl:value-of select="USPrice" />*
*<!--layer=Default-->*
*</Column>*
*</Row>*
*</xsl:for-each>*
*<!--layer=Default-->*
*</Rowset>*
*</xsl:for-each>*
*<!--layer=Default-->*
*</Table>*
*</insert>*
*</xsl:template>*
*</xsl:stylesheet>*
*<!--xsl-easyControl - (C) 2003-2007 SoftProject GmbH-->*
*<!--Source: "purchaseOrder_clubDev.xml"|Type:"xml"-->*
*<!--Destination: "Connexion_XSL_SCFOX.xac"|Type:"Connexion_XSL_SCFOX"-->*
*<!--Document type: Input Driven-->*
The XML files are successfully inserted into a CLOB colum :
ID FILENAME XML
24 item_club.xsl <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.or
25 purchaseOrder.xml <?xml version="1.0" ?> <purchaseOrder orderDate="1999-10-20">
And the procedure is :
CREATE OR REPLACE PROCEDURE load_xml( p_dir IN VARCHAR2
, p_filename IN VARCHAR2) AS
insCtx DBMS_XMLSave.ctxType;
rows NUMBER;
l_bfile BFILE := BFILENAME(p_dir, p_filename);
l_clob CLOB;
l_bfile_xsl BFILE;
l_clob_xsl CLOB;
begin
dbms_output.put_line('p_filename='||p_filename);
insCtx := DBMS_XMLSave.newContext('sipmo.item_club'); -- get the save context..!
dbms_output.put_line('item_club.xsl context='||insCtx);
--IMPORTANT... ignore la casse
DBMS_XMLSave.setIgnoreCase(insCtx, 1);
--select XSL file item_club.xsl
l_bfile_xsl := BFILENAME(p_dir, 'item_club.xsl');
DBMS_LOB.createtemporary (l_clob_xsl, TRUE);
DBMS_LOB.fileopen( l_bfile_xsl, DBMS_LOB.file_readonly);
DBMS_LOB.loadfromfile( l_clob_xsl, l_bfile_xsl, DBMS_LOB.getlength(l_bfile_xsl));
dbms_output.put_line('item_club.xsl length='||DBMS_LOB.getlength(l_bfile_xsl));
DBMS_LOB.fileclose(l_bfile_xsl);
DBMS_XMLSave.SETXSLT(insCtx, l_clob_xsl);
dbms_output.put_line('step 10');
DBMS_XMLSave.clearUpdateColumnList(insCtx); -- clear the update settings
DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_CODE');
DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_NAME');
DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_PRICE');
-- Now insert into the table
dbms_output.put_line('step 90');
rows := DBMS_XMLSave.insertXML(insCtx, l_clob);
dbms_output.put_line('step 100 rows='||rows);
DBMS_XMLSave.closeContext(insCtx);
DBMS_LOB.freetemporary (l_clob_xsl);
DBMS_LOB.freetemporary (l_clob);
END;
The result table is like this :
scfx>select * from item_club;
ITEM_CODE ITEM_NAME ITEM_PRICE
All the columns of each row are NULL !!!
Why?
Do you have any advice ?
Thanks if advance,
OlivierSo, if I understand what you mean ... I should write something like this :
insert into item_club
select t2.partnum, t2.productname, to_number(replace(t2.usprice, '.', ','))
from odab_xml_tab t
, xmltable('*' passing t.xml.extract('purchaseOrder/items/*')
columns partNum varchar2(35) path '@partNum'
, productName varchar2(35) path 'productName'
, USPrice varchar2(35) path 'USPrice'
) t2
Its a change in our code.. but that looks nice !!!
Thanks,
Olivier -
Hi All,
I want to create a procedure in which , I provide table name and XML file location, The procedure goes at that location and pick XML file and load in to the table. Can this is possible ??
Thanks
Best Regards,
AdilThe following code very interesting.
DROP TABLE TBL_TEST
CREATE TABLE "TBL_TEST"
( "N" NUMBER,
"V" VARCHAR2(20),
"D" DATE)
CREATE OR REPLACE DIRECTORY XML_DIR AS 'C:\XMLDIR';
CREATE OR REPLACE
PROCEDURE INSERT_XML_TBL_TEST(p_directory in varchar2,
p_filename in varchar2)
--p_tableName in varchar2 DEFAULT 'TBL_TEST')
AS
insCtx DBMS_XMLSTORE.CTXTYPE;
rows NUMBER;
xmlDoc CLOB := null;
BEGIN
if (dbms_xdb.existsResource('/public/'||lower(p_filename))) then
dbms_xdb.deleteResource('/public/'||lower(p_filename));
end if;
v_return := DBMS_XDB.CREATERESOURCE(abspath => '/public/'||lower(p_filename),
data => BFILENAME(UPPER(p_directory),LOWER(p_filename)));
COMMIT;
SELECT RV.RES.GETCLOBVAL()
INTO xmldoc
FROM RESOURCE_VIEW RV WHERE ANY_PATH = '/public/'||lower(p_filename);
insCtx := DBMS_XMLSTORE.newcontext('TBL_TEST');
dbms_xmlstore.SetRowTag(insctx,'TBL_TEST_ROW');
dbms_xmlstore.clearkeycolumnlist(insctx);
dbms_xmlstore.setupdatecolumn(insctx,'N');
dbms_xmlstore.setupdatecolumn(insctx,'V');
dbms_xmlstore.setupdatecolumn(insctx,'D');
rows := dbms_xmlstore.insertxml(insctx, xmldoc);
dbms_output.put_line(rows ||' rows inserted');
dbms_xmlstore.closecontext(insctx);
END;
select * from tbl_test
begin
INSERT_XML_TBL_TEST('XML_DIR','tbl_test.xml');
end;
and I created XMLDIR folder on C:\
and there have a xml file name is tbl_test.xml and content this file is
<TBL_TEST_ROWSET>
<TBL_TEST_ROW num="1">
<N>11</N>
<V>Testing 11</V>
</TBL_TEST_ROW>
<TBL_TEST_ROW num="2">
<N>10</N>
<V>Testing 11</V>
</TBL_TEST_ROW>
</TBL_TEST_ROWSET>
Mahir M. Quluzade
Edited by: Mahir M. Quluzade on Nov 24, 2010 11:47 AM -
Hi,
I'm trying to convert an xml object to a plain actionscript
3.0 object. I've looked at SimpleXMLDecoder but without much luck.
Any help or advice would be appreciatedHave you tried
[code]
var data:Object = xmlData as Object;
[/code]
Although one of the capabilities with AS3 and E4X is that xml
data is accesible as an object. I mean
xmlData.node1.node2.(@attribute1) etc...
Maybe you are looking for
-
SWF Movie Not Active In Webpage Until Clicked Once
Hi All, My friend is a newbie to Flash and I am helping her a bit with creating a website. She has created a Flash movie that is a pictue slideshow that has a 'Next' and 'Previous' button at the bottom. Everything work fine when playing the movie in
-
I know it's a newb question but a forum search didn't help me yet... I've been using AA 1.0 for the last 5 years on my HP DV4170US laptop and when I needed to record something from an audio stream or from a DVD, etc. - I'd go to the volume thing in b
-
How to attach a file in iphone
how to attach a file in iphone 4s
-
How to update HTML template manually
Hi, I have added a custom field in SHip-To address screen in Shopping cart in BBPSC01 and added a functionality. Found it is working fine in SAP GUI side. It is not reflecting in URL. But to reflect the same in URL, can anyone let me know what HTML c
-
Hi! I've tried searching this topic in previous posts, but can't seem to find any information about it. I use flags on my photos when I want to upload them to online albums b/c it's visually easier for me to see which ones I want to use. I accidental