Solved

Value of the root element in XML file using JDOM.

Posted on 2006-07-10
8
199 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
Comment Utility
It won't have a value - it has child nodes
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
please post you xml and your code
0
 
LVL 23

Expert Comment

by:Ajay-Singh
Comment Utility
did you try calling

getTextTrim()

on the element.
0
 
LVL 10

Accepted Solution

by:
mukundha_expert earned 50 total points
Comment Utility
try
root.getText () ;
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:javamate06
Comment Utility
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
Comment Utility
> defferent roots have differenet value
XML document can have ONLY ONE root element.
0
 

Author Comment

by:javamate06
Comment Utility
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
Comment Utility
i am confused ;)

Can you pls post the xml?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 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…
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 …

763 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now