..... But am not able to fetch the value of LoadTicket" name="description">

Retrieving attribute value from XML

Retrieving attribute value from XML

I have an XML as below to parse: <LoadTicketRequest> <LoadTicket LoadTicketID="S-123345"> .....

But am not able to fetch the value of LoadTicketId attribute.

My code snippet is as below: DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xmlRecords)); Document doc = db.parse(is); NodeList nodes = doc.getElementsByTagName("LoadTicket"); Element ticketelement = (Element) nodes.item(0); NodeList ticketid = ticketelement.getElementsByTagName("LoadTicketID"); Element eticketid = (Element) ticketid.item(0); System.out.println( "Ticket ID : " + getCharacterDataFromElement(eticketid) );

Can someone help me out as to where am going wrong.

View Answers

December 13, 2010 at 10:21 PM

I was able to find the error. I was treating attribute as an element. No more response needed.


December 14, 2010 at 11:48 AM









Related Tutorials/Questions & Answers:
Retrieving attribute value from XML
Retrieving attribute value from XML  I have an XML as below to parse...; ..... But am not able to fetch the value of LoadTicketId attribute. My code...://www.roseindia.net/xml/getting-text-values-from-a-nodel.shtmlADS_TO_REPLACE_3 http
retrieving xml document from database
retrieving xml document from database  Hi Guys, I want to retrieve the xml document stored in the database on to a jsp page using jdbc/odbc connnection.Please help me in implementing this feature. Thank You Madhu
Advertisements
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
check radio button on retrieving the value from database.
check radio button on retrieving the value from database.  HI i am new to jsp.In my applcation i having a problem. I am retrieving user payment from... checked.If user has done payment through cash then when i am retrieving user
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending a code now i am getting a particular column value i.e EmailId column... onl single column value i.e EmailId values to send for a different employees
Retrieving value from multiple table in database
Retrieving value from multiple table in database  Hi fnds, I want... FROM ( SELECT * FROM month1 UNION ALL SELECT * FROM month2 UNION ALL SELECT * FROM month3 ) AS somealias GROUP BY uname
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending... this message to all the employees when i upload a file then it fetch a data from that excel sheet i.e this matter will take a para meter values from the excel
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending... this message to all the employees when i upload a file then it fetch a data from that excel sheet i.e this matter will take a para meter values from the excel
Read the value from XML in java
Read the value from XML in java  Hi, i have an XML... the permissions on that file.So how can i read that value. This is little urgent.... <param name="file" value="D:/Lakki
JDOM Element Example, How to get attribute value of xml element.
JDOM Element Example, How to get attribute value of xml element. In this tutorial, we will see how to get attribute value of xml element.. Element ... getAttribute(String name) The getAttribute() method returns attribute value
How to read value from xml using java?
How to read value from xml using java?  Hi All, I want to read value from following xml using java.. In <Line>,data is in format of key and value pair.. i want to read only values..could u plz help me in this?Thanks
Retrieving Data From the XML file
Retrieving Data From the XML file  ... is only geared towards showing how to construct a Java object from an XML document.  By this example we are going to get the XML data from the xml file in our
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute of jsf tag
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute in jsf
Retrieving XML Data Using GWT
Retrieving XML Data Using GWT       This Example Describes the way of retrieving XML file Data from the server using GWT. The basic building block for running
retrieving from db - JSP-Servlet
retrieving from db  hello' I am trying to write my first application...; Hi Retrive value from database Retrive data from...: rst=stmt.executeQuery("select * from books_details"); 27: %> 28
Retrieving XML Data Using GWT
Retrieving XML Data Using GWT       This Example Describes the way of retrieving XML file Data from...;private static final String XML_LABEL_STYLE = "
Retrieving specific data from excel
Retrieving specific data from excel  Hello everyone, i have written a simple code to retrieve data from excel sheet and working fine, the excel file... first sheet from the workbook HSSFSheet sheet = workbook.getSheetAt(0
getting problem in storing & retrieving value in database
getting problem in storing & retrieving value in database  Hello everyone i am doing a project where my back end is ms access & i want to store value like 5353250214 so if i store it as long int in access it wont take it &
retrieving info from DB using struts?
retrieving info from DB using struts?  Hi. I was looking info about retrieving info from a database using struts. I need a .java that I suppose connects to a database and show the info on a jsp. Somebody could help me
Retrieving the Image from a database Table
Retrieving the Image from a database Table Consider a case where we want... to retrieve the image from the database table. You can do it very easily after... from the database table our java program need to make a connection
JDOM Attribute Example, How to convert value of attribute in different data type
JDOM Attribute Example, How to convert value of attribute in different... library. The JDOM libraries allows you to modify the value of node attribute...: Actual value of attribute : 5677 Int value of attribute : 5677 Double
Retrieving Data from Database to fill Combo Box
Retrieving Data from Database to fill Combo Box  Sir, I have a JSP Page with a combo box and a label. I have a database that has two fields id and an image. Now I want to fill the combo box with image and on selecting
get element through attribute - XML
link: http://www.roseindia.net/xml/ Hope that it will be helpful for you
Retrieving JTree structure from database
Retrieving JTree structure from database       This example shows how to retrieving data from... of information from which the user can make single or multiple selections. In list You can
how to update xml from java - XML
how to update xml from java  hi, Im new to xml parsing and dont know much about. I need to modify the attribute val of a tag in a complex xml file... Girish Tewari We are going to modify the value of this XML file
retrieving of data from one jsp to another jsp - JSP-Servlet
retrieving of data from one jsp to another jsp  using jsp i m displaying a table ,in table i m displaying a radio button then values like id,name etc ,if i click on an radio button i have to get a corresponding id value
Getting Attributes And its Value
functionality to get the attribute and its value from a xml file.  Here... and their value from a XML document using the SAX APIs.  Description... Getting Attributes And its Value   
The code for retrieving data from database into Drop Down List.
The code for retrieving data from database into Drop Down List.  <... to MySQL"); PreparedStatement pre = con.prepareStatement("select * from...// <% String value = request.getParameter("BookList"); pre
JDOM Attribute Example, How to add a list of attribute at a xml file element.
JDOM Attribute Example, How to add a list of attribute to a xml file In this tutorial, we will see how to add a list of attribute to a xml file element...; attribute, which we want to add to xml element. The add() method ofArrayList add
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
retrieving values from dynamically added textboxes in jsp - JSP-Servlet
retrieving values from dynamically added textboxes in jsp  hai friends, iam new to this site ,please help me in this senario in jsp how to retrieve values from dynamically added textbox like we can see in naukri.com
returning a value from Threads
returning a value from Threads  Hello I have worker pattern that uses ExecutorService to schedule Thread execution but getting stuck at some point when returning a value using Future.I have code snippet below: ExecutorService
retrieving data from database to the textbox depending upon the id in jsp
retrieving data from database to the textbox depending upon the id in jsp  Hi, our project involves fetching of data from database into textbox depending upon another textbox value which is productid.First the id entered by us
How read xml file value in dojox chart - XML
How read xml file value in dojox chart  How to read the xml file value in dojox chart
retrieving newly added records from mssql database and display in a jsp
retrieving newly added records from mssql database and display in a jsp ... from mssql database table and display those records in a jsp.And i have to delete these 10 records from the jsp and retrieve the next recently added 10 records
JDOM Element Example, How to set attribute of xml element in java.
JDOM Element Example, How to set attribute of xml element in java. In this tutorial, we will see how to set attribute of xml element in java with the help...(String name, String value)method set a attribute of an element with given name
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one... of the server it has to display the process name from database into the process name
Jsp Option Value
a select box by retrieving the value from the database in jsp. For further processing... Jsp Option Value   ... <select name=""> <option value="">
Retrieve data from xml using servlets
Retrieve data from xml using servlets  Hi plz send me the code for retrieving the data from xml File using Servlets.   Hi, Do you want to read and parse the XML file in servlet? Please ask your question in detail.ADS
retrieving data in to the dropdown box from postgresql database in core java
retrieving data in to the dropdown box from postgresql database in core... have selected '"+value+"' from ComboBox"); } }); f.add...=st.executeQuery("SELECT role_name from role WHERE dept_id=1234"); if(rs
Retrieving Information From Database in JSF Framework - Development process
Retrieving Information From Database in JSF Framework  Requirement : There will be one welcome.jsp in that one button, if we click that button... retrieved from database. see how the datatable in select.jsp should be http
how to check dates while retrieving data from database
how to check dates while retrieving data from database  i want to update database record based on delivery date i have tried this query but it wont work b="update deliveryorder set prtnm='"+arr[1]+"',stn='"+arr[0]+"',sbston
retrieving from oracle database using jsp combo box
retrieving from oracle database using jsp combo box  hi this is my... name of the server has to display in the process name field from the oracle... error = ""; if (!(document.getElementById("startpath").value
questions from an xml file
questions from an xml file  i am developing online bit by bit exam for that i retrieved questions from an xml file but when i retrieved using jsp i am getting all questions at a time in a single page.but i want to show one
JDOM Element Example, How to remove attribute of xml element in java.
JDOM Element Example, How to remove attribute of xml element in java. In this tutorial, we will see how to remove attribute of xml element in java... name) The removeAttribute(...) method remove attribute from existing element
passing value from javascript popup
passing value from javascript popup  How to take user input and pass that input value using popup in Javascript
retrieving image from mysql db with standard height and width
retrieving image from mysql db with standard height and width  Hi . Here is my code to retrieve an image from mysql db. Its working properly. But i... = con.prepareStatement("select * from image"); ResultSet rs=pre.executeQuery

Ads