Help needed badly Insert text data from xml files into tables
Hi all, I have asked to do insertion of text from a xml file into tables upon receiving using pro*c. i've done quite an amount of research on xml parser in c but there wasn't much information for mi to use for implementation...
Guys don't mind helping me to clarify few doubts of mine...
1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?
2. Is there any tutorials or help files for xml parser libs where i can read up?
I need the xml parser to recognise the tags, followed by recognising the text after the tags.
eg. xml format
<studentID> 0012 </studentID>
<student> john </student>
<studentID> 0013 </studentID>
<student> mary </student>
text willl be inserted into tables like this:
studentID | student
0012 | john
0013 | mary
by the way i'm using oracle 8i on HP-UX. Thanks in advance.
I can answer one of of your questions at least
1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?You need the XML XDK. You can use http://www.oracle.com/technology/tech/xml/xdkhome.html as your starting point. I believe the 9i version works for 8i.
I have no pro*c experience so I can't offer any other suggestions regarding how to do this in pro*c.
Similar Messages
-
How to insert the data from XML to a table
Hi,
I'm using Oracle 10g Express Edition
I need help in How to insert the data from XML file into the table.
Below is the example i'm working on..
I have create ridb user with below mentioned privileges:
Account Status Locked Unlocked
Default Tablespace: USERS
Temporary Tablespace: TEMP
User Privileges :
Roles:
CONNECT
RESOURCE
Direct Grant System Privileges:
CREATE DATABASE LINK
CREATE MATERIALIZED VIEW
CREATE PROCEDURE
CREATE PUBLIC SYNONYM
CREATE ROLE
CREATE SEQUENCE
CREATE SYNONYM
CREATE TABLE
CREATE TRIGGER
CREATE TYPE
CREATE VIEW
& table is created TRIALZIPCODES below mentioned is the DDL:
CREATE TABLE TRIALZIPCODES
STATE_ABBR VARCHAR2(20) NOT NULL
, ZIP_CODE NUMBER(10, 0) NOT NULL
, ZIP_CODE_EXT VARCHAR2(20)
Below is the XML FILE: which is stored in C:\OracleProject Folder
File name: trial.xml
<?xml version="1.0" ?>
<metadata>
- <Zipcodes>
- <mappings Record="4">
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>94301</ZIPCODE>
</mappings>
- <mappings Record="5">
<STATE_ABBREVIATION>CO</STATE_ABBREVIATION>
<ZIPCODE>80323</ZIPCODE>
<ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
</mappings>
</Zipcodes>
</metadata>
PL/SQL Procedure:which i'm trying to execute from SQLDeveloper
create or replace
PROCEDURE TRIAL AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
begin
-- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
-- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
-- the name of the table as specified in our DTD
DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcodes');
-- the name of the data set as specified in our DTD
DBMS_xmlgen.setRowTag(l_context_handle,'mappings');
-- for getting the output on the screen
dbms_output.enable(1000000);
-- open the XML document in read only mode
v_FileHandle := utl_file.fopen('c:/OracleProject','trial.xml', 'r');
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
-- for inserting the XML data into the table
insCtx := DBMS_XMLSTORE.NEWCONTEXT('RIDB.TRIALZIPCODES');
insCtx := DBMS_XMLSTORE.INSERTXML(insCtx, finalStr);
dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
DBMS_XMLStore.closeContext(insCtx);
END;
END TRIAL;
For the first time when i complied i got the errors as :
Procedure RIDB.PROCEDURE1@RIDB
Error(16,14): PLS-00201: identifier 'UTL_FILE' must be declared
Error(16,14): PL/SQL: Item ignored
Error(29,1): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(29,1): PL/SQL: Statement ignored
Error(33,1): PL/SQL: Statement ignored
Error(33,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(36,1): PL/SQL: Statement ignored
Error(36,17): PLS-00320: the declaration of the type of this expression is incomplete or malformed
So i logged in as sys & grant the permission to execute on UTL_FILE to ridb (user):
SQL Statement:
grant execute on utl_file to ridb
So, it got compiled successfully but when i execute it gives me error as:
Source does not have a runnable target.
What does this mean?
So I browse through forum & i got to know that i need to initial the UTL_FILE_DIR ="C:/OracleProject" in init.ora
So can i edit the init.ora with notepad.When i tried to do that it says permission denied
In my system it shows the init.ora file in path C:\oraclexe\app\oracle\product\10.2.0\server\config\scripts
but there is also other file initXETemp in the same path do i need to do the changes in it.
I have tried even editing the SPFILE as mentioned below:
C:\oraclexe\app\oracle\product\10.2.0\server\dbs\SPFILEEXE - I had edit this file using notepad & set the value of UTL_FILE_DIR ="C:/OracleProject". So next time when i restarted i'm unable to log on to the database.
So i had reinstall the software again.
Could you please let me know how to proceed..hi,
I have created the directory from sys database
CREATE or replace DIRECTORY XML_DIR2 AS 'C:\OracleProject';
& grant read,write access to the user
grant read,write on directory XML_DIR2 to RIDB;
& i had change the tag name in the xml file as shown below:
<?xml version = '1.0'?>
<metadata>
<Zipcodes>
<mappings Record="4">
<STABBRE>CA</STABBRE>
<ZIPCODE>94301</ZIPCODE>
</mappings>
<mappings Record="5">
<STABBRE>CO</STABBRE>
<ZIPCODE>80323</ZIPCODE>
<ZIPCODEEXT>9277</ZIPCODEEXT>
</mappings>
</Zipcodes>
</metadata>
TRIALZIPCODE table as shown below:
CREATE TABLE "RIDB"."TRIALZIPCODE"
( "STABBRE" VARCHAR2(20 BYTE),
"ZIPCODE" NUMBER(*,6) NOT NULL ENABLE,
"ZIPCODEEXT" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
I have tried two methods as shown below:
Procedure 1:
create or replace
PROCEDURE TRIAL_V2 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
insCtx := DBMS_XMLStore.newContext('DEV.TRIALZIPCODES');
DBMS_XMLStore.setUpdateColumn(insCtx, 'STABBRE');
DBMS_XMLStore.setUpdateColumn(insCtx, 'ZIPCODE');
DBMS_XMLStore.setUpdatecolumn(insCtx, 'ZIPCODEEXT');
DBMS_XMLStore.setRowTag(insCtx, 'mappings');
cnt := DBMS_XMLStore.insertXML(insCtx, xmldoc);
DBMS_XMLStore.closeContext(insCtx);
END;
Procedure 1 was compiled with out errors but when i execute i got the error as :
Source does not have a runnable target.
Procedure 2_
CREATE OR REPLACE PROCEDURE TRIAL_V3 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
INSERT INTO trialzipcode (STABBRE, ZIPCODE, ZIPCODEEXT)
SELECT extractvalue(x.column_value, 'mappings/STABBRE'),
extractvalue(x.column_value, 'mappings/ZIPCODE'),
extractvalue(x.column_value, 'mappings/ZIPCODEEXT')
FROM TABLE(
XMLSequence(
EXTRACT(
xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') ),
'metadata/Zipcodes/mappings'
) x
END;
END TRIAL_V3;
Procedure 2 was complied without errors but when i execute i got the error as:
Connecting to the database RIDB.
ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the file specified.
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at "SYS.XMLTYPE", line 287
ORA-06512: at "RIDB.TRIAL_V3", line 12
ORA-06512: at line 2
Process exited.
Disconnecting from the database RIDB.
Could you please let me know how to proceed... -
Load data from XML files into BI
Hi All,
Can any one guide me through the steps which involve in loading data from XML files into BI?
Thanks
SantoshHi James,
I have followed upto step No: 12 .
Please could you let me know how to link the XML file on my local drive to BI,
I am not able to find figure out where to specify the path of the XML file to be loaded into BI.
Thanks In Advance
Regards,
San
1. Create a Infosource(ZIS), with transfer structure in accordance with the structure in the XML file. (You can open the XML file with MS Excel.This way you can get to know the structure).
2. Activate the transfer rules.
3. After activation ;from the Menu Bar , Select Extras>Create BW Datasource with SOAP connection.
4.Now Activate the Infosurce again, this creates an XML based Datasource(6AXXX...)
5.These steps would create two sub nodes under the Infosource(ZIS).
6.Select Myself system and create a data package and execute it run in Init mode(without Data Transfer).
7. This would create an entry in RSA7(BW delta Queue)
8. Again create another Delta Infopackage under it, and run it. Now the Datasource(6AXXXXXX..) would turn green in RSA7.
9.In Function builder(SE37) select your FM( do a search ,F4, on the datasource 6AXXX....) .
10.Inside this RFC based FM , from the Menu Bar select Utilities>more Utilities>Create Web services>From Function module.
11.A wizard will guide you through the next steps .
12.once this is done a Web serrvice would be enabled in WSADMIN. Select your FM and execute it.
13.From here you can upload the data from XML file into BW delta queue.
Edited by: Santosh on Nov 30, 2008 2:22 PM -
How to load the data from excel file into table in oracle using UTL_FI
How to load the data from excel file into table in oracle
and from table to excel file
using UTL_FILE package
Please give me some exampleThis is something i tried in oracle apex
http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
Regards,
CKLP -
Insert the record from XML file to Tables.
Hi guys,
I ill be getting the XML file from FRONT-END.It ill be stored one permanent location(Directory).I need to Insert the data to the corresponding table.Anybody knows Pls give some suggestion for this.......
Regards....
GKMUsing the Oracle XML DB Webdav are is one method as it acts like a file system, but essentially get's the documents directly into the database so they can be queried through the resouce_view.
Other methods involve reading the file as if it's a CLOB and then using XMLTYPE constructor to change that CLOB to an XMLTYPE which can then be stored as that datatype in the database or processed as you need.
The best place to look is over in the XML DB forum, which has it's own FAQ detailing various best practices for all sort of XML stuff, including reading XML files and shredding them into relational tables etc.
{thread:id=410714}
Edited by: BluShadow on 18-Jan-2012 08:53
corrected link -
How to retrieve data from xml file into obiee reports
Hi all,
I've got a situation here. A xml file is stored as blob in oracle database table. Now i need to retrieve data/info from that xml file into obiee reports. How am i supposed to proceed with this ?I will go for a table function:
http://gerardnico.com/wiki/database/oracle/table_function
In two words, you can create a function that behave as a table. Then you create a function to pick up your xml, you parse it and you send back the rows.
I know that Oracle has also a library for XML files but I never use it until now.
Success
Nico -
How to load data from XML DOM into tables using Business Components
<p>
Hi,
</p>
<p>
I need to upload XML file (it's not a problem) an load data (DOM tree) from this file into relationan tables. This filelooks like this:
</p>
<p>
<font face="courier new,courier" size="2"><Departments>
<Department>
<DepartmentName>OPERATIONS</DepartmentName>
<Localization>BOSTON</Localization>
<Employees>
<Employee>
<LastName>TURNER</LastName>
<Job>SALESMAN</Job>
<Manager>7698</Manager>
<HireDate>1981-09-08</HireDate>
<Salary>1500</Salary>
<Commerce>0</Commerce>
</Employee>
</Employees>
</Department>
</Departments></font>
</p>
<p>
Is there any Business Components support to obtain this ? What about primary and foreign keys values (there is no in XML file). How to place this XML data in appropriate tables ?
</p>
<p>
Kuba
</p>Pl post details of exact OS and database versions, along with a sample of the XML file and description of the tables. What have you tried so far ?
http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_control_file.htm#i1005614
HTH
Srini -
Embedding data from xml file into metadata of a pdf
Hi All
I'm wanting to do the following, but struggling to figure the right way to go about it.
I want to embedded data from my MIS into a pdf's metadata (as scrnshot). I can create a standalone xml file with all the data I require, but I'm unsure how to automate that being embedded into a pdf's advanced metadata. I know this can be done, as it worked at a previous employer, but I didn't get chance to find out how they did it.
I'm wanting to do this so I can carry out a more advanced search of the metadata in Bridge.
Any advice would be appreciated!Hi Northern,
I have modified the modifyingXMP sample for you. After this change, put your xmp file as sample.xml and also put pdf file in the same folder where ModifyXMP executable is. After merging my changes, ModifyXMP file will read the sample.xml and will embed it into pdf file.
Please follow the following steps
1. Download XMPToolkit SDK and follow the steps to compile Sample
2. Open ModifyingXMP file, replace all the content of that file with the below content
3. Compile the ModifyingXMP file.
4. The ModifyXMP.exe will be generated in folder (samples\target\windows\Debug), if you have changed the output folder it will be generated there.
5. In parallel to ModifyingXMP.exe put the sample.xml (the xml file you have) and also the pdf file (say pdf file name is mypdf.pdf)
6. Go to console and change directory to the directory where ModifyingXMP is and pass the following command
ModifyingXMP mypdf.pdf
7. Open the pdf file and check that value/properties
For your reference, I am putting the content of the sample.xml file too, put this content in sample.xmp and any pdf and you will find subject field is getting added.
************** content of the sample.xml file. Create a file name sample.xml and put that content. Put sample.xml in parallel to ModifyingXMP.exe*******
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/elements/1.1/'>
<dc:subject>
<rdf:Bag>
<rdf:li>XMP</rdf:li>
<rdf:li>SDK</rdf:li>
<rdf:li>Sample</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:format>image/tiff</dc:format>
</rdf:Description>
</rdf:RDF>
******************* MODIFIED CONTENT OF MODIFYING.CPP FILE. ***************************************************************************************** ************
// ========================================================================================= ========
// Copyright 2008 Adobe Systems Incorporated
// All Rights Reserved.
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// ========================================================================================= ========
* Tutorial solution for Walkthrough 2 in the XMP Programmers Guide, Modifying XMP
* Demonstrates how to open a file for update, and modifying the contained XMP before writing it back to the file.
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
// Must be defined to instantiate template classes
#define TXMP_STRING_TYPE std::string
// Must be defined to give access to XMPFiles
#define XMP_INCLUDE_XMPFILES 1
// Ensure XMP templates are instantiated
#include "public/include/XMP.incl_cpp"
// Provide access to the API
#include "public/include/XMP.hpp"
#include <iostream>
#include <fstream>
using namespace std;
* Creates an XMP object from an RDF string. The string is used to
* to simulate creating and XMP object from multiple input buffers.
* The last call to ParseFromBuffer has no kXMP_ParseMoreBuffers options,
* thereby indicating this is the last input buffer.
#include <sstream>
SXMPMeta createXMPFromRDF()
string rdf;
//open the RDF file and put it's content into rdf buffer
ifstream inFile;
inFile.open("sample.xml");//open the input file
if (!inFile.is_open()) {
cout <<"Couldn't open xml file" <<endl;
exit(1);
stringstream strStream;
strStream << inFile.rdbuf();//read the file
rdf = strStream.str();//str holds the content of the file
SXMPMeta meta;
// Loop over the rdf string and create the XMP object
// 10 characters at a time
int i;
for (i = 0; i < (long)rdf.size() - 10; i += 10 )
meta.ParseFromBuffer ( &rdf[i], 10, kXMP_ParseMoreBuffers );
meta.ParseFromBuffer ( &rdf[i], (XMP_StringLen) rdf.size() - i );
return meta;
int main ( int argc, const char * argv[] )
if ( argc != 2 ) // 2 := command and 1 parameter
cout << "usage: ModifyingXMP (filename)" << endl;
return 0;
string filename = string( argv[1] );
if(!SXMPMeta::Initialize())
cout << "Could not initialize toolkit!";
return -1;
XMP_OptionBits options = 0;
#if UNIX_ENV
options |= kXMPFiles_ServerMode;
#endif
// Must initialize SXMPFiles before we use it
if(SXMPFiles::Initialize(options))
try
// Options to open the file with - open for editing and use a smart handler
XMP_OptionBits opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUseSmartHandler;
bool ok;
SXMPFiles myFile;
std::string status = "";
// First we try and open the file
ok = myFile.OpenFile(filename, kXMP_UnknownFile, opts);
if( ! ok )
status += "No smart handler available for " + filename + "\n";
status += "Trying packet scanning.\n";
// Now try using packet scanning
opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUsePacketScanning;
ok = myFile.OpenFile(filename, kXMP_UnknownFile, opts);
// If the file is open then read get the XMP data
if(ok)
cout << status << endl;
cout << filename << " is opened successfully" << endl;
// Create the XMP object and get the XMP data
SXMPMeta meta;
myFile.GetXMP(&meta);
// Create a new XMP object from an RDF string
SXMPMeta rdfMeta = createXMPFromRDF();
// Append the newly created properties onto the original XMP object
// This will:
// a) Add ANY new TOP LEVEL properties in the source (rdfMeta) to the destination (meta)
// b) Replace any top level properties in the source with the matching properties from the destination
SXMPUtils::ApplyTemplate(&meta, rdfMeta, kXMPTemplate_AddNewProperties | kXMPTemplate_ReplaceExistingProperties | kXMPTemplate_IncludeInternalProperties);
// Check we can put the XMP packet back into the file
if(myFile.CanPutXMP(meta))
// If so then update the file with the modified XMP
myFile.PutXMP(meta);
// Close the SXMPFile. This *must* be called. The XMP is not
// actually written and the disk file is not closed until this call is made.
myFile.CloseFile();
else
cout << "Unable to open " << filename << endl;
catch(XMP_Error & e)
cout << "ERROR: " << e.GetErrMsg() << endl;
// Terminate the toolkit
SXMPFiles::Terminate();
SXMPMeta::Terminate();
else
cout << "Could not initialize SXMPFiles.";
return -1;
return 0;
Please let me know if you find any issue/assistance.
-Sunil -
Import data from XML file into ICM script
Hello,
Is it possible to read data from an XML file into an ICM Admin script? If yes, using which node?
Thanks,
Justine.Hi,
as far as i know not directy. Only Method i could think of right now is via CVP Application (Java Class, Custom Node) or IVR Script.
To import data you only have the Database Node which does only allow sources form the Database Lookup Explorer ir passing data along to/from external scripts.
Fabian -
Storing data from XML files in Oracle DB
Hi!
I just started to work with XML and need to save data from XML files into Oracle database. I tried to run sample from Oracle web site. The code was following:
public class xmlwritedb
public static void main(String args[]) throws SQLException
String tabName = "EMP"; // Table into which to insert XML data
String fileName = "emp.xml"; // XML document filename
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Initialize a JDBC connection
Connection conn =
DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@");
// Insert XML data from file (filename) into
// database table (tabName)
OracleXMLSave save = new OracleXMLSave(conn, tabName);
URL url = save.createURL(fileName);
int rowCount = save.insertXML(url);
System.out.println(" successfully inserted "+rowCount+
" rows into "+ tabName);
conn.close();
But it does not work.
OracleXMLSave object does not see file name.
Please, help me solve this problem. Also,where is it possible to find any documentation on oracle.xml.* classes API.
Thank you.
Maya.
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
If a java exception is thrown probably during ur install u might have forgotten
grant javauserpriv to scott;
grant javasyspriv to scott;
Thanks
[email protected]
<HR></BLOCKQUOTE>
Thank you!!! -
Read data from xml files and populate internal table
Hi.
How to read data from xml files into internal tables?
Can u tell me the classes and methods to read xml data..
Can u explain it with a sample program...<pre>DATA itab_accontextdir TYPE TABLE OF ACCONTEXTDIR.
DATA struct_accontextdir LIKE LINE OF itab_accontextdir.
DATA l_o_error TYPE REF TO cx_root.
DATA: filename type string ,
xmldata type xstring .
DATA: mr TYPE REF TO if_mr_api.
mr = cl_mime_repository_api=>get_api( ).
mr->get( EXPORTING i_url = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
IMPORTING e_content = xmldata ).
WRITE xmldata.
TRY.
CALL TRANSFORMATION id
SOURCE XML xmldata
RESULT shiva = itab_accontextdir.
CATCH cx_root INTO l_o_error.
ENDTRY.
LOOP AT itab_accontextdir INTO struct_accontextdir.
WRITE: / struct_accontextdir-context_id,
struct_accontextdir-context_name,
struct_accontextdir-context_type.
NEW-LINE.
ENDLOOP.</pre>
<br/>
Description:
In the above code snippet I am storing the data in an xml file(you know xml is used to store and transport data ) called 'xml_accontextdir.xml' that is uploaded into the MIME repository at path 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'.
The below API is used to read a file in MIME repo and convert it into a string that is stored in ' xmldata'. (This is just a raw data that is got by appending the each line of xml file).
mr = cl_mime_repository_api=>get_api( ).
mr->get( EXPORTING i_url = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
IMPORTING e_content = xmldata ).
Once the 'xmldata' string is available we use the tranformation to parse the xml string that we have got from the above API and convert it into the internal table.
<pre>TRY.
CALL TRANSFORMATION id
SOURCE XML xmldata
RESULT shiva = itab_accontextdir.
CATCH cx_root INTO l_o_error.
ENDTRY.</pre>
Here the trasnsformation 'id ' is used to conververt the source xml 'xmldata' to resulting internal table itab_accontextdir, that have same structure as our xml file 'xml_accontextdir.xml'. In the RESULT root of the xml file has to be specified. (In my the root is 'shiva').
Things to be taken care:
One of the major problem that occurs when reading the xml file is 'format not compatible with the internal table' that you are reading into internal table. Iin order to get rid of this issue use one more tranformation to convert the data from the internal table into the xml file.
<pre>TRY.
CALL TRANSFORMATION id
SOURCE shiv = t_internal_tab
RESULT XML xml.
CATCH cx_root INTO l_o_error.
ENDTRY.
WRITE xml.
NEW-LINE.</pre>
<br/>
This is the same transformation that we used above but the differnce is that the SOURCE and RESULT parameters are changed the source is now the internal table and result is *xml *string. Use xml browser that is available with the ABAP workbench to read the xml string displayed with proper indentation. In this way we get the format of xml file to be used that is compatable with the given internal table.
Thank you, Hope this will help you!!!
Edited by: Shiva Prasad L on Jun 15, 2009 7:30 AM
Edited by: Shiva Prasad L on Jun 15, 2009 11:56 AM
Edited by: Shiva Prasad L on Jun 15, 2009 12:06 PM -
Pls Help me with steps to add data from xml file to SAP B1 through B1iSN.
Pls Help me with steps to add data from xml file to SAP B1 through B1iSN. I am getting stuck in xsl transformation. not able to understand where the mapping code needs to be added.
Pls explain me the steps for adding data from xml to B1 quotation step by step.
thanks and regards
PriyaHi,
Have you checked this: https://sap.na.pgiconnect.com/p45508295/?launcher=false&fcsContent=true&pbMode=normal ?
Thanks,
Gordon -
Hi, extract data from xml file and insert into another exiting xml file
i am searching code to extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
1st xml file which has two lines(text1.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:PrintDataRequest xmlns:xs="http://com.unisys.com/Anid"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
<xs:Person>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
These two lines has to be inserted in the existing another xml(text 2.xml) file(at line 3 and 4)
Regards,
bubblyJadz_Core wrote:
RandomAccessFile? If you know where you want to insert it.Are you sure about this? If using this, the receiving file would have to have bytes inserted that exactly match the number of bytes replaced. I'm thinking that you'll likely have to stream through the second XML with a SAX parser and copy information (or insert new information) as you stream with an XML writer of some sort. -
JDBC + SERVLET: inserting text data to access file from Html form
Hi everybody !
I'm trying to insert text data from my html form to access database using servlet and jdbc technologies.
The problem that I'm that the data is TEXT, but not the English language !!!
So my access db file gets - ???????? symbols instead the real text.
This is the form line that sending data to my servlet:
<form
method="POST"
ACTION=http://localhost:8080/servlet/myServlet enctype="text/html">
And this is servlet line that defines response content:
res.setContentType( "text/html" );
What can I do to get in access db file the right text format and not a ???????? symbols.
Maybe I must to ad some <meta ...> , but where ?You're dealing with Unicode, I'd guess, and not ASCII.
I guess I'd have two questions:
(1) Is the character encoding on your pages set properly for the language you're trying to use?
(2) Does Access handle Unicode characters?
Access isn't exacly a world-class database. (If it was, there'd be no reason for M$ to develop SQL Server.) I'd find out if it supports other character sets. If not, you'll have to switch to a more capable database that does. - MOD -
Extract data from xml file and insert into another exiting xml fil
hello,
i am searching extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
Regards,
ZhuozhiIf the files are small, you can load the target file in a DOM document, insert the data from the source file and persist the DOM.
If the files are large, you probably want to use a StAX or SAX.
Maybe you are looking for
-
Displaying selection screen details in Alv Report output display as Header
Hi all, May be somebody knows how I can show selected values with select-options in top_of_page using REUSE_ALV_GRID_DISPLAY. This shoud work for all the reports and diff selection screens . I need one dynamic process which will for display any repor
-
Ipod Classic 6th Gen 160 GB wont Restore (Error 1439)
So I just purchased an iPod today knowing it was having problems. I had looked online before hand to find fixes, and thought it would be easy enough to fix. But I guess not. I called support, bad idea. They were absolutely useless (they couldn't help
-
Hi experts, In our production system we have around 1000 entries in EINA table with only the Info record no., Materiial and Vendor. The other field including mandatoy ones like Base Unit and Order are all empty. Whereas the EINE table for the corespo
-
What meaNing is the error: "detected in native code outside the VM"
Hi, I am trying to run dbca to create database(10.2.0.1 for Linux x86) in RHEL5 beta2, after I click the OK button on the parameter confirmon window, will display the Java exception: detected in native code outside the VM How resolve the problem? Tha
-
GarageBand 10.0.2 will not open on MacBook Pro 15-inch, Early 2011 running OSX 10.9.5. w/ 8 GB RAM and 1 TB SSD Samsung 840 EVO. Have deleted (secure delete) and reinstalled several times. Got it to open once right after download... Usually crashes/h