How to read XML data from URL
Hi All,
I have one requirement. I have one URL which gives me data in XML format. I need to read this file and store this data into my SAP tables.
Can anybody suggest how read this XML file using URL?
Thanks in advance,
P.Shridhar.
Use a Server java proxy generated from your inbound message interface which would make a URLConnection to the specified URL after it gets triggered by BPM. A code snippet to achieve the same could be
URL url = null;
URLConnection conn = null;
BufferedReader in = null;
url = new URL("http://someurl.someserver.com");
conn = url.openConnection();
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
StringBuffer xml = new StringBuffer();
while ((line = in.readLine()) != null){
xml.append(line);
-- amol
Similar Messages
-
Hello,
Greetings to everybody. I am having a problem reading or capturing the XML data being send by a URL and the said URL does not send the XML data as a file, but it just send it out as data.
I do not know how to capture the said xml data from the said given URL. Please Help. Thank You, very, very, very much.
Cheers !
vins
[email protected]public String getXml(String strURL){
URL url = null;
URLConnection conn = null;
BufferedReader in = null;
try{
url = new URL(strURL);
conn = url.openConnection();
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
StringBuffer xml = new StringBuffer();
while ((line = in.readLine()) != null){
xml.append(line);
catch (Exception e){ }
finally { // close th eresource
return xml.toString()
}String xml = getXml("http://www....");
InputSource source = new InputSource(new StringReader(xml));
// use a parse to parse the xml document in the inputsource -
Reading xml data from url and insert into table
CREATE TABLE url_tab2
URL_NAME VARCHAR2(100),
URL SYS.URIType
INSERT INTO url_tab2 VALUES
(’This is a test URL’,
sys.UriFactory.getUri(’http://www.domain.com/test.xml’)
it is giving error as invalid characterCheck if your single quotes are the correct single quotes.
The principle works as advertised in the XMLDB Developers Guide...
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Tue Nov 25 21:44:46 2008
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user OTN identified by OTN account unlock;
User created.
SQL> grant dba, xdbadmin to OTN;
Grant succeeded.
SQL> conn OTN/OTN
Connected.
SQL> CREATE TABLE uri_tab (docUrl SYS.URIType, docName VARCHAR2(200));
Table created.
SQL> -- Method SYS.URIFACTORY.getURI() with absolute URIs
SQL> -- Insert an HTTPUri with absolute URL into SYS.URIType using URIFACTORY.
SQL> -- The target is Oracle home page.
SQL> INSERT INTO uri_tab VALUES
2 (SYS.URIFACTORY.getURI('http://www.oracle.com'), 'AbsURL');
1 row created.
SQL> -- Insert an HTTPUri with relative URL using constructor SYS.HTTPURIType.
SQL> -- Note the absence of prefix http://. The target is the same.
SQL> INSERT INTO uri_tab VALUES (SYS.HTTPURIType('www.oracle.com'), 'RelURL');
1 row created.
SQL> -- Insert a DBUri that targets employee data from database table hr.employees.
SQL>
SQL> INSERT INTO uri_tab VALUES
2 (SYS.URIFACTORY.getURI('/oradb/HR/EMPLOYEES/ROW[EMPLOYEE_ID=200]'), 'Emp200');
1 row created.
SQL> SELECT e.docUrl.getCLOB(), docName FROM uri_tab e;
E.DOCURL.GETCLOB()
DOCNAME
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
<head>
AbsURL
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
E.DOCURL.GETCLOB()
DOCNAME
<head>
RelURL
<?xml version="1.0"?>
<ROW>
<EMPLOYEE_ID>200</EMPLOYEE_ID>
<FIRST_NAME>Jenn
Emp200
SQL> set long 1000
SQL> select HTTPURITYPE('www.oracle.com').getCLob() from dual;
HTTPURITYPE('WWW.ORACLE.COM').GETCLOB()
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
<head>
<title>Oracle 11g, Siebel, PeopleSoft |
Oracle, The World's Largest Enterprise S
oftware Company</title>
<meta name="title" content="Enterprise Applications | D
atabase | Fusion Middleware | Applicatio
ns Unlimited | Business | Oracle, The Wo
rld's Largest Enterprise Software CompanEdited by: Marco Gralike on Nov 25, 2008 10:13 PM -
How to read xml data from jsf,
Hi
I would like to know how to read data in an xml so as we can display that data onto the jsf page to the user, say as a data table, or in an output txt box etc...This is nothing JSF-special. Just convert XML to objects (DTO's) and then use them in JSF.
There are several ways to crawl the XML tree. JXPath and DOM4J are popular. -
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
Reading XML Data from ABAP Program?
Hi,
How do I read XML Data from an ABAP Program? For example if I have the below basic XML Code-
<xml>
<Name> Thiru </Name>
<Age> 24 </Age>
<City> chennai </Chennai>
</xml>
How do i read the data within the Name,Age, and City tags into variables in the ABAP Program?
Regards,
Thiruif you decide to do in XSLT, I have a sample list here:
XML file like this:
<?xml version="1.0" encoding="UTF-16"?>
<F>
<P1>
<t_1>value1</t_1>
<t_2>testvalue</t_2>
</P1>
<P2>
</P2>
</F>
XSLT file like this:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="F">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<<b>DOCUMENT</b>>
<xsl:apply-templates/>
</<b>DOCUMENT</b>>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="P1">
<ENTRY>
<<b>T_1</b>><xsl:value-of select="t_1"/></T_1>
<<b>T_2</b>><xsl:value-of select="t_2"/></T_2>
</ENTRY>
</xsl:template>
</xsl:transform>
ABAP program like this:
DATA: BEGIN OF wa_upload,
text(255) TYPE c,
END OF wa_upload,
itab_upload LIKE TABLE OF wa_upload,
BEGIN OF wa_document,
t_1 TYPE string,
t_2 TYPE string,
END OF wa_document,
itab_document LIKE TABLE OF wa_document.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'XXXXX'
filetype = 'ASC'
TABLES
data_tab = itab_upload.
CALL TRANSFORMATION zrappel_xml_test
SOURCE XML itab_upload
RESULT <b>document</b> = itab_document.
You should pay attention to the bold words.
hope it will be helpful
thanks -
How to read a data from USB port using JAVA
hi all,
i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
Advance Thanks!!You can do this. Please use this link
[http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
What research did you do of your own? Have you done some testing application and tried yourself?? -
How to generate XML data from Lotus Notes to migrate to SharePoint by passing XML to SharePoint.?
Ramesh SYou could use XMLQuery to return the data from your tables as XML, that would give you a CLOB.
An example using the SCOTT schema might be like this:
SELECT XMLQuery(
'for $i in ora:view("DEPT")/ROW
return <Department dname="{$i/DNAME}">
<Employee>
{for $j in ora:view("EMP")/ROW
where $j/DEPTNO eq $i/DEPTNO
return ($j/ENAME, $j/JOB, $j/SAL)}
</Employee>
</Department>'
RETURNING CONTENT) FROM DUAL;In the docs you can find more information about its use:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_xquery.htm -
Reading XML data from .pages file
Hi All!
I've been trying to get a script up and running, but frankly I'm lost. The script should read the date, lesson no, and name fields from a .pages file and then use that information to send an e-mail.
What I'm having a problem with is reading the data from the .pages file and I don't know what the best way to do it is because I'm still a novice at this.
So there are two ways I can think of:
1. Read directly from the Pages document when it is open. The problem with this is that it's a Pages template and it contains tables. Perhaps the easiest thing would be just to select certain cells directly from pages, but I have no idea how they're labeled or how to access them so I came up with a second idea. If you happen to know how to do this, I would greatly appreciate it.
2. Pages documents can be unzipped and one of the files is an xml file with a lot of tags and the data I need. I found the following post that talks about how to parse XML via an XSL stylesheet. After going through some tutorials, I got stuck because the xml itself in the Pages file is just a mess to me and I'm confused about which node to choose. In other xml docs you can see a clear, nicely laid out tabbed structure so you can at least figure out the path to the node you want. I stumbled across a nice script for TextWrangler which cleans up XML, but it just barks at the Pages file.
3. On top of that, I will need to use the name field and match that with an Address Book e-mail address. Should I change the template and make it into an address book field?
Thanks in advance,
PaulThe script should read the date, lesson no, and name fields from a .pages file and then use that information to send an e-mail.
Maybe you might want to try the following script:
tell application "Pages"
activate
tell foreground layer of page 1 of front document
select (text box 1 whose vertical position < 0.5)
tell application "System Events"
keystroke "c" using {command down} -- ⌘C
keystroke "a" using {shift down, command down} -- ⇧⌘A
end tell
set theText to the clipboard
end tell
end tell
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
set theTextFields to text items of theText
set AppleScript's text item delimiters to TID
set {theDate, theLessonNo, theStudent} to {item 2, item 4, item 6} of theTextFields -
How to read the data from excel file and store into the table?
Hi All,
I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
All the excel fields and my table columns are same.
Can you share with me how can acheive this using LOB's?
ThanksHi OraSuirya,
you can try with external tables .
syntax as follows
create table ext_table_csv (
i Number,
n Varchar2(20),
m Varchar2(20)
organization external (
type oracle_loader
default directory ext_dir
access parameters (
records delimited by newline
fields terminated by ','
missing field values are null
location ('file.csv')
reject limit unlimited;
For this you need to create directory
Directory Creation syntax:
create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
grant read, write on directory ext_dir to <User>;
please paste the excel file in the particular directory .
I hope this will help you.
Please correct me if I am wrong anywhere .
Thanks,
Tippu. -
How to read the data from a file in another computer with user name and password login
How to read read the data from a file in anohter computer which need to login with user name and password?
duplicate post: http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
duplicate post: http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
duplicate post http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682 -
How to read .xml file from embedded .swf(flash output) in captivate
I have been trying to read .xml file from the .swf (Flash output) that is embedded within the captivate file but no luck yet . Please if anyone got any clue on how get this thing done using Action script 3.0 then let me know. I am using Adobe Captivate 5.5 at present and Flash CS 5.5.
I am well aware about how to read .xml file through action script 3.0 in flash but when insert the same flash in captivate and publish nothing comes in captivate output. I would higly appreciate if anyone could help me out with that.
Here is is graphical demonstration of my query :
Message was edited by: captainmkvHi Captainmkv,
Does the information in this post cover what you're trying to do: http://forums.adobe.com/message/5081928#5081928
Tristan, -
I need urgent help with this code to read xml nodes from an xml file.
This is the HttpService
<mx:HTTPService id="appraisalData"
url="assets/appraisal.xml"
result="HandleDataResult(event)"
/>
::SCRIPT::
[Bindable]
private var _appData:XMLList=new XMLList();
private function HandleDataResult(event:ResultEvent):void
_appData=event.result.appraisal.APPRAISAL;
I want to extract nodes from this XMLList and fill my components
Like:
<components:HeaderSection width="100%" headerData="{XML(_appData[0])}"/>
Here's the XML file sample:
<?xml version="1.0"?>
<APPRAISAL>
<ACTIONS/>
<RATINGSTATUS>
<MIDYEAR>
<EDITABLE>false</EDITABLE>
<VISIBLE>true</VISIBLE>
</MIDYEAR><YEAREND>
<EDITABLE>false</EDITABLE>
<VISIBLE>true</VISIBLE>
</YEAREND></RATINGSTATUS>
<HEADER>
<PLAN_VERSION>01</PLAN_VERSION>
<APPRAISAL_ID>4B1DF5B7B24100A7E1008000AC11A294</APPRAISAL_ID>
<EMPLOYEE>Tom Smith</EMPLOYEE>
<LEADER>Bob string hello Jr</LEADER>
<APPRAISAL_TYPE>2010 Individual Contributor</APPRAISAL_TYPE>
<AP_START_DATE>01/01/2009</AP_START_DATE>
<AP_END_DATE>12/31/2009</AP_END_DATE>
<AP_STATUS>2</AP_STATUS>
<AP_STATUS_NAME>In Planning</AP_STATUS_NAME>
<AP_STATUS_SUB>4</AP_STATUS_SUB>
<AP_STATUS_SUB_NAME>Pending Transfer</AP_STATUS_SUB_NAME>
<ORGUNIT>Payroll Test Org.2</ORGUNIT>
<PERSONAL_AREA>CA-Catalina Island</PERSONAL_AREA>
<PERSONAL_SUBAREA>Teamsters - 495</PERSONAL_SUBAREA>
<EE_GROUP>Hourly</EE_GROUP>
<EE_SUBGROUP>Full Time Non-Exempt</EE_SUBGROUP>
</HEADER>Honeeeey, I'm hooome! So... here's the code:
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
private var myRetrivedData:ArrayCollection;
private function getXMLData():void
httpService.send();
private function httpFaultHandler(event:FaultEvent):void
Alert.show("Cannot load XML file.","Error");
private function httpResultHandler(event:ResultEvent):void
myRetrivedData=event.result.elements.element;
]]>
</mx:Script>
<mx:HTTPService id="httpService" url="someXMLFile.xml"
fault="httpFaultHandler(event)" result="httpResultHandler(event)"/>
<mx:DataGrid id="myDataGrid" dataProvider="{myRetrivedData}"/> -
How to read in data from MySQL to Authorware?
Hi,
I am trying to read in values from my database (MySQL) to
authorware, but the best I am able to get is true or false.
I would like to be able to get some data from the database
and return it to AW as a string. Does anyone have any experience
with this? Can anyone lend a helping hand in this endeavor?
Thanks in advance for your help,
Brad"Paul Swanson" <[email protected]>
wrote in message
news:[email protected]...
> Kevin, you shouldn't need to worry about ODBC or OLEDB.
Your PHP script
> needs to handle the database connection, and you can use
PHP's
> mysql_connect() function for that. You really don't need
to do anything
> different for Authorware than you do for any PHP/MySQL
application in
> terms
> of connecting to the database.
>
> My PHP script returns data to AW in the form of
name=value pairs delimited
> by the ampersand character. I then use the following
code in AW to convert
> them into lists:
>
> =========================
> -- Use this routine to break queryString into name /
value arrays.
> -- Assumes a database query returns a string of
name=value pairs
> -- delimited by the ampersand (&) character.
>
> -- strip leading & from queryString
> queryString := SubStr(queryString, 1,
CharCount(queryString))
>
> -- break into list of individual lines
> tempList := Replace("&", Return, queryString)
>
> listLength := LineCount(tempList)
>
> -- create empty arrays for name and value
> name := Array("", listLength)
> value := Array("", listLength)
>
> repeat with counter := 1 to listLength
> singleLine := GetLine(tempList, counter)
> name[counter] := GetWord(1, Replace("=", " ",
singleLine))
> value[counter]:= GetWord(2, Replace("=", " ",
singleLine))
> end repeat
>
> -- now you will need to add a separate calc icon with a
routine to
> -- read the data from the arrays. name[counter] matches
value[counter]
> =========================
>
> I follow this with another Calc icon (I could have done
it all in one
> calc)
> that parses the names and assigns the values to my
custom AW variables:
>
> =========================
> -- get just the info we want, and store in variables
>
> repeat with counter := 1 to listLength
> if name[counter] = "Lesson1Complete" then
> Lesson1Complete := Number(value[counter])
> else if name[counter] = "Lesson2Complete" then
> Lesson2Complete := Number(value[counter])
> else if name[counter] = "Lesson3Complete" then
> Lesson3Complete := Number(value[counter])
> else if name[counter] = "Lesson4Complete" then
> Lesson4Complete := Number(value[counter])
> else if name[counter] = "Lesson5Complete" then
> Lesson5Complete := Number(value[counter])
> else if name[counter] = "Lesson6Complete" then
> Lesson6Complete := Number(value[counter])
> else if name[counter] = "Lesson7Complete" then
> Lesson7Complete := Number(value[counter])
> else if name[counter] = "Lesson8Complete" then
> Lesson8Complete := Number(value[counter])
> else if name[counter] = "OverviewComplete" then
> OverviewComplete := Number(value[counter])
> else if name[counter] = "grade" then
> score := Number(value[counter])
> else if name[counter] = "passed" then
> passed := Number(value[counter])
> end if
> end repeat
I'd like to point out here that any time you have a series of
variables that
all have identical names except for a number in the variable
name, you
should be looking at lists. I'm surprised, Paul, that you
have lists used
to the extent that you're able to use Value[counter] on the
right side of
the equation, yet you're not using lists on the left side of
the equation.
Let's look at how this code could be made super simple by
having ONE list
variable, LessonComplete, instead of Lesson1Complete through
Lesson8Complete.
-- Assumes a database query returns a string of name=value
pairs
-- delimited by the ampersand (&) character.
-- strip leading & from queryString
--(note you could also not add this ampersand on the PHP
side)
queryString := SubStr(queryString, 1, CharCount(queryString))
-- break into list of individual lines
tempList := Replace("&", Return, queryString)
listLength := LineCount(tempList)
-- create empty arrays for name and value
name := Array("", listLength)
LessonComplete := []
repeat with counter := 1 to listLength
singleLine := GetLine(tempList, counter)
name[counter] := GetWord(1, Replace("=", " ", singleLine))
LessonComplete[name[counter] * 1] := GetWord(2, Replace("=",
singleLine))
end repeat
-- now you will need to add a separate calc icon with a
routine to
-- read the data from the arrays. name[counter] matches
value[counter]
--No you don't...You're DONE :-)
Also note that this is extensible...you can have Lesson 9,
10, etc. and not
have to change the code. You can also lower the amount of
data being
transmitted, because now instead of Lesson8Complete=1 all you
need is 8=1.
This lowers the server load and speeds the response. It has
advantages on
the Authorware side as well, because if, for instance, you
had a series of
buttons that were checked or not based on the completion, you
could do the
same type of loop. Separate variable names do not allow for
that type of
loop unless you use Eval (ugh).
HTH;
Amy -
How to read the data from XML file and insert into oracle DB
Hi All,
I have below require ment.
I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
Many Thanks.Sounds a lot like this question, only with less details.
how to read data from XML variable and insert into table variable
We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us. Plenty of examples abound on the forums that cover the topics you seek as well.
Maybe you are looking for
-
Why is itunes so hard to use - and why can't apple fix it?
why is itunes so hard to use - and why can't apple fix it I dont know anybody who likes the way itunes works.' This last version is beyond awful. It took an already hard to use program - but one that I had at least figured out and made it even harder
-
How do I take the case off to replace a Hard Drive?
I have a 12" G4 and i've take all the screws out but and I notice a few clips by the battery but I can't seem to get the case off to get to the Harddrive. Any ideas? chad...
-
CS3/AS2 need to add a function to FLVPlayer component play button
Hi, I have an instance of the FLVPlayback component in a movie. I need to assign an extra function to the play button in the component (to tell another swf on the same page to stop, I have the function working) how can I find out the button instance
-
Photoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting error, any other way to re-install it without the disk ?
-
PSE 7 - Organiser menu bar collapsed
I would really appreciate some advice to recover the menu bar in the Organiser window (version 7). It seems to have collapsed itself into a couple of hard to see chevrons >> where the menu bar used to be. When you click on the chevrons you get the u