Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007, 06:27 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Print XML tag
Hey,

I have written some java code to Parse an XML file.

It is almost exactly the same as the code here:

A Simple Way to Read an XML File in Java - Print Version

Basically, I have it returning the XML values but what I want to be able to do now is to return the actual tag.

So if we have:

<age>22</age>

I have the code which will return: 22

Now I need the code to show the actual TAG: <age>

Does anyone know how this can be done????

THANKS!!!!!!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 06:52 PM
Senior Member
 
Join Date: Mar 2007
Posts: 136
goldhouse is on a distinguished road
Code:
System.out.println("Age : " + ((Node)textAgeList.item(0)).getNodeValue().trim());
Assumes this is printing the age Change like this
Code:
System.out.println("Age : " + ((Node)textAgeList.item(0)).asXMLString().subString(55));
XMLString() will return an xmlstring just remove the "<?xml version="1.0"?>" so we added the substring function
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-07-2007, 07:02 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Hey,

Thanks for the quick reply.

.asXMLString() doesn't seem to be recognized? Any ideas?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
print line kazitula Java Applets 2 01-26-2008 03:05 PM
Print Area Riftwalker Advanced Java 0 11-28-2007 08:28 PM
doubt about PRINT API valery New To Java 1 08-06-2007 10:51 PM
Print A Pdf Jack Advanced Java 2 07-02-2007 06:40 AM
print .doc in java Alan Advanced Java 1 05-17-2007 05:05 AM


All times are GMT +3. The time now is 07:03 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org