• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

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?
0
javamate06
Asked:
javamate06
1 Solution
 
CEHJCommented:
It won't have a value - it has child nodes
0
 
objectsCommented:
please post you xml and your code
0
 
Ajay-SinghCommented:
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!

 
mukundha_expertCommented:
try
root.getText () ;
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now