-
childNodes returning Xtra children???
Hi,
Confessed XML donkey though i am, has any body else had problems with childNodes giving more nodes than is there?
This sounds mental i know, but i have a node that has 10 child nodes... i know this as its from a SQL statement that selects Top 10....and i can see that it has..... but if i check the returned XML Doc
Code:
var dataNode:XMLNode=dbData.childNodes[1]
trace("dataNode - :"+dataNode.childNodes.length)
...it gives me 21!!!
if i trace out every child i get a node...then nothing...then a node etc..
the XML doc is thus - copied direct from an output text field..
Code:
<dataroot>
<flsdata>
<Name>jon1</Name>
<TotalScore>100</TotalScore>
</flsdata>
<flsdata>
<Name>jon2</Name>
<TotalScore>99</TotalScore>
</flsdata>
<flsdata>
<Name>jon3</Name>
<TotalScore>98</TotalScore>
</flsdata>
<flsdata>
<Name>jon4</Name>
<TotalScore>97</TotalScore>
</flsdata>
<flsdata>
<Name>jon5</Name>
<TotalScore>96</TotalScore>
</flsdata>
<flsdata>
<Name>jon6</Name>
<TotalScore>95</TotalScore>
</flsdata>
<flsdata>
<Name>jon7</Name>
<TotalScore>94</TotalScore>
</flsdata>
<flsdata>
<Name>jon8</Name>
<TotalScore>93</TotalScore>
</flsdata>
<flsdata>
<Name>jon9</Name>
<TotalScore>92</TotalScore>
</flsdata>
<flsdata>
<Name>jon10</Name>
<TotalScore>91</TotalScore>
</flsdata>
</dataroot>
Its got to be something with the file, but i cant see it. If i paste this into a string and create XMl from it it gives me 10!!!!
I hate XML......so any pointers would be greatly appreciated
CHeers
Jon
-
up to my .as in code
Saving your xml on my server (as "jayhoo.xml") I get what I should loading it in the usual ways. Your example was for the count so here is the count:
_root.createTextField("mydata",1,40,40,300,100);
dbData = new XML();
dbData.ignoreWhite = true;
dbData.onLoad = function(success) {
if (success) {
var dataNode = dbData.firstChild;
_root.mydata.text = dataNode.childNodes.length;
}
}
dbData.load("jayhoo.xml");
stop();
Last edited by Chris_Seahorn; 09-08-2006 at 06:57 PM.
-
thanks for getting back.
Yeah thats exactly what i get too...unfortunately this XML is being sent via compressed UDP packet. The file looks fine and liek you say if saved gives the correct node count.....
Unfortunately when checking the actual returned file...its giving me these ghost nodes. I can write a loop to ignore them but a bit annoying and doint like not knowing why its not working!
Thanks anyway
Jon
-
up to my .as in code
It has to be the compression...when I write it here and run it I have no extra anything. I can run a preview of it running here to show that if need be.
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|