Solved

Value of the root element in XML file using JDOM.

Posted on 2006-07-10
8
200 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
 
LVL 10

Accepted Solution

by:
mukundha_expert earned 50 total points
ID: 17078977
try
root.getText () ;
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
basic hardware to learn oop advanced design patterns 3 88
splitOdd10 challenge 5 74
Java passing arguments (type error) 2 46
Way to decrease size of apk file 9 40
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

947 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

18 Experts available now in Live!

Get 1:1 Help Now