Need XML Structure as output
Hi,
I have an input structure in the below format.
Sl.No*Name*Salary
101*Hari*45000
102*Ram*30000
103* * 25000
I want XML format in the below format.
<RecordSet>
<Record1>
<Sl.No> 101 </Sl.No>
<Name> Hari </Name>
<Salary> 45000</Salary>
</Record1>
<Record2>
<Sl.No> 102 </Sl.No>
<Name> Ram</Name>
<Salary> 30000</Salary>
</Record2>
<Record3>
<Sl.No> 102 </Sl.No>
<Name> </Name>
<Salary> 25000</Salary>
</Record3>
</Recordset>
So, basically if I have 100records, it should populate 100 records in XML.
In the above input file, * is the field separator and <NL> new line is the record separator.
Any pointers are highly appreciated.
Regards,
Babu
repeated post http://forum.java.sun.com/thread.jspa?threadID=5252191&tstart=0
Similar Messages
-
Need XML Structure & Parse Advice
Hello,
I am a CF Programmer who would normally use SQL as a datasource, however for a new project I thought I'd use XML where possible. I wanted to create an XML based navigation for the site but am having trouble figuring out the right way to structure the XML items and also parsing them back out.
The site is for travel type info, and as we grow counties, areas, projects, etc. will be added - So I saw the structure like so:
<data>
<county>County A</county>
<project>A Map</project>
<project>A Article</project>
<project>A Book</project>
</data>
This is of course wrong, and i have tried variations of the structure, but I know one of you gurus can point me in the right direction...
The gist is that each "County" can and will have many "Projects" associated with it. So I wanted to define some Counties and have their 'children' be the associated projects, so a nav would read like;
COUNTY A
A Map
A Article
A Book
COUNTY B
B Map
B Article
B Map
But no matter what I do, spry, cfml, etc I cannot query the XML for the PARENT (County) and then the CHILDREN that go only with that Parent.
without repeating the parent with each child.
Obviously this is not a big deal, for some reasons my skillset is broken today (including finding a tutorial that solves this!) So any point in the right direction will be greatly appreciated.
ThanksI did a project while back for a library of forms and documents. Each form or document had a category. I had to display the category then children listed under that category with links. The XML feed from the database in relation to yours was like
<data>
<project>
<projectname>A Map</projectname>
<county>County A</county>
<project>
<data>
In order to display the project name under their county, I used the Muenchian Method for sorting in the XSL file. This sorting method works great on small and large files. I use this method setting lightbox of with galleries, and sometimes for loading the spry menu for navigation.
Here is a link for the method:
http://www.jenitennison.com/xslt/grouping/muenchian.html
David Pearson
www.saludalabs.com
www.workhorsecreative.net -
XSLT Mapping to convert u201C.CSVu201D file into XML Structure.
Hi All,
I wanted to know can we use XSLT Mapping to convert u201C.CSVu201D file into XML Structure.
I am communicating between two XI Systems. First XI system is going to give u201C.CSVu201D file as main document. I need to post IDOC Corresponding to this. So what I want to do is read this u201C.CSVu201D file (Main document in payload) and first convet it into XML and then use second mapping which will convert XML to IDOC.
I know this is possible with JAVA Mapping but just wanted to confirm can we do this with XSLT mapping as well?
Regards,
GouriHi Amit,
I know this way it shd work as i am able see other XSLT files. But this particular file is not visible.
I am copying following code only in sample.xslt file.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="fn"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="2.0" exclude-result-prefixes="xs fn">
<xsl:output indent="yes" encoding="US-ASCII" />
<xsl:param name="pathToCSV" select="'file:///c:/csv.csv'" />
<xsl:function name="fn:getTokens" as="xs:string+">
<xsl:param name="str" as="xs:string" />
<xsl:analyze-string select="concat($str, ',')" regex='(("["]*")+|[,]*),'>
<xsl:matching-substring>
<xsl:sequence select='replace(regex-group(1), "^""|""$|("")""", "$1")' />
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:function>
<xsl:template match="/" name="main">
<xsl:choose>
<xsl:when test="unparsed-text-available($pathToCSV)">
<xsl:variable name="csv" select="unparsed-text($pathToCSV)" />
<xsl:variable name="lines" select="tokenize($csv, ' ')" as="xs:string+" />
<xsl:variable name="elemNames" select="fn:getTokens($lines[1])" as="xs:string+" />
<root>
<xsl:for-each select="$lines[position() > 1]">
<row>
<xsl:variable name="lineItems" select="fn:getTokens(.)" as="xs:string+" />
<xsl:for-each select="$elemNames">
<xsl:variable name="pos" select="position()" />
<elem name="{.}">
<xsl:value-of select="$lineItems[$pos]" />
</elem>
</xsl:for-each>
</row>
</xsl:for-each>
</root>
</xsl:when>
<xsl:otherwise>
<xsl:text>Cannot locate : </xsl:text><xsl:value-of select="$pathToCSV" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is this correct?
-Gouri -
Download XML structure to Application server
Hi all.
I am generating an XML structure based on some data that I select from HR e-Recruiting, and I need to save the generated XML file on the application server, not the presentation server (local computer). Most of the code I have found on SDN (contributed by Robert Eijpe) and I must admit that I do not understand everything the code does.
I have attached the source code and the resulting XML structure:
REPORT zhr_test2_tk.
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
DATA: l_element_position TYPE REF TO if_ixml_element,
l_element_title TYPE REF TO if_ixml_element,
* l_element_flight TYPE REF TO if_ixml_element,
* l_element_from TYPE REF TO if_ixml_element,
* l_element_to TYPE REF TO if_ixml_element,
l_element_dummy TYPE REF TO if_ixml_element,
l_value TYPE string.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
DATA: lt_erec TYPE TABLE OF hrp5126,
l_erec TYPE hrp5126.
DATA: date(10),
time(4),
filepath TYPE string.
CONSTANTS: filedir TYPE string VALUE 'C:tmp',
filename TYPE string VALUE 'ZHR_test'.
START-OF-SELECTION.
* fill internal table
SELECT * FROM hrp5126 INTO TABLE lt_erec.
* Start filling xml DOM object from internal table lt_erec.
LOOP AT lt_erec INTO l_erec.
*Create the root node 'position'
IF sy-tabix EQ 1.
* create an ixml factory
l_ixml = cl_ixml=>create( ).
* create Document Object Model
l_document = l_ixml->create_document( ).
* Fill root node with value 'position'
l_element_position = l_document->create_simple_element(
name = 'position'
parent = l_document ).
ENDIF.
IF sy-tabix GT 1.
* create element jobtitle as child of position
l_value = l_erec-jobtitle.
l_element_title = l_document->create_simple_element(
name = 'job_title'
parent = l_element_position
value = l_value ).
l_value = l_erec-empl_start_date.
l_element_dummy = l_document->create_simple_element(
name = 'StartDate'
parent = l_element_title
value = l_value ).
l_value = l_erec-empl_end_date.
l_element_dummy = l_document->create_simple_element(
name = 'EndDate'
parent = l_element_title
value = l_value ).
ENDIF.
ENDLOOP.
IF sy-subrc NE 0.
WRITE: 'No data in table hrp5125'.
ENDIF.
* create a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
* connect internal XML table to streamfactory
l_ostream = l_streamfactory->create_ostream_itable(
table = l_xml_table ).
* render the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
* Get time and date
WRITE sy-uzeit+2(2) TO time+2(2).
WRITE sy-uzeit+0(2) TO time+0(2).
WRITE sy-datum+4(2) TO date+0(2).
WRITE sy-datum+6(2) TO date+2(2).
WRITE sy-datum+0(4) TO date+4(4).
*Build filename with date and time reference
CONCATENATE filedir filename date time '.xml' INTO filepath.
<i>* This is the code I hope to modify in order to save the xml structure on the application server, with a specified filepath.</i>
<b> OPEN DATASET filepath FOR OUTPUT IN BINARY MODE.
LOOP AT lt_erec into l_erec.
TRANSFER l_erec TO filepath.
ENDLOOP.
CLOSE DATASET filepath.</b>
* save XML document
l_xml_size = l_ostream->get_num_written_raw( ).
*This is the code for download to local computer
* CALL METHOD cl_gui_frontend_services=>gui_download
* EXPORTING
* bin_filesize = l_xml_size
* filename = filepath
* filetype = 'BIN'
* CHANGING
* data_tab = l_xml_table
* EXCEPTIONS
* file_write_error = 1
* no_batch = 2
* gui_refuse_filetransfer = 3
* invalid_type = 4
* no_authority = 5
* unknown_error = 6
* header_not_allowed = 7
* separator_not_allowed = 8
* filesize_not_allowed = 9
* header_too_long = 10
* dp_error_create = 11
* dp_error_send = 12
* dp_error_write = 13
* unknown_dp_error = 14
* access_denied = 15
* dp_out_of_memory = 16
* disk_full = 17
* dp_timeout = 18
* file_not_found = 19
* dataprovider_exception = 20
* control_flush_error = 21
* OTHERS = 22.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
<b>XML result:</b>
<?xml version="1.0" ?>
<position>
<job_title>Test Process Template</job_title>
<job_title>jjjj</job_title>
<job_title>Test Job Req. 20092005</job_title>
<job_title>Created 22.09</job_title>
<job_title>title 07.12</job_title>
<job_title>Test fra portal</job_title>
<job_title>Test med 100328</job_title>
<job_title>Test restricted recruiter</job_title>
<job_title>Test restricted recruiter</job_title>
<job_title>Workshop requisition job title</job_title>
</position>
Any help is greatly appreciated.
Best Regards,
Thomas KjelsrudHi Guillaume,
The thing is that the code I presented to you is incorrect. I am asking the question of how to download / save an XML (not an internal table) to the application server. Using the gui_download will not satisfy me need, as it only downloads to the presentation server (local machine that I run my SAP session on), when I need it to download to the application server. The Open Dataset and Transfer statements are (as far as I know) only used for downloading internal tables to the application server.
So I guess my question should be like this instead:
"How can I save the XML structure that is created in the above program to the file system in the application server?"
It is a bit hard to explain this, so please ask me more questions if required.
Thank you for helping.
Best regards,
Thomas -
Changing the XML Structure in "Submit as XML"
Dear all,
We have two PDF Templates which are submitted via a WebService using Submit as XML. For both templates we need the same structured XML output.
Form 1 has the hierarchy like this (all subforms):
Company
Subsdiary
Responsibles
Footer
so the xml looks like
<creditrequest>
<company>...</company>
<subsdiary>...</subsdiary>
<responsible>...</responsible>
<footer>...</footer>
</creditrequest>
Form 2 has the hiearchy like this (all subforms):
Responsibles
Subsidiary
Company
Footer
and the xml looks like
<creditrequest>
<responsible>...</responsible>
<subsdiary>...</subsdiary>
<company>...</company>
<footer>...</footer>
</creditrequest>
So my question is how can influence the XML output order without changing the PDF hiearchy. This way I can change the XML output for Form 1 or Form 2 and both files would have the same XML structure to submit.
I have checked the presubmit event and the javascript API to change XML string programmaticly but I couldn't find any possiblity to read/write the XML to submit.
Thanks,
KorayYou can use JDOM and DOM. They are classes that load the XML File on memory and then you can modify it. I strongly recommend JDOM.
-
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). -
Hej!
I am trying to but an entire XML structure into a CDATA-tag. But have not been successful.
Im using Xquery and trying to somthing like this:
I have an variable $example which contains a XML structure. For example:
$example = <elementA><A1>valueA1</A1><A2><A2a>text2a</A2a><A2b>text2b</A2b></A2><A3>valueA3</A3></elementA>
I want to something like this <![CDATA[$example]]> to be expanded to <![CDATA[<elementA><A1>valueA1</A1><A2><A2a>text2a</A2a><A2b>text2b</A2b></A2><A3>valueA3</A3></elementA>]]>
I have tried in many ways (eg by doing concat("<![CDATA[", $example, "]]>") ) and ended up with a CDATA tag that contains only the value of the elements in the tags of A1, A2 and A3. for example the CDATA that is created looks something like this:
<![CDATA[valueA1text2atext2bvalueA3]]>
instead of
<![CDATA[<elementA><A1>valueA1</A1><A2><A2a>text2a</A2a><A2b>text2b</A2b></A2><A3>valueA3</A3</elementA>]]>
I would really be grateful for any suggestions or tips and pointers on how to solve this.
Best Regards
Ninib
Edited by: NinibEDB on 2010-nov-09 17:35Hi,
Which XQuery processor are you using?
According to the W3C specifications, the output of CDATA section is part of the serialization process, not the XQuery evaluation. So it's up to the implementor to provide the necessary options.
The option we need here is the "cdata-section-elements" parameter :
http://www.w3.org/TR/xslt-xquery-serialization/#XML_CDATA-SECTION-ELEMENTS
For example, using the Saxon XQuery processor :
declare option saxon:output "omit-xml-declaration=yes";
declare option saxon:output "cdata-section-elements=test";
let $example := "<elementA><A1>valueA1</A1><A2><A2a>text2a</A2a><A2b>text2b</A2b></A2><A3>valueA3</A3></elementA>"
return <test>{$example}</test>which gives :
<test><![CDATA[<elementA><A1>valueA1</A1><A2><A2a>text2a</A2a><A2b>text2b</A2b></A2><A3>valueA3</A3></elementA>]]></test> -
Idoc Order05 Mapping into SRM PO XML Structure
Hello All,
I need to map Idoc order05 from ERP system into SAP provided SRM XML Structure.
Anyone has done this sort of mapping before.
Let me know the details as XML has got some 4800 fields and Idoc has some 800 fields and SRM XML seems to be superset of Idoc from ERP.
Regards,PankajHi Lynton,
the source structure is an XML purchase order. There is a business package available in XI for SAP SRM 5.5 SERVER (that's SRM 5), you will have to load this in XI and use the XML purchase order structure in that business package, this is your source message. Mapping is generally done in XI, so you don't have to implement any BADI.
In SRM customising you have to activate the use of Exchange Infrastructure and make some settings for the use of XI.
In the vendor master you will have to change the sending method to XI/XML, this will then automatically create the correct output for that vendor. You can look at this using the SXI_MONITOR transaction (or SXMB_MONI) after ordering a PO.
Regards,
Robin -
Extracting XML to required output
Hi Gurus, Need some help for extracting data from XML to Relation Query Output format.Below is the XML string.
<LineItems>
<OBJECT>FIRST</OBJECT>
<LineItem ItemNumber="1">
<Description>A Night to Remember</Description>
<Part Id="715515009058" UnitPrice="39.95" Quantity="2"/>
</LineItem>
<LineItem ItemNumber="2">
<Description>The Unbearable Lightness Of Being</Description>
<Part Id="37429140222" UnitPrice="29.95" Quantity="2"/>
</LineItem>
<LineItem ItemNumber="3">
<Description>Sisters</Description>
<Part Id="715515011020" UnitPrice="29.05" Quantity="4"/>
</LineItem>
<OBJECT>SECOND</OBJECT>
<LineItem ItemNumber="4">
<Description>A Night to Remember</Description>
<Part Id="715515009059" UnitPrice="49.95" Quantity="1"/>
</LineItem>
<LineItem ItemNumber="5">
<Description>The Unbearable Lightness Of Being</Description>
<Part Id="37429140260" UnitPrice="30.95" Quantity="3"/>
</LineItem>
<LineItem ItemNumber="6">
<Description>Sisters</Description>
<Part Id="715515011061" UnitPrice="19.95" Quantity="5"/>
</LineItem>
</LineItems>I want output to be like this:
Object Item_Number Description Part_id Unit_price Quantity
FIRST 1 A Night to Remember 715515009058 39.95 2
FIRST 2 The Unbearable Lightness Of Being 37429140222 29.95 2
FIRST 3 Sisters 715515011020 29.05 4
SECOND 4 A Night to Remember 715515009059 49.95 1
SECOND 5 The Unbearable Lightness Of Being 37429140260 30.95 3
SECOND 6 Sisters 715515011061 19.95 5BluShadow wrote:
Unfortunately, your XML is not well formed in relational terms, i.e. there's nothing to relate LineItem's to any particular OBJECT. You can't just assume that because an OBJECT appears before the LineItem's that those LineItem's belong to it. If you considered an XML schema to describe what you've shown in your XML it would be (in simplistic terms) a LineItems element containing any number of "OBJECT" or "LineItem" elements.... nothing relating those to each other.
You'd need to structure your XML so the LineItem elements are contained within the OBJECT elements... e.g.Although I entirely agree with your comments, just a few words about :
You can't just assume that because an OBJECT appears before the LineItem's that those LineItem's belong to itContrary to the relational way, the order does matter in an XML document.
However, for obvious reasons like the ones we're seeing here, it's not a good practice to use such structures as a schema can't describe it easily.
One way of getting the output :
SQL> with t as (select xmltype('<LineItems>
2 <OBJECT>FIRST</OBJECT>
3 <LineItem ItemNumber="1">
4 <Description>A Night to Remember</Description>
5 <Part Id="715515009058" UnitPrice="39.95" Quantity="2"/>
6 </LineItem>
7 <LineItem ItemNumber="2">
8 <Description>The Unbearable Lightness Of Being</Description>
9 <Part Id="37429140222" UnitPrice="29.95" Quantity="2"/>
10 </LineItem>
11 <LineItem ItemNumber="3">
12 <Description>Sisters</Description>
13 <Part Id="715515011020" UnitPrice="29.05" Quantity="4"/>
14 </LineItem>
15 <OBJECT>SECOND</OBJECT>
16 <LineItem ItemNumber="4">
17 <Description>A Night to Remember</Description>
18 <Part Id="715515009059" UnitPrice="49.95" Quantity="1"/>
19 </LineItem>
20 <LineItem ItemNumber="5">
21 <Description>The Unbearable Lightness Of Being</Description>
22 <Part Id="37429140260" UnitPrice="30.95" Quantity="3"/>
23 </LineItem>
24 <LineItem ItemNumber="6">
25 <Description>Sisters</Description>
26 <Part Id="715515011061" UnitPrice="19.95" Quantity="5"/>
27 </LineItem>
28 </LineItems>') as xml from dual)
29 --
30 -- end of test data
31 --
32 select x.*
33 from t
34 , xmltable(
35 'for $i in /LineItems/LineItem
36 return element r {
37 $i/preceding-sibling::OBJECT[1]
38 , $i
39 }'
40 passing t.xml
41 columns object varchar2(15) path 'OBJECT'
42 , item_number number path 'LineItem/@ItemNumber'
43 , description varchar2(40) path 'LineItem/Description'
44 , part_id varchar2(15) path 'LineItem/Part/@Id'
45 , unit_price number path 'LineItem/Part/@UnitPrice'
46 , quantity number path 'LineItem/Part/@Quantity'
47 ) x
48 ;
OBJECT ITEM_NUMBER DESCRIPTION PART_ID UNIT_PRICE QUANTITY
FIRST 1 A Night to Remember 715515009058 39,95 2
FIRST 2 The Unbearable Lightness Of Being 37429140222 29,95 2
FIRST 3 Sisters 715515011020 29,05 4
SECOND 4 A Night to Remember 715515009059 49,95 1
SECOND 5 The Unbearable Lightness Of Being 37429140260 30,95 3
SECOND 6 Sisters 715515011061 19,95 5
6 rows selected -
How to open a form from Oracle XML Report .xls Output?
Hi All,
We have a requirement wherein we have one complex SQL query, requirement is to fetch the data from that query and show it to the user. So far, so good. We can either create a report thru' UTL file to show the output to the user or can create a XML report whose output can be in the excel format.
Now user wants to have a hyperlink i.e. when he clicks the BSA (Blanket Sales Agreement) from the report output, it should be able to route him to BSA screen (oracle form), so that he can directly correct the issue with that corresponding BSA on which he clicked.
i.e. requirement is to create a a hyperlink from report output which will route the user to that oracle form with the BSA queried.
Not sure how can we implement this. If anybody has come across this type of requirement, please share your ideas and the approach used so as to accomplish this. Any inputs on this will be highly appreciated.
Cheers!
-SumirHello Sumir,
we create reports in an XML format using http://matzberger.de/oracle/spreadsheet-en.html.
Within these files you can create hyperlinks to a forms application like
http://<applicationserver>/forms/frmservlet?config=xy&p_autoinit_module=ab&p_autoinit_arg=123
With these parameters we call a default forms module (welcome screen) and then start module ab and execute a query for 123. The user then can directly access the data he needs.
Regards
Marcus -
A better way to generate the needed XML?
I am working on a 10.2 system and looking to see if there is a better way to generate the resulting XML than what I have come up with. Here is a test case and the output it generates. I don't really like querying the table for each column needed as the real table has eight columns I am pulling. I would like to make one pass on person_h and get the info needed instead of making eight passes, but not sure if it is possible.
with person_h as
(select 1 id, 'M' gender, 'W' race, '170' weight from dual union all
select 1, 'M', 'W', '170' from dual union all
select 1, 'M', 'W', '180' from dual union all
select 1, 'M', NULL, '175' from dual union all
select 1, NULL, 'W', NULL from dual
select xmlelement("Person",
(select xmlagg(xmlelement("Sex", gender))
from (select distinct gender
from person_h
where id = 1
and gender is not null) pg),
(select xmlagg(xmlforest(race as "Race"))
from (select distinct race
from person_h
where id = 1) pg),
(select xmlagg(xmlforest(weight as "Weight"))
from (select distinct weight
from person_h
where id = 1) pg)
).getstringval()
from dual;
Output
<Person>
<Sex>M</Sex>
<Race>W</Race>
<Weight>170</Weight>
<Weight>175</Weight>
<Weight>180</Weight>
</Person>Note: Previously posted on the XML DB forum at A better way to generate the needed XML? but still looking for other solutions so putting in front of more eyes here. I have considered using a WITH statement to do the initial query on person_h but haven't tested that yet to see what Oracle really will do as just getting back around to this lower priority task of mine.I'm using the WITH statement to simulate a table and DUAL/UNION ALL to create data in that "table". I've seen it used plenty of times in this forum so not sure why a problem for this example. The actual SQL/XML statement hits that "base table" three times, so I didn't include all eight columns because three columns is sufficient to show the problem in the way I coded the SQL. Following the SQL is the sample OUTPUT that SQL statement generates and that is the output I created and need. I'm just looking for other options to achieve the listed output.
-
Attribute "action" missing or wrong XML structure
Does anyone know what's the problem of below XML format ? I want to triggle a stored procedure in AS/400 from SAPXI after receiving records. But the message "No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)" is found
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_t1 xmlns:ns0="http://cxx.xxx.hk/zxxxpxx/jdbc">
<storedProcedurename>
<action>EXECUTE</action>
<table>LIBRARY.PROCNAME</table>
<TRNX_TYPE IsInput="true" TYPE="CHAR">content 1</TRNX_TYPE>
<TRNX_NO IsInput="true" TYPE="CHAR">content 2</TRNX_NO>
</storedProcedurename>
</ns0:MT_t1>Dear all,
Thanks for your help and now I can submit a stored procedure via SAP XI by using below XML format. I try to define two output parameters at the end of this XML. How to get the return value ? Should I define a response message type ? and what is the XML format ?
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_SYN_t1 xmlns:ns0="http://xxx.xxu.hk/zxxxpgs/jdbc">
<update>
<storedProcedurename action="EXECUTE">
<table>LIBRARY.PANSYTEST</table>
<TRNX_TYPE IsInput="TRUE" TYPE="CHAR">4</TRNX_TYPE>
<TRNX_NO IsInput="TRUE" TYPE="CHAR">2</TRNX_NO>
<ACTIN IsInput="TRUE" TYPE="CHAR">23</ACTIN>
<RCRT_DATM IsInput="TRUE" TYPE="CHAR">3</RCRT_DATM>
<RCRT_USER IsInput="TRUE" TYPE="CHAR">8</RCRT_USER>
<STUD_ID IsInput="TRUE" TYPE="CHAR">8</STUD_ID>
<AWD_SEQ IsInput="TRUE" TYPE="CHAR">6899</AWD_SEQ>
<AW_PSDATE IsInput="TRUE" TYPE="CHAR">89</AW_PSDATE>
<AW_PEDATE IsInput="TRUE" TYPE="CHAR">99</AW_PEDATE>
<OUT_TRNX_TYPE IsOutput="TRUE" TYPE="CHAR">4</OUT_TRNX_TYPE>
<OUT_TRNX_NO IsOutput="TRUE" TYPE="CHAR">2</OUT_TRNX_NO>
</storedProcedurename>
</update>
</ns0:MT_SYN_t1> -
How create an xml structure in a pdf form
Hi genius guys,
some one can help me to create a correct xml structure (root, subroot1, subroot2, etc etc) in a pdf form and not only the single tag?
Example: I give a pdf with form to be filled and after I extract xml data. Now I have this:
<?xml version="1.0" encoding="UTF-8"?>
<fields xmlns:xfdf="http://ns.adobe.com/xfdf-transition/"
><A1classe
>1995</A1classe
><A1cognome
>Fanna</A1cognome
><A1nome
>Tonino</A1nome
><Annodifondazione xfdf:original="Anno di fondazione"
>1965</Annodifondazione
><C1classe
>1976</C1classe
><C1cognome
>Di Gennaro</C1cognome
><C1nome
>Antonio</C1nome
><Campionato
>ECCELLENZA</Campionato
><Campodigioco
>Comunale di Villabartolomea</Campodigioco
><Colorisociali
>Giallo Rosso</Colorisociali
><D1classe
>1984</D1classe
><D1cognome
>Fontolan</D1cognome
><D1nome
>Beppe</D1nome
><Girone
>A</Girone
><P1classe
>1980</P1classe
><P1cognome
>Zoff</P1cognome
><P1nome
>Dino</P1nome
><P2classe
>1974</P2classe
><P2cognome
>Garella</P2cognome
><P2nome
>Claudio</P2nome
><S1cognome
>Baudo</S1cognome
><S1mansione
>Presidente</S1mansione
><S1nome
>Pippo</S1nome
><S2cognome
>Togni</S2cognome
><S2mansione
>Vice Presidente</S2mansione
><S2nome
>Darix</S2nome
><Sede
>Via Pisacane,8 - Villabartolomea</Sede
><Squadra
>VILLABARTOLOMEA</Squadra
><T1cognome
>Dallara</T1cognome
><T1mansione
>Allenatore</T1mansione
><T1nome
>Toni</T1nome
><T2cognome
>Silvan</T2cognome
><T2mansione
>Magazziniere</T2mansione
><T2nome
>Mago</T2nome
></fields
>
and I need this:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xfdf="http://ns.adobe.com/xfdf-transition/"
><attaccanti>
<A1classe
>1995</A1classe
><A1cognome
>Fanna</A1cognome
><A1nome
>Tonino</A1nome
>
</attaccanti>
<Annodifondazione xfdf:original="Anno di fondazione"
>1965</Annodifondazione
>
<centrocampisti>
<C1classe
>1976</C1classe
><C1cognome
>Di Gennaro</C1cognome
><C1nome
>Antonio</C1nome>
</centrocampisti>
<Campionato
>ECCELLENZA</Campionato
><Campodigioco
>Comunale di Villabartolomea</Campodigioco
><Colorisociali
>Giallo Rosso</Colorisociali
>
<difensori>
<D1classe
>1984</D1classe
><D1cognome
>Fontolan</D1cognome
><D1nome
>Beppe</D1nome
></difensori>
<Girone
>A</Girone
><portieri>
<P1classe
>1980</P1classe
><P1cognome
>Zoff</P1cognome
><P1nome
>Dino</P1nome
><P2classe
>1974</P2classe
><P2cognome
>Garella</P2cognome
><P2nome
>Claudio</P2nome
></portieri>
<societa>
<S1cognome
>Baudo</S1cognome
><S1mansione
>Presidente</S1mansione
><S1nome
>Pippo</S1nome
><S2cognome
>Togni</S2cognome
><S2mansione
>Vice Presidente</S2mansione
><S2nome
>Darix</S2nome
></societa>
<Sede
>Via Pisacane,8 - Villabartolomea</Sede
><Squadra
>VILLABARTOLOMEA</Squadra
><tecnici>
<T1cognome
>Dallara</T1cognome
><T1mansione
>Allenatore</T1mansione
><T1nome
>Toni</T1nome
><T2cognome
>Silvan</T2cognome
><T2mansione
>Magazziniere</T2mansione
><T2nome
>Mago</T2nome
>
</tecnici></root
>
Thanx, PaoloI solve the trouble using "." to separate the tagname and create the correct structure for xml.
example:
team.player.1name
team.player.1surname
team.player.1rol
team.player.2name
team.player.2surname
team.player.2role
this give me:
<team>
<player>
<1name>XXXX</1name>
<1surname>YYY</1surname>
<1role>forward</1role>
</player>
<player>
<2name>XXXX</2name>
<2surname>YYY</2surname>
<2role>forward</2role>
</player>
</team> -
Consistency error:more fields found in XML structure than specified in conv
Hi,
I am doing a File 0 RFC- File in PI 7.1 and facing the following error:
2009-12-07 09:45:05 Error MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Consistency error: more fields found in XML structure than specified in conversion parameters! (Value '20000000|3022|800.99|10.11.2009|Testing 22222|')', probably configuration error in file adapter (XML parser error)'
2009-12-07 09:45:05 Error File processing failed with com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Consistency error: more fields found in XML structure than specified in conversion parameters! (Value '20000000|3022|800.99|10.11.2009|Testing 22222|')', probably configuration error in file adapter (XML parser error)'
my output file record structure :
DT_out
itab_out 0.........1
item 0...... unbounded
STR 0........1
So i have given in the receiver FCC parameters as:
Record structure : item
Content conversion parameters:
item.fieldFixedLengths 255
item.endSeparator 'nl'
could anyone pls help me in solving this error at the earliest.
thanksmy problem has been solved by giving the FCC parameters as shown below:
my output file record structure :
DT_out
itab_out 0.........1
item 0...... unbounded
STR 0........1
So i have given in the receiver FCC parameters as:
Record structure : item,ITAB_OUT
Content conversion parameters:
item.fieldFixedLengths 255
item.endSeparator 'nl'
ITAB_OUT.fieldFixedLengths 255
ITAB_OUT.endSeparator 'nl' -
XML structure - mapping one Oracle column to many XML attributes
Hi,
I need to insert data into EMP table reading from xml file and this is how the file would look like....
<?xml version='1.0'?>
<ROWSET>
<ROW num="1">
<EMPLOYEE_ID>7369</EMPLOYEE_ID>
<LAST_NAME>Smith</LAST_NAME>
<FIRST_NAME>JOHN</FIRST_NAME>
<PHONE> 905000123</PHONE>
<PHONE> 905000456</PHONE>
<PHONE> 905000789</PHONE> ...... n
(There could be many phone numbers in the xml file and I need to concatenate all the numbers and insert in the PHONE column of emp table)
<SALARY>800</SALARY>
</ROW>
<!-- additional rows ... -->
</ROWSET>
I am new to XML and would to know the set of lines required to read the data from xml and insert into EMP table. All this is for Oracle 10g R2.
Please let me know solution using XSU if possible.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
-
Netbeans: adding to jPanel via code after init (jFreeChart)
This will be my second post. Many thanks to those who replied to my first questions. I am using netbeans 5.5 I am attempting to run the following jFreeChart demo but in netbeans. Original demo located here: http://www.java2s.com/Code/Java/Chart/JFree
-
No bootable device - Please insert boot disk and press any key
So I tried all yesterday to get bootcamp to work, and this is what happens. I get through all the steps of bootcamp with my USB, and when it restarts, it comes up with an error on a black screen: "No bootable device - Please insert boot disk and pres
-
Elements of the menu in " DHTML Menu with Sublist 2 " too quickly disappear
Elements of the menu in " DHTML Menu with Sublist 2 " too quickly disappear at navigation. Where is better to insert a delay? Give an example a code.
-
Dump-Phenomenon No Auth Function Group HRSSC00TRACKING
Hi guys, we have a strange phenomenon occuring and I can't come up with an explanation, please help: On our production System we went productive on EHP 4 yesterday. I got a call from basis team today that we have about 2000 Dumps DAILY in production.
-
PPTP VPN under Tiger 10.4.5
I recently got my first Mac a month ago. At first, it was able to connect to my work's VPN (PPTP on a linux server). However, a couple weeks later, their PPTP server died and they had to completely redo it. At about the same time, I updated to 10.4.6