Generate XML - Special Character in data causing error
Hello,
I have a procedure written using DBMS_XMLGEN to create xml output. A problem that I am running into is some of my data has an eacute in it. How can I code the XML to account for this and any other weird characters that may exist?
(ie - i need to be able to specify the encoding part of ?xml version=1.0 encoding=ISO-8859-1?)
Here is an excerpt of what i have so far...the results are fine until I run to include the data with the eacute. Then nothing is generated at all. I tried .convert, but I don't know if that's what I need, or if I am calling it correctly.
Thanks!
Janel
ctx := dbms_xmlgen.newContext(rc_data);
-- set name of root element --
dbms_xmlgen.setRowsetTag(ctx, 'XXFA10022');
-- set name of element separating all rows --
-- default is ROW --
dbms_xmlgen.setRowTag(ctx, 'G_DATA');
-- generate XML document --
xml := dbms_xmlgen.getXml(Ctx);
xml := dbms_xmlgen.convert(xml, dbms_xmlgen.ENTITY_ENCODE);
i := dbms_xmlgen.getNumRowsProcessed(ctx);
dbms_xmlgen.closeContext(Ctx);
apps.fnd_file.put_line(apps.fnd_file.log, 'rows processed -' || i);
apps.fnd_file.put_line(apps.fnd_file.log, 'close');
apps.fnd_file.put_line(apps.fnd_file.log, xml);
apps.fnd_file.put_line(apps.fnd_file.output, xml);
-- free clob content --
dbms_lob.freetemporary(xml);
No. There are no XML components that will clean up malformed XML. Your options are to go to whoever sent you that document and tell them that their XML is malformed and that in future they should not do that, or to write your own component to clean up the malformed XML. Since that would involve more work than writing a full XML parser, I don't recommend the second option.
Similar Messages
-
How to add doctype when generating XML from an arbitrary data structure
I was reading SUN's tutorial "Working with XML - PART IV: Using XSLT". Inside this tutorial, in 3, it talks about how to generate XML from an arbitrary data structure making use of a XMLReader and a Transformer. The example only shows adding elements. Is there a way to add DTD information in the XML generated, i.e. <!DOCTYPE ... >? What APIs can I use?
Thanks,
AlexThe simplest way seems to me is to use a XSL file for that. The <xsl:output> attributes doctype-system and doctype-public generate the DTD declaration <!DOCTYPE YOUR_ROOT SYSTEM "yourDTDfile.dtd"> and <!DOCTYPE YOUR_ROOT PUBLIC "yourDTDfile.dtd">, respectively.
When calling transformerInstance.transform() the XSLT processor performs the identity transformation - it just copies elements, attributes, content, processing instructions and comments to the result stream.
If you're using an xsl file for your transformation already, simply add <xsl:output doctype-system="yourDTDfile.dtd"/> to your existing XSL file.
If you're only using the identity transformation you'd need to change the line of code where you obtain the transformer instance from the TransformerFactory to:
t_factory.newTransformer(new StreamSource("test.xsl"));
and use this as test.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="yourDTDfile.dtd"/>
<!-- this is the identity transformation -->
<xsl:template match="*|@*|comment()|processing-instruction()|text()">
<xsl:copy>
<xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>Good luck. -
Special character '#' ODS data upload
Hi experts!!
I have to load R/3 data from PSA to ODS. I have found problems during data load with 0postxt field (description field) because in several FI documents there is '#' inside the text field, for example: "COMPANY X FOR # SALES".
The PSA is upload fine but when the system tries to activate ODS data, it gives me an error in this register.
I have checked RSKC transaction and it is defined '#' character as a permited character:
ÇÉÀÇÊÈÏÌÅÉÒÙÁÍÓÚÑÑÈÍÌÓÒÚÙÉÈÍÌÓÒÚÙ·.'#
What else can I check?
Thanks a lot for your help.
Kind regards,
GPHi,
It may not be because of that.
SID error comes during activation of ODS because the related MD is not available for assigning SIDs.
Whenever Master Data is loaded SID's are generated for those Master Data records.
Now when you load Transaction Data these SID's will be used (for the records which use above master data values). This results in performance gain.
If Transaction Data is loaded first than the system checks for SID's. If they are not available system generate SID's. This results in a loss of performance.
Now in the case if you don't have the setting selected (Further Processing Without Master Data/Always update data, even if no master data exists for the data) system will throw error No Sids found and load will terminate.
So as a first step ensure that the related master data is loaded and Attribute change run has been triggered.
OR
Load the MD and Activate the MD (Modeling > InfoObject > Search the Infoobject > Right click > Activate Master Data)
Once you perform this you can retrigger the activation. It should work fine.
Else as a workaround you can blank out these particular values and activate.
There is also one more workaround wherein you can create the Master data entries directly in BW itself. But both the above step should be done after consulting Business and considering data volume that needs to be edited/created.
In most case once you perform the loading and activation of MD your activation should work fine when repeated.
OR
In the infopackage goto Update Tab and make the setting Update the records even if no master data exist and reload
This may work.
Try Searching in SDN for this Topic and you will find much detailed info as this is discussed very frequently.
Thanks,
JituK -
XML special character/encoding problem
Hi
I would like to store XML in a MSSQL database into a column with the datatype xml.
It seems like the xml datatype in an xMII transaction allways is stored with encoding type UTF-8
and the MSSQL xml datatype is UTF-16. This gives me some problem with special characters when inserting into the MSSQL database (in the example below is the MSSQL datatype xml):
INSERT INTO
VALUES
The error returned is this:
"com.microsoft.sqlserver.jdbc.SQLServerException: XML parsing: line 1, character 62, illegal xml character"
If I replace the 'ä' with a normal 'a' the command executes ok.
I am currently using a workaround that looks like this, when setting the parameter in my transaction:
stringreplace(Local.test, " encoding=" & doublequote & "UTF-8" & doublequote, "")
But I was hoping I could get rid of the stringreplace.
Is there a solution / recommended way of doing this?
Best Regards
Simon Bruun
Edited by: Simon Bruun on Mar 4, 2011 10:43 AMI solved this. I convert to Unicode UTF-8
-
Generating XML File with Table data...
Hi All,
Bear with me, with my Oracle XML knowledge,,,
we have Oracle 8i ( Relaease 3) as our database, and managegement want to have XML type of Text file, with respect to data in the Customer Table. Expected XML tags would be the Column Names of the Table.
Table has three columns,, Name, Address, Telephone.
So desired XML file looks like below:
<Name>John Hunter</Name><Address> City Road, London</Address><Telephone>1223223</Telephone>
If I deceided to do this task using PL/SQL, how could I start it,,,, All comments are welcome, this is the first time that I am going to generate this type of file ,,,Hi Chandana,
You can check out the DBMS_XMLQUERY package for this purpose. It provides XMLType functionality in Oracle 8i. You can access the documentation for the same at:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_xmlque.htm#ARPLS066
If you happen to have access to Oracle 9i, then you can use XMLType Views provided with XML DB for your requirement.
Thanks
Shefali -
Deleting file with special character in name gets error -43
In my Trash folder there is a .html file with a name containing special characters (oriental) left over from when I uninstalled Adobe CS2. When I try to change the file name to delete the special characters so I can trash the file, I get error -43, and the name won't change. Therefore I can't get the file deleted from the computer because I can't get rid of the special characters.
Is there another way to accomplish the same thing?I presume you are referring to the notorious Vietnamese file. Others have had success getting rid of it wuth these instructions .
-
Generate XML from Oracle Table Data
Hi All,
I am new to this network. I am also new to oracle XML package. I want a help for the below query.
CREATE TABLE EMP(ID NUMBER PRIMARY KEY, NAME VARCHAR2(10), PHONE NUMBER);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (11,'Joy',1234);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (22,'Mike',5678);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (33,'Jason',NULL);
COMMIT;
I want to export the EMP table data in a XML file with the below format.
Required Output:
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>11</ID><NAME>Joy</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>22</ID><NAME>Mike</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>33</ID><NAME>Jason</NAME></EMP></STATICDATA>
I have used some XML functions and have written the below query.
select XMLROOT(XMLELEMENT(staticdata,XMLELEMENT(EMP,XMLELEMENT(ID,ID),XMLELEMENT(NAME,NAME))), version '1.0" encoding="UTF-8') xml FROM EMP;
output of my query:
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>11</ID>
<NAME>Joy</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>22</ID>
<NAME>Mike</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>33</ID>
<NAME>Jason</NAME>
</EMP>
</STATICDATA>
But i want the out as the required output above. every record in a single line. can any one help me in achieving the required output. also can i export all the columns of the table by some thing like select * from the table in XML file ?
Thanks,
Sartajuser13683418 wrote:
Hi All,
I am new to this network. I am also new to oracle XML package. I want a help for the below query.
CREATE TABLE EMP(ID NUMBER PRIMARY KEY, NAME VARCHAR2(10), PHONE NUMBER);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (11,'Joy',1234);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (22,'Mike',5678);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (33,'Jason',NULL);
COMMIT;
I want to export the EMP table data in a XML file with the below format.
Required Output:
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>11</ID><NAME>Joy</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>22</ID><NAME>Mike</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>33</ID><NAME>Jason</NAME></EMP></STATICDATA>
I have used some XML functions and have written the below query.
select XMLROOT(XMLELEMENT(staticdata,XMLELEMENT(EMP,XMLELEMENT(ID,ID),XMLELEMENT(NAME,NAME))), version '1.0" encoding="UTF-8') xml FROM EMP;
output of my query:
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>11</ID>
<NAME>Joy</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>22</ID>
<NAME>Mike</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>33</ID>
<NAME>Jason</NAME>
</EMP>
</STATICDATA>
But i want the out as the required output above. every record in a single line.Why?
Some things output XML all as one stream, some things naturally display it structured. It doesn't matter as the XML is still the same because by it's very nature it is a structured data definition. Anything that reads XML will be able to read it whether it's on one line (streamed) or structured.
also can i export all the columns of the table by some thing like select * from the table in XML file ?A couple of ways of exporting XML to a file...
-- DBMS_XSLPROCESSOR.clob2file
-- outputs a clob to a file
DECLARE
ctx DBMS_XMLGEN.ctxtype;
BEGIN
ctx := DBMS_XMLGEN.newcontext ('select * from emp');
DBMS_XSLPROCESSOR.clob2file (DBMS_XMLGEN.getxml (ctx), 'TEMP', 'emp.xml');
DBMS_XMLGEN.closecontext (ctx);
END;
PL/SQL procedure successfully completed.or
..snip..
v_xml XMLTYPE;
v_doc XMLDOM.DOMDocument;
v_dir VARCHAR2(2000);
v_file VARCHAR2(2000);
BEGIN
v_xml := ... populate with XML ...;
v_dir := 'TEST_DIR'; -- directory object name (in UPPER CASE)
v_file := 'myfile.xml';
v_doc := DBMS_XMLDOM.NEWDOMDOCUMENT(v_xml);
DBMS_XMLDOM.WRITETOFILE(v_doc, v_dir||'\'||v_file, 'UTF-8');
DBMS_XMLDOM.FREEDOCUMENT(v_doc);
..snip.. -
I have an XML formated document from an external apps that I
cannot change looking like this:
<?xml version="1.0" encoding="utf-8" ?>
<row>
<charge>3</charge>
<duration>5</duration>
<fdomain>1</fdomain>
<from>"Allibaba"<sip:[email protected]>;tag=169e3f2c</from>
<fuser><fuser />
<start>1167420888.001000</start>
<tdomain>1</tdomain>
<to>"John Blaire"
<sip:4162595623@localhost></to>
<tuser>80</tuser>
</row>
Reading and outputing this XML is giving me :
3
5
1
"Allibaba";tag=169e3f2c
1167420888.001000
1
"John Blaire"
80
Wen I would like to get:
3
5
1
"Allibaba" 18002633394
1167420888.001000
1
"John Blaire" 4162595623
80
The Parsing is removing <> but in 2 case I need to
extract the number followed by <sip: and before @ and remove all
the rest
Is this possible and how?Before you process the xml, strip it
<cfset regXML =
"\<sip\:[0-9]*\@sip\.\host\.ca\>\;tag\=[A-Za-z0-9]*">
<cfset newXML = REReplaceNoCase(myXML,regXML,"","all")> -
Hi,
I am new to XML.
Can anyone tell me how to map tilde(~) in XML?
My code is in Java and when ever I am using the tilde(~) for any field, its getting blank.
Thanks in AdvanceHi,
My code is encoded like this:
if (c == '<')
{filtered.append("~lt;");}
else if (c == '>')
{filtered.append("~gt;");}
else if (c == '"')
{filtered.append("~quot;");}
else if (c == '\'')
{filtered.append("~apos;");}
else if (c == '&')
{filtered.append("~amp;");}
And it has decoded like this:
xml = xml.replaceAll("~gt;", ">");
xml = xml.replaceAll("~quot;", """);
xml = xml.replaceAll("~apos;", "'");
xml = xml.replaceAll("~amp;", "&");
xml = xml.replaceAll("~#13;", " ");
xml = xml.replaceAll("~#10;", " ");
xml = xml.replaceAll("~#16;", "%");
xml = xml.replaceAll("~#17;", "^");
xml = xml.replaceAll("~#19;", "@");
xml = xml.replaceAll("~#20;", "*");
In this way for tilde I used the following code:
if (c == '~')
filtered.append("~tilde;");
//filtered.append("~sim;");
and decoded it like
xml = xml.replaceAll("~tilde;", "˜");
But in my case Tilde is getting removed.
Can you put some light in it? -
Error "TK287" when releasing a request - Special character "_" is invalid.
I have some tables in Solution Manager and having some warnings:
Table: CRM_SVY_DB_ST
Field value:CRM_SVY_GENERATE_BSP_TEMPLATE.XSLT
Field: TRANSFORMATIONID
It doesn´t accept the special character "_"
Below the error when releasing and the explanation of the error in the sequence.
Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_
Special character "_" in generic key
Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_
Special character "_" in generic key
Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_
Special character "_" in generic key
Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_SERVICE_FDBCK 0000000000DCRM_
Special character "_" in generic key
Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_SERVICE_FDBCK 0000000000DCRM_
Special character "_" in generic key
Explanation of the error:
Special character "_" in generic key
Message no. TK287
Diagnosis
The generic key 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_ was entered for the object CRM_SVY_DB_ST. All keys that match up to the asterisk are to be transported.
The key cannot have any special characters before the asterisk, since they are interpreted in different ways by different database systems.
The key contains the special character _.
System Response
The entry is rejected.
Procedure
Extend the generic entry, or specify all keys individually.Hi,
Go through SAP note 711103 & 688363.
Regards,
Sachin Rane.
Edited by: Sachin Rane on Mar 12, 2009 2:48 PM -
When I am uploading file with special character it gives error
Hi All,
I am uplloading one file with special character then it gives error. Please let me know solutions on this is soon as possible.
Thanks,
Madhavhi are you looking for the file to be transferred with the special character then declare it wil the char field...and send it..
or the special charactera are coming unnecessary use the command ............replace all occurances to avoid this.. -
Need to generate XML based on Data template
Hi,
I'm unable to submit (the second submit) my request using the demo links (XDO 5.6.3 or XDO 5.7) provided in http://bipublisher.us.oracle.com/?tab=samples&header=dataTemplate to generate the XML based on the data template.
Heard that these links are available for Oracle EBS internal use. I work with EBS-CRM. I need to generate XML based on a data template and use the XML in the template. Data template has two queries for a template.
Pls help.
Thanks,
ImphaImpha
Please use the internal mailing list for your questions the forum is meant for external customers. If you do not know the ML name - drop me a mail
Tim -
BiizTalk 2013 and EDI Message Invalid character in data element
Hi:
Background: I have a Vendor sending us EDI
856 (Advance Shipping Notice). We are using EDI X12 and BizTalk 2013. In the Parties Agreement we use ISA11 = U-US EDI Community of ASC X12. The vendor is sending 'U' in ISA11.
Error:
At the beginning of EDI Schema import, during EDI audit, we get the following error messages, repeated a few time.
Error: 1 (Field level error)
SegmentID: LIN
Position in TS: 18
Data Element ID: LIN09
Position in Segment: 9
Data Value:
6:
Invalid character in data element
Error: 2 (Field level error)
SegmentID: PID
Position in TS: 20
Data Element ID: PID05
Position in Segment: 5
Data Value:
6:
Invalid character in data element
Root Cause: In all the error cases the data
fields contain “Ü” (U with two dots above it). German character.
Question: What is the best way to deal with
the issue or replace “Ü” (U with two dots above it) characters?
Looking forward to your reply.
Regards, Toraj
Toraj [email protected]I edited the source file and saved it as UTF-8. It seems, it resolved the issue.
Very cool.
Toraj
Toraj [email protected]
Glad that you have solved this issue by yourself, and thanks for sharing your solution to us.
Best regards,
Angie
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Urgetnt:Generate XML Document from Oracle Tables.
Environment is :9i Release 2
Requirement : Generate XML document from the data which is vailable in Oracle tables at client location.
Could some body help me on how to get ahead on this.
Thanks in advance,
Kumar.Implimentation in PowerBuilder7(Source is experimental.. need optimization):
kml_store = create datastore
selectblob kml into :kml_result from (select get_kml(:querry_type,:tmp_querry_value,1) as kml from dual) using sqlca;
if sqlca.sqlcode=100 then
MessageBox("INFO","No data found");
return false;
end if
if sqlca.sqlcode = -1 then
MessageBox("INFO","Error in generating KMl file");
return false
end if
li_FileNum = FileOpen("test.kml",StreamMode!, Write!, LockWrite!, Replace!);
b_len=Len(kml_result)
b_len=64244;
/*inserting in file :)*/
DO WHILE b_pos<=b_len
s_pipe=String(BlobMid(kml_result,b_pos,i_str_len))
ret = FileWrite(li_FileNum,s_pipe);
s_pipe="";
b_pos=b_pos+i_str_len;
LOOP
FileClose(li_FileNum);
Message was edited by:
user601564 -
XML generation with SAP data using XML schema - Reg
Hello experts,
My requirement is , SAP( ztable data ) data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
Generating XML file with their Schema should be underlined.
I studied that call transformation statement helps for this.
Even then i don't have clear idea about this topic.
Please brief me about how to use their XML schema to generate XML with my own sap data.
Thanks in advance experts.
Kumarplease try this same program and see it ....
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:temporders_dtd.xml'.
* Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
* wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
size = l_xml_table_size ).
* Creating a document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
* Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
* upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
* attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
* advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
reward points if it is use fulll ....
Girish
Maybe you are looking for
-
Hi, In a single application i have two databases.I am building & loading Database1 at the same time From Analyser (reporting tool) when i try to access data from database2 i am getting login errors. once the database1 loading and building is complete
-
[SOLVED] Some GTK apps look funny in XFCE
Hi again! Some of my apps like bluefish, cairo-dock settings, and others do not look uniform to the rest of the environment. The dropdown menus, checkboxes and the like get's ugly gray shadings around them. Is there a way to make it look uniform? Las
-
WDS showing up as 3 different networks
I'm just curious if I have my WDS set up correctly or not... I just noticed that my AirPort Widget (MacWireless.com) is showing 3 instances of my network. If I have my WDS set up correctly should that just be one instance? Also, one of my AP Expresse
-
i'm going to migrate SQL Server 7 to Oracle 10g. Could you please help me whether any tools are available for migration. whether Oracle SQL Developer 1.2 Migration Workbench tool, would be helpful..? My SQL server is resides in Window 2000 whereas Or
-
I cannot get google cache search to function in Firefox
when I try to Google cache search for (certain color highlighted words on web pages) no color highlighted words show up.... A cache search is a great time saving convenience, and I miss mine not working. Is there anything I can do to reactivate it? F