Reading XML from JavaScript
Dear All,
I am in need of reading an XML file data and to do some manupulation in Javascript.
I am using "Microsoft.XMLDOM" parser and I have problem in accessing the child node.
I am able to locate a node thru var x= xmlDoc.getElementsByTagName("name of an element") ;
but strucked with reading the child elements.
I didnt find any proper tutorials or documentations.
My need is to read the attribute in the child elements.
Any help in this regard is greatly appreciated.
Thanks in advance.
try www.w3schools.com
Similar Messages
-
Read XML from a hardware sensor file into ODI
Read XML from a hardware sensor file into ODI
Hi,
I am trying to extract xml data from a flowmeter that generates XML data.
The xml file is found in http://ip_address/history.xml
I’ve defined my Topology as such
JDBC Driver: com.sunopsis.jdbc.driver.xml.SnpsXmlDriver
JDBC URL: jdbc:snps:xml?f=http://192.168.0.202/history.xml&ro=true
Please note to access the file I have to supply a username and password so I did in the definition But when testing my setup I get an error:
ava.sql.SQLException: The DTD file "http://192.168.0.202/history.dtd" doesn't exist: Server redirected too many times (20)
Please note I cannot write dtd to the device as it is a read only device.
Has anyone came across such an issue, how can I achieve this.
Thanks
HichamHi David,
Thanks for your reply.
I've tried this jdbc url
jdbc:snps:xml?f=http://192.168.0.202/history.xml&d=c:\temp\history.dtd
but when I test the connection i get the following error
java.sql.SQLException: While generating the DTD from the XML file, a java.io.IOException exception occurred saying: Server returned HTTP response code: 401 for URL: http://192.168.0.202/history.xml
If I browse http://192.168.0.202/history.xml and i supply the username and password I get an xml page.
I've supplied the username and password in the definition tab of the Data Server windows but still getting the above error.
THanks
Hicham -
How can i read XML from local drive using Javascript into Live Cycle
Hello,
I am creating PDF Form using Acrobat LiveCycle.
I want to write java script for load data into relative field and data present into xml file which is located at local drive
I have write all method for parsing xml which is required ............... but i am stuck into how to read/open/load local drive xml using javascript?sandyrock:
You'd better post this message to Adobe LiveCycle forum: http://www.adobeforums.com/webx/.3bbeda8d/
You can use postMessage method in LiveCycle JavaScript to communicate with host application,the host application can be a web brower like IE.
In IE you can use IE javascript to access local XML file. -
Getting error in Mozilla, reading xml using JavaScript
Hi All,
I am working with javascript with xml, getting error in Mozilla
1. see html and xml file and check xml file path before test ---
2. please, go through the html and xml file.
read_xml.html
=================
<html>
<head>
<title>xml file using javascript</title>
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
//loading xml file
function doLoadXML(xmlFile)
xmlDoc.async="false";
xmlDoc.onreadystatechange=doStateVerify;
xmlDoc.load(xmlFile);
rootData=xmlDoc.documentElement;
function doStateVerify()
if (xmlDoc.readyState != 4)
return false;
// reading xml file
function doReadXML()
alert("calling function");
doLoadXML("C:/Documents and Settings/webdeveloper06/Desktop/for_test/comp-info.xml");
alert("loading file...........");
var dataArr=new Array();
dataArr=xmlDoc.getElementsByTagName("comp-info");
for(var m=0; m <= dataArr.length-1; m++)
alert("entering inside looping here");
document.write("<Table border='1px'><tr><td>");
document.write(dataArr[m].getElementsByTagName("name")[0].firstChild.nodeValue);
document.write(dataArr[m].getElementsByTagName("description")[0].firstChild.nodeValue);
document.write(dataArr[m].getElementsByTagName("web-addr")[0].firstChild.nodeValue);
document.write(dataArr[m].getElementsByTagName("address")[0].firstChild.nodeValue);
document.write(dataArr[m].getElementsByTagName("city")[0].firstChild.nodeValue);
document.write(dataArr[m].getElementsByTagName("postal-code")[0].firstChild.nodeValue);
document.write(dataArr[m].getElementsByTagName("country")[0].firstChild.nodeValue);
document.write("</input></td></tr></table>");
</script>
</head>
<body>
<input type="button" value="Display XML Data" onClick="doReadXML()" />
</body>
</html>
com-info.xml
=========
<?xml version="1.0" encoding="iso-8859-1"?>
<itcopany>
<comp-info>
<name>xxx</name>
<description>IT Reaserch Company</description>
<web-addr>http://xxx.com</web-addr>
<address>mehdipatnam</address>
<city>Hyderabad</city>
<postal-code>777888888</postal-code>
<country>IN</country>
</comp-info>
<comp-info>
<name>yyyyy </name>
<description>Non IT Company</description>
<web-addr>http://yyyy.com</web-addr>
<address>xyxxyxyx</address>
<city>Banglore</city>
<postal-code>78878787878</postal-code>
<country>IN</country>
</comp-info>
<comp-info>
<name>zzzzzzz</name>
<description>IT Company</description>
<web-addr>http://zzzzzzz.com</web-addr>
<address>secondrabad</address>
<city>Hyderabad</city>
<postal-code>9999999999999</postal-code>
<country>IN</country>
</comp-info>
</itcopany>
output status
============
1. getting output in IE
2. not getting output in Mozilla
Can anyone Helpout, To get data in Mozilla
regards,
AbuTry to check this document Browser Support for SAP and use PAM (Product Availability Matrix) to check for the compatibility of your SAP system with the browser.
If you are only the user of the Web Dynpro you would have probably no other choice than change the browser. -
Reading XML from Oracle directory to generate charts
Hi,
I have a requirement create graphs, charts and maps based on data from a data warehouse (dw). As I see things, there are two possibilities:
Graphs, charts and maps based on an XML file
Graphs, charts and maps based on Oracle tables
Both would contain small data sets that will allow for quick response. The intent of these graphs, charts and maps is to generate a dashboard that would allow the user to quickly drill down to the desired warehouse data.
The proof of concept has already been validated using the Oracle table scenario. My question is whether or not this could be accomplished reading xml files for generating the same set of dashboard items?
My Oracle database and APEX environments configuration are as follows:
NLSRTL 11.2.0.1.0 Production
Oracle Database 11g Enterprise Edition 11.2.0.1.0 64bit Production
PL/SQL 11.2.0.1.0 Production
TNS for Solaris: 11.2.0.1.0 Production
Application Express 4.2.2.00.11
APEX Listener Release 2.0.2. / Tomcat
An Oracle database directory has been setup and is accessible to our APEX application.
Any suggestions/help is appreciated.
Thanks,
CharlesAn Oracle Directory has an underlying OS directory associated with it, Oracle just overlays it's control structure onto an existing folder in the OS. You can manipulate the files with stored procedures in Oracle or at the OS level from outside of Oracle.
If you manipulate the files from the OS level, outside of Oracle, you may need a refresh of the Oracle Directory structure. -
Write n then read xml from database to create graph in an applet
Hi mates
I have one problem I want show a trend(graph) from sql database which is having the records of about 8600 in a day. And i want to show a graph for a day
but sometimes it gives a problem like out-of-memory, so can anyone tell me how i can get read of it.
and other this can i use xml for this means first write a data in xml format from database then read it at sametime and show graph in applet
can anytell me how to do it
any suggesion is appreciable
thanxHere's are two example for what you are looking for
Re: Load xml data in Oracle table
Re: insert .xml file into xmltype table?
First you need to create a DIRECTORY object. That is how Oracle works and it expects a DIRECTORY object instead of a physical path when performing operations that read/write from disk. The directory path provided to the CREATE DIRECTORY command must be a directory that the machine Oracle DB resides on can see.
Then you can go either of two routes. You can INSERT that XML directly into a table, as shown in the second link I provided or you can read it into PL/SQL as the first link shows. Then in either case, you can use SQL to parse the XML for you.
Depending upon your needs, you may get better performance if you insert the XML into a table as the second link shows, assuming the XMLType column is stored as SECUREFILE BINARY XML. -
How to read XML from web page inside servlet/jsp ?
i have a url, which on sending request, shows XML in browser.
Now i need to read this XML in browser and then manipulate it according to my need and display it on another page.
actually the process is. :
1) i have to first retrieve an xml from other site. (XML will only be shown in browser)
2.)then i have to read the Xml and show it in according to my requirements.
Is there any way to read XML directly from a Web Page ??
is their logic to accomplish this.
e.g in Servlet i can do somewhat like this :
String wholeXml=Somemethod(url);
Please AdviceHi,
if u wanna extract data from XML. you can use Digester(Apache-jakarta) parser. All u need to create the beans(as per the data in xml), that will be populated by Digester.
Digester takes xml(string) as parameter and populates the bean specified.
U can use this bean in ur JSP.
:::Note:::; use Digester in ur servlet.
for more read:::
http://www.onjava.com/pub/a/onjava/2002/10/23/digester.html
I hope it shall work..
@mit -
Not sure if this is even possible.
I am using APEX on a INTERNAL server, on the same network is another server hosting files.
Using PL/SQL code, I need to read the XML file.
So APEX/ORACLE is at http:\\server1\apex\f?p........
And the files are at \\server2\xml\file.xml
Can I load the xml from server2 using pl/sql in server1?
The XML is generated automatically from another system and can not be stored on the APEX server. It does not need to go into the database, just read, parced, and displayed.Hi,
Using PL/SQL code, I need to read the XML file. You can create a directory object pointing to the location on server2 :
CREATE DIRECTORY xml_dir AS '\\server2\xml';then you can access the XML content like this :
DECLARE
v_xml_doc xmltype;
BEGIN
v_xml_doc := xmltype(bfilename('XML_DIR', 'file.xml'), nls_charset_id('CHAR_CS'));
-- XML processing here...
END;
/ -
Hi experts,
I need to read a XML from https address,i have no idea to make it possible, any idea?
points for all
thanks all.Hi,
It is secure link at XI end need to configure SSL else it is not possible. We can read data through HTTP & SOAP adapter.
Find below links for more help.
http://help.sap.com/saphelp_nw04/helpdata/en/14/ef2940cbf2195de10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/f7/c2953fc405330ee10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/14/ef2940cbf2195de10000000a1550b0/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/964f67ec-0701-0010-bd88-f995abf4e1fc
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/23894238-0701-0010-40b0-a0a6d5c4ad9f?prtmode=navigate -
Read xml from application server
Hello guys,
I have craeted program read xml file from presentation server. its working fine...
below is program
now i want to program read xml file from Application server.
so please give me some idea for that.........
<MODIFIED BY MODERATOR - RESPECT THE 2,500 CHARS LIMIT>
thanks
jigar
Edited by: Alvaro Tejada Galindo on Jan 12, 2010 11:50 AMHi
U need to just replace the fm to upload the file with command OPEN DATASET / READ DATASET / CLOSE DATASET: if you upload the data from application server in the same internal table loaded by fm for presentation your report should be the same
Max -
Hi there,
I would like to read XML data from Applet,
first of all is it possible?
If yes then how and will I require any extra pugin other than Java Plug-in?
ThanksSure you can, as long as the applet has permissions to read the xml file. If it is in the same directory as the applet it should be ok.
There is no need for an extra plugin. Here's a starting point:
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(<some stream>);
Element data = doc.getDocumentElement();
NodeList dbChildren = db.getChildNodes(); -
Hello
I need to read a xml from a sql server 2000 database. The field in the database is declare as text.
When a try to read <a>3</a> the database adapter returns something like this.
/a/3//a/.
How do I solve the problem?
Thanks
Gonçalo RibeiroHello again.
I'm using ora:parseEscapedXML to convert the string that contains XML into XML.
I'm doing it in an assign. My doubt is what kind of variable should received the information?
Thanks
Gonçalo Ribeiro -
I am developing web services based GIS, I have XML file which was generated from Geoserver. I dont know how to link Java with XML and query XML from Java. I need help pls.
PAIthere are apis to parse xml using java,
http://www.cafeconleche.org/books/xmljava/chapters/ch09s06.html
try this link..
regards
Shanu -
Help required in writing And Reading Xml From Database
Hi
i m new to java.
i m facing problem while writing Xml file from Mysql Database in java i m using the WebRowSet
and also for Reading WebRowSet
after reading the Xml i have to save this in Database
(required source code)
is there any one to help me in this way
regards
aamirshadab_think_globally wrote:
{noformat}*hi everybody,
please send me a ajax with jsp application
suppose i enter a word in text area ajax will populate/suggest all string from database ,who started
from that entering character(s).like a google string search.
please send full source code
*{noformat}how about you do it yourself? -
Reading XML from a plugin (Mac OSX 10.4.10)
Hi gurus,
Basically, I want to read an XML file from within a plugin, without using the AIXMLxxxSuites. Sound simple? Answers on a postcard please, because I haven't managed it yet, and I'm running out of hair!
I've tried using libxml2, which works great... until you quit Illustrator, then it crashes and I can't stop it from doing so. I can only assume that something's being released when my plugin is unloaded which Illustrator's not expecting, causing a crash on exit, but I'm just guessing.
I've also tried eXpat, which was a complete nightmare to install but I got it working eventually. Only problem is that when you compile it with fink (or some other package manager) it compiles for your specific architecture, i386 in my case. This doesn't end well when you have over 500 mixed PPC/i386 Macs to target.
So anyone else got any ideas? I'm quite new to Mac development coming from a Windows dev background (where'd MSXML go?!) so please be gentle :)
Thanks in advance!
--WI see no reason why you couldn't get libxml, eXpat or Xerces working, however with the provided information I see no way to offer advice.
I suspect it will take a debugger and a good look at your code to understand your situation, so I just offered a (simple) suggestion. I will add that you do get something by developing a home brewed solution, namely no limitations, cross platform capability, and complete understanding (hopefully).
I run a software company based on opensource software, so I routinely build and use the packages you mentioned (without Fink). I am afraid however, that providing assistance here is beyond the scope of this forum.
Best regards,
-jeshua
Maybe you are looking for
-
[JTA_Start_0]Exception getting connection for Oracle DB
Hi All, I am facing a problem when I am going to insert data in a table (Oracle DB) using JTA Command Action block. I have deployed the Oracle JDBC driver and Configured the data source in http://<server<:port>>/nwa->Configuration Management -> Infr
-
How might I determine if my pdf is encrypted?
I have a PDF document on a Linux/Unix box. Will the $ file <filename> command tell me if the pdf file is encrypted. If not, how can I tell if the file is encrypted?
-
Editing titles on mobileme gallery
OK - this is a simple question... I have created albums that I have then posted to MobileMe. So in my source panel, there's a section for Events, Albums and MobileMe Galleries, amongst others. If I want to make changes to my album on MobileMe, do I d
-
I need to add an input to a subvi. Is this possible? Cason Clagg SwRI LabView 7.1, Windows XP
-
I close out of Firefox. Later I try to re-open Firefox but receive the message that it is already running. It is running as a process and not as an application. I have to go into task manager to end the process; only then can I re-open the program.