Solved

Value of the root element in XML file using JDOM.

Posted on 2006-07-10
8
203 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb on wildfly 5 61
Better way to make a string with template variables in java 3 51
Java class and jar 3 59
Eclipse neon2 "Java build path" correctness 7 43
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

737 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