?
Solved

Value of the root element in XML file using JDOM.

Posted on 2006-07-10
8
Medium Priority
?
210 Views
Last Modified: 2011-10-03
When I print the value of a root element "root is not leaf, so it has children" by getValue() method in JDOM, the output was spaces with new lines.

I want to knew:
 what is the value of root element?
0
Comment
Question by:javamate06
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17076621
It won't have a value - it has child nodes
0
 
LVL 92

Expert Comment

by:objects
ID: 17077851
please post you xml and your code
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17078491
did you try calling

getTextTrim()

on the element.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
mukundha_expert earned 100 total points
ID: 17078977
try
root.getText () ;
0
 

Author Comment

by:javamate06
ID: 17079199
Ajay-Singh

I tried getTextTrim() but the problem is that the defferent roots have differenet value "Spaces and multi new lines".
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17079273
> defferent roots have differenet value
XML document can have ONLY ONE root element.
0
 

Author Comment

by:javamate06
ID: 17079312
XML has one root and the roots of children, and the roots of grand-children.
lets call them heads not root.

0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17079411
i am confused ;)

Can you pls post the xml?
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question