Tables to XML
Hi
I have many tables that i would really like to be converted to an XML format so i can incorporate them into my website.
I am familar with XML and can tag items up but am really struggling to get a table to format to xml properly so it is in the right sequence.
I could do it if i turned the table to text and manualy tagged each item, but i have far too many items to tag individually.
I have uploaded an example of the table, and I have added the xml code that i would like it to generate, if anybody could give me any advice on how to achieve this I would be greatly appreciated.
Thanks in advance
<FeaturesList>
<Features>
<vol>
42.01
<vol>
<Issue>
9th Jan
</Issue>
<sf>
Responsible use of antibiotics in large animals
Cushingoid diabetes (SA)
</sf>
<st>
</st>
</Features>
<Features>
<vol>
42.02
<vol>
<Issue>
16th Jan
</Issue>
<sf>
Diagnosis and treatment of equine PPID (Cushing’s disease)
</sf>
<st>
</st>
</Features>
</FeaturesList>
The bit i am mainly struggling on is i can select the columns and tag them, but then i need to select the rows and add another tag(in this case 'features') all it is doing is replacing the tags and not adding a new tag. The tags panel is set to 'retag', but how can i set it to 'add"
Similar Messages
-
Data from table in xml Format and Inserting it into Table
Hi All
I have table where xml data is stored in long format with xml tag know i have read the entire xml xoulmn which is xml tag and insert it into diffrent table can any suggest me the code
Thanks & RegardsI believe you are on the wrong forum. You want the XML DB forum.
See:
XML DB -
Hi,
Iam new to the xml,
can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
<?xml version="1.0"?>
<DiseaseCodes>
<Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
</DiseaseCodes>.
Regards,
vikram.here is the your XML parse in 11g :
select *
from xmltable('//Entity' passing xmltype
'<?xml version="1.0"?>
<DiseaseCodes>
<Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
</DiseaseCodes>
') columns
"dcode" varchar2(4000) path '/Entity/dcode',
"ddesc" varchar2(4000) path '/Entity/ddesc',
"reauthflag" varchar2(4000) path '/Entity/reauthflag'
dcode ddesc reauthflag
0 (I87)Other disorders of veins - postphlebitic syndrome 0
0 (J04)Acute laryngitis and tracheitis 0
0 (J17*)Pneumonia in other diseases - whooping cough 0
SQL>
Using this parser you can create procedure as
SQL> create or replace procedure myXMLParse(x clob) as
2 begin
3 insert into MyXmlTable
4 select *
5 from xmltable('//Entity' passing xmltype(x) columns "dcode"
6 varchar2(4000) path '/Entity/dcode',
7 "ddesc" varchar2(4000) path '/Entity/ddesc',
8 "reauthflag" varchar2(4000) path '/Entity/reauthflag');
9 commit;
10 end;
11
12 /
Procedure created
SQL>
SQL>
SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
PL/SQL procedure successfully completed
SQL> select * from MYXMLTABLE;
dcode ddesc reauthflag
0 (I87)Other disorders of veins - postphlebitic syndrome 0
0 (J04)Acute laryngitis and tracheitis 0
0 (J17*)Pneumonia in other diseases - whooping cough 0
SQL>
SQL>
Ramin Hashimzade -
Error while downloading data from internal table into XML file
hi all,
i developed a program to download data from into internal table to xml file like this.
tables: mara.
parameters: p_matnr like mara-matnr.
data: begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
aenam like mara-aenam,
vpsta like mara-vpsta,
end of itab_mara.
data: lv_field_seperator type c, " value 'X',
lv_xml_doc_name(30) type c, " string value my xml file,
lv_result type i.
lv_field_seperator = 'x'.
lv_xml_doc_name = 'my xml file'.
types: begin of truxs_xml_line,
data(256) type x,
end of truxs_xml_line.
types:truxs_xml_table type table of truxs_xml_line.
data:lv_tab_converted_data type truxs_xml_line,
lt_tab_converted_data type truxs_xml_table.
data: lv_xml_file type rlgrap-filename value 'c:\simp.xml'.
select matnr ernam aenam vpsta from mara into table itab_mara up to 5
rows where matnr = p_matnr.
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = lv_field_seperator
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
I_XML_DOC_NAME = lv_xml_doc_name
IMPORTING
PE_BIN_FILESIZE = lv_result
TABLES
I_TAB_SAP_DATA = itab_mara
CHANGING
I_TAB_CONVERTED_DATA = lt_tab_converted_data
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
open dataset lv_xml_file for output in binary mode.
loop at lt_tab_converted_data into lv_tab_converted_data.
transfer lv_tab_converted_data to lv_xml_file.
endloop.
close dataset lv_xml_file.
this program is syntactically correct and getting executed, but when i open the target xml file it is showing the following error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource 'file:///C:/simp.xml'.
will anyone show me the possible solution to rectify this error
thanks and regards,
anil.Hi,
Here is a small sample program to convert data in an internal table into XML format and display it.
DATA: itab TYPE TABLE OF spfli,
l_xml TYPE REF TO cl_xml_document.
* Read data into a ITAB
SELECT * FROM spfli INTO TABLE itab.
* Create the XML Object
CREATE OBJECT l_xml.
* Convert data in ITAB to XML
CALL METHOD l_xml->create_with_data( name = 'Test1'
dataobject = t_goal[] ).
* Display XML Document
CALL METHOD l_xml->display.
Here are some other sample SAP programs to handle XML in ABAP:
BCCIIXMLT1, BCCIIXMLT2, and BCCIIXMLT3.
Hope this helps,
Sumant. -
Writing from internal table to xml format
Hi,
I searched all the forum and I have a question on writing the data from internal table in xml format to the file on app.server.
Data: ITAB1 TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB1.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB1[] ).
after this how to move the XML data in the object to a file on app.server.
Thanksp_ufile is the path of the application server
p_output is the internal table with data to be moved to app serv.
OPEN DATASET p_ufile FOR OUTPUT IN TEXT MODE.
LOOP AT p_output INTO wa_file.
TRANSFER wa_file TO p_ufile.
CLEAR wa_file.
ENDLOOP.
CLOSE DATASET p_ufile.
for XML I guees the path p_ufile ill be <b>sap/usr/tmp/file.xml</b> -
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 -
Export Internal Table to XML in Background
Hi
I need to export a internal table into xml file in background using open dataset. The file is getting created but i am not able to open the file using IE/XML editor . When i open the file uisng wordpad i can see some charcters at the end of file which prevents it from opening in xml editor. if i delete the characters(box like) and save the file. i am able to open the file
When i downalod the same internal table via frontend using ws_downlod it works pefectly. no junk charcters are appended in the end. and hence files opens perfectly
below is the extract of program
START-OF-SELECTION.
PERFORM get_data.
PERFORM create_xml.
FORM get_data.
REFRESH accesos.
CLEAR accesos.
MOVE: '45050' TO accesos-socio-numero,
'MOISES MORENO' TO accesos-socio-nombre,
'0' TO accesos-socio-reposicion.
APPEND accesos.
ENDFORM.
i am using the following function modules
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
name = 'ACCESOS'
dataobject = accesos[]
IMPORTING
data_as_dom = l_dom
CHANGING
document = m_document
EXCEPTIONS
illegal_name = 1
OTHERS = 2.
CHECK NOT l_dom IS INITIAL.
w_rc = m_document->append_child( new_child = l_dom ).
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
document = m_document
IMPORTING
xml_as_string = w_string
size = w_size
TABLES
xml_as_table = it_xml
EXCEPTIONS
no_document = 1
OTHERS = 2.
LOOP AT it_xml INTO xml_tab-d.
APPEND xml_tab.
ENDLOOP.
The following syntax for open datset which does not work
lv_physcial_file = '
hdat03\test.xml'.
OPEN DATASET lv_physcial_file IN BINARY MODE FOR OUTPUT MESSAGE l_msg.
LOOP AT xml_tab.
TRANSFER xml_tab TO lv_physcial_file.
ENDLOOP.
The ws_download function works
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
many thnaksHi Chetan,
Can you just try changing the syntax to the following, I not sure if that will help but just try and see.
OPEN DATASET lv_physcial_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Regards
Mohamed -
Hallo Experts,
I have retrived a Internal Table from FM.
CALL FUNCTION 'SRTUTIL_CONVERT_XML_TO_TABLE'
EXPORTING
xdoc = lv_xstring
IMPORTING
* ERROR_TEXT =
data = lt_xml
I have manipulated the Tagnames in the Internal Table lt_xml.
Now I want to change the internal table to xml.
Is there any FM or a class. can anyone help me??
Thanks
Kind regards
rana WaseemHallo,
Thanks for your Reply. I am trying to manipulate the xml attributes in print report. I have the data in xstring form. I have changed it to internal Table with following code.
CALL FUNCTION 'SRTUTIL_CONVERT_XML_TO_TABLE'
EXPORTING
xdoc = lv_xstring
IMPORTING
* ERROR_TEXT =
data = lt_xml
After the change in the table lt_xml I am trying to have once again a xstring to give to the Print Report. I have tried it with class
LOOP AT lt_xml INTO ls_xml.
CALL METHOD cl_soap_xml_helper=>transform_to_xml
EXPORTING
tag_name = ls_xml-tag_name
data = ls_xml-tag_value
data_type = ls_xml-tag_type
ignore_init_value = 'X'
* ignore_exception =
CHANGING
xml = lv_xstring_two
* ENDLOOP.
but when I try to check the XML become an error
The XML cannot be showed, when Stylesheet XSL is used Remove the error and try again.
I cannot understand where is the error. Because the orignal xstring from system is shown correct. But when I create the new xstring give error .
Thanks for your help
kind regards
waseem -
Convert data from internal table to XML file.
Hi All,
I am selecting data from database into one internal table.
Now I want to convert data from internal table to xml file format and save in to my desktop. Please suggest me how I can achieve my requirement.
Kindly reply me ASAP.Use this FM. SAP_CONVERT_TO_XML_FORMAT
Check this link too -
Re: Data Export in XML format
XML files from ABAP programs -
Persist XML Data to Database Table - Generic XML Schema
Hi,
I would like to represent data in XML format and persist to any database tables.
The ideal xml is like:
<TABLE NAME="TABLE1">
<TABLEDEF><COLUMN NAME="COLUMN1"/><COLUMN NAME="COLUMN2"/></TABLEDEF>
<ROW><COLUMN VALUE="value1"/><COLUMN VALUE="value2"/></ROW>
<ROW><COLUMN VALUE="value11"/><COLUMN VALUE="value22"/></ROW>
</TABLE>
<TABLE NAME="TABLE2">
</TABLE>
The XML could then be parsed, and saved to database with JDBC by manually composing the statement strings.
To reduce the coding effort (xml parsing, JDBC connection, etc), are there any open source projects available to achieve the above purpose? The popular O/R mapping tools like Hibernate, Castor, etc, can't handle this scanario because they require the knowledge of the tables on the server side in order to create the mapping files in advance.
Thanks for the help!Hi,
I would like to represent data in XML format and persist to any database tables.
The ideal xml is like:
<TABLE NAME="TABLE1">
<TABLEDEF><COLUMN NAME="COLUMN1"/><COLUMN NAME="COLUMN2"/></TABLEDEF>
<ROW><COLUMN VALUE="value1"/><COLUMN VALUE="value2"/></ROW>
<ROW><COLUMN VALUE="value11"/><COLUMN VALUE="value22"/></ROW>
</TABLE>
<TABLE NAME="TABLE2">
</TABLE>
The XML could then be parsed, and saved to database with JDBC by manually composing the statement strings.
To reduce the coding effort (xml parsing, JDBC connection, etc), are there any open source projects available to achieve the above purpose? The popular O/R mapping tools like Hibernate, Castor, etc, can't handle this scanario because they require the knowledge of the tables on the server side in order to create the mapping files in advance.
Thanks for the help! -
Hi, I am new to livecycle and wondering if there is any sample for setting up the dynamic table with XML schema so I can access the data through workbench's xpath. thanks.
Ivor,
Take a look at the samples shipped with Designer. For 8.2.1 release take a look at
C:\Program Files\Adobe\LiveCycle Designer ES\8.2\EN\Samples\Forms\Purchase Order\Schema\Schema\Purchase Order.xsd
and the form samples.
Otherwise, forward a request to [email protected] I would be happy to send you a sample XDP with a dynamic table and a schema.
Steve -
Spry Tables and Xml Data Sets viewed in IE7
Has anyone ever run into a problem with Spry Tables and Xml
Data Sets viewed in IE7? Work fine in IE6 and Firefox, but get the
error "exception caught while loading feed.xml: [object Error]" in
IE 7. Any ideas?
Attached is the xml I'm using.
ThanksI came looking for the answer to this question. I could not
find an answer. Eventually I found it the answer that worked for
me, a graphic designer with not much experience in xml.
The following url provided an errata file in PDF format:
www.peachpit.com/dwcs3cib
which includes the following addendum to the incomplete
instructions in the book i was using to learn about spry:
"If Internet Explorer 7 is your primary browser, you'll nee
to take some extra steps to view spry dynamic content locally.
First, your site must be within the local server webroot; be sure
your Lessons folder is stored within the Inetpub>wwwroot folder.
Next, double-click the site name in the files panel to open the
Site Definition dialogue. Click the Testing Server category; from
the Access List choose Local/Network. Click Okay to close the Site
Definition dialogue. Now, when you preview your page with Internet
Explorer, your local Web server (localhost) serves the page as
designed."
Horray for me! Now i can move on from here and actually get
some work done! -
Save Table in XML Automatically
Hello,
I need your help...
I want to get in a oracle db one table in xml format. I saw that we have a ORACLE XML DB package, where I can run "select" to obtain tables in xml. What I wan to do now, it is to save the result in a windows folder automatically, for example each hour. Do you know how can I do that? any idea?
Best Regards.If you can, could you give an example of stored procedure to save file in the server?Yes, here's an example :
1) Create a directory object
create or replace directory test_dir as 'c:\oracle\test';2) The procedure
CREATE OR REPLACE PROCEDURE getEmployees
IS
xmldoc CLOB;
xmlprolog VARCHAR2(80);
BEGIN
-- builds the XML prolog using the database charset for the encoding
SELECT '<?xml version="1.0" encoding="' || utl_i18n.map_charset(value) || '"?>'
INTO xmlprolog
FROM nls_database_parameters
WHERE parameter = 'NLS_CHARACTERSET'
-- generates the XML document
SELECT XMLSerialize(DOCUMENT
XMLElement("Employees",
XMLAgg(
XMLElement("Employee",
XMLAttributes(empno as "id")
, XMLForest(
ename as "name"
, job as "job"
, hiredate as "hireDate"
order by empno
INTO xmldoc
FROM scott.emp
WHERE deptno = 10
-- writes the document to a file in the directory TEST_DIR
DBMS_XSLPROCESSOR.clob2file(xmlprolog || xmldoc, 'TEST_DIR', 'employees.xml');
END;
/When called, it'll create a file "employees.xml" containing :
<?xml version="1.0" encoding="UTF-8"?>
<Employees>
<Employee id="7782">
<name>CLARK</name>
<job>MANAGER</job>
<hireDate>1981-06-09</hireDate>
</Employee>
<Employee id="7839">
<name>KING</name>
<job>PRESIDENT</job>
<hireDate>1981-11-17</hireDate>
</Employee>
<Employee id="7934">
<name>MILLER</name>
<job>CLERK</job>
<hireDate>1982-01-23</hireDate>
</Employee>
</Employees>(formatted) -
Insert data into oracle table from XML file
I need to insert data into oracle table from XML file
If anybody handled this type of scenario, Please let me know how to insert data into oracle table from XML file
Thanks in advanceThe XML DB forum provides the best support for XML topics related to Oracle.
Here's the FAQ on that forum:
XML DB FAQ
where there are plenty of examples of shredding XML into Oracle tables and such like. ;) -
HOW TO CONVERT SAP DB TABLE TO XML FILE
Initially I want to store sap db table as xml file so that an external program can read it. Also i want that when table is updated only updated data is stored in xml file.
Edited by: Sandip Mane on Apr 2, 2008 9:19 PM
Edited by: Alvaro Tejada Galindo on Apr 2, 2008 12:47 PMshould do this way
CALL TRANSFORMATION (`ID`)
SOURCE output = your_itab[]
RESULT XML xml_out.
also check this link
Convert data from internal table to XML file. -
How to convert database table into xml file
Hi.
How to convert database table into XML file in Oracle HTML DB.
Please let me know.
Thanks.This not really a specific APEX question... but I search the database forum and found this thread which I think will help
Exporting Oracle table to XML
If it does not I suggest looking at the database forum or have a look at this document on using the XML toolkit
http://download-east.oracle.com/docs/html/B12146_01/c_xml.htm
Hope this helps
Chris
Maybe you are looking for
-
Hello, Just setting up my new imac & I've been trying to set up email accounts in Mac Mail for 3 other user accounts. My broadband provider in the UK (BT) provided us with 4 '@btinternet.com' Email accounts. After I installed broadband I was taken th
-
Acrobat X plugin running in Browser cannot save pdf files locally
Hi, I have a Digital Signature plugin written for Acrobat X and it handles both signature creation and verification. When a PDF with digital signatures is opened in a browser (specifically IE8, IE9) acrobat X runs in browser mode and it calls our dig
-
Qosmio G30-10E - need mainboard partnumber
Hi, i need the Partnumber of my mainboard, because it's faulty and i want to replace the mainboard, and my dealer wants the exact partnumber to find the right sparepart. But i dont find the partnumber on the board, the one and only i found is: +A5A00
-
How to append SAP instance in SAP MMC
Hi, We had two instances running in one host. After a reboot one system is up and running and can be seen in MMC but the other instance niether starting nor appearing in MMC. Can any one tell me how to append the instance in MMC with the existing up
-
BI Team Role in Production (both ECC and BI)
What access do the BI support team require in prod ECC and BI? I need to create their roles but I have limited knowledge as to what they need. Would really appreciate your inputs so at least they can't sell me something that they shouldn't have acces