Solved

Value of the root element in XML file using JDOM.

Posted on 2006-07-10
8
201 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
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 10

Accepted Solution

by:
mukundha_expert earned 50 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HSSFWorkbook cannot be resolved error 10 66
fibonacci ten numbers 4 38
Way to decrease size of apk file 9 65
java stored proc example 9 29
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

786 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