Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confusion of XML node 1

Status
Not open for further replies.

NMDUC

Programmer
Mar 4, 2006
61
VN
Hi,
I am confused with XML node.

For example, we have this XML document.

<?xml ....>
<doc>
<address type="home">123 BangKoc</address>
</doc>

When we parse it, how many nodes do we have?

Thank in advance.
 
>When we parse it, how many nodes do we have?
If you parse it via some parser, usually, there is some provision allowing user to instruct the parser to preserve or ignore purely whitespace text node.
The counting would be this.
[1] preserve whitespace : totally 2 element nodes + 1 attribute node + 3 text nodes.
[2] ignore whitespace : totally 2 element nodes + 1 attribute node + 1 text node.
 
Thank tsuji.

So, there are 4 nodes totally when we ignore whitespace. If we want to make a new version from this old version and the change rate is 5%, the number of different nodes in new version would be 4*5%, right?
 
If the original is (2,1,1), the new version would be (2,1,1)*(1+5%). But it sounds terribly like calculating principal plus interests from your saving accounts with the bank. So I don't know the meaning behind it.
 
Because I see the total nodes in original are 4. And we make new version that change ratios is 5%. Therefore, the number of nodes in new version that is different to nodes in old version should be 4*5%. It is what I understant. We don't need to know what kind of nodes changes. It might be changes in content of text node, or insertion of new nodes... The important thing is how many nodes have changed.

Sorry that I don't understand when you wrote (2,1,1)*(1+5%). Why do we need plus one?



 
It doesn't matter. Your description of the idea is just fine and you can go with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top