..... But am not able to fetch the value of LoadTicket" name="description">
Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa XML Retrieving attribute value from XML
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Kumar Navin
Retrieving attribute value from XML
2 Answer(s)      3 years and 11 months ago
Posted in : 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.


Advertisement
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.



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...-values-from-a-nodel.shtml http://www.roseindia.net/xml/dom/GetData.shtml Thanks
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 XML Data Using GWT
Retrieving XML Data Using GWT       This Example Describes the way of retrieving XML file Data from...;static final String XML_LABEL_STYLE = "xmlLabel"
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
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 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
get element through attribute - XML
link: http://www.roseindia.net/xml/ Hope that it will be helpful for you
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
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
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...; } } Output: Actual value of attribute : 5677
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
Retrieving JTree structure from database
Retrieving JTree structure from database       This example shows how to retrieving data from... the steps required to create tree retrieving the data from the database. Here
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
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
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
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 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
 

 

 

DMCA.com