| Author |
getChildren method returns 0
|
Sara Bony
Greenhorn
Joined: May 18, 2012
Posts: 18
|
|
Hi Dear All
For an xml file which its root has 25 children, getChildren method return list.size= 0 !!
java code:
XML file:
Any idea?
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
I don't know JDOM, but "id" and "runtime" are attributes of a <job> Element, not children so even if you got the Elements it would not work like you expect.
Bill
|
Java Resources at www.wbrogden.com
|
 |
Sara Bony
Greenhorn
Joined: May 18, 2012
Posts: 18
|
|
William Brogden wrote:..., but "id" and "runtime" are attributes of a <job> Element, not children
Thanks a lot ,
i correct that.
But why getChildren method doen,t return 25 for list.size?
|
 |
g tsuji
Ranch Hand
Joined: Jan 18, 2011
Posts: 359
|
|
[0]
File xmlFile = new File("g:\\*");
Don't see how this might be proper with a wildcard like that? But you probably have a right file properly put there in your code.
[1]
But why getChildren method doen,t return 25 for list.size?
Your xml has rootNode in a default namespace and that jobs have that namespace inherited, you have to take that structure into account.
|
 |
Sara Bony
Greenhorn
Joined: May 18, 2012
Posts: 18
|
|
g tsuji wrote:
...
[1]
But why getChildren method doen,t return 25 for list.size?
Your xml has rootNode in a default namespace and that jobs have that namespace inherited, you have to take that structure into account.
Thanks.
It works now.
|
 |
 |
|
|
subject: getChildren method returns 0
|
|
|