Value of the root element in XML file using JDOM.

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?
javamate06Asked:
Who is Participating?
 
mukundha_expertConnect With a Mentor Commented:
try
root.getText () ;
0
 
CEHJCommented:
It won't have a value - it has child nodes
0
 
objectsCommented:
please post you xml and your code
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Ajay-SinghCommented:
did you try calling

getTextTrim()

on the element.
0
 
javamate06Author Commented:
Ajay-Singh

I tried getTextTrim() but the problem is that the defferent roots have differenet value "Spaces and multi new lines".
0
 
Ajay-SinghCommented:
> defferent roots have differenet value
XML document can have ONLY ONE root element.
0
 
javamate06Author Commented:
XML has one root and the roots of children, and the roots of grand-children.
lets call them heads not root.

0
 
Ajay-SinghCommented:
i am confused ;)

Can you pls post the xml?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.