Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getChildren method returns 0

 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 672
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic