I posted this in the General section of the new Forum but thought it would
be prudent to put it here too!
I am trying to understand the GetAttribute method of XMLElement and this
example project from RS has it and it works. Now all I have to do is figure
out what some of the pieces are doing.
In the parse_DisplayAtts method it has:
Dim i as integer
Dim n as XmlNode
parse_atts.DeleteAllRows
parse_displayAttNode("Name", node.Name)
parse_displayAttNode("Type", str(node.Type))
parse_displayAttNode("Children", str(node.ChildCount))
if node isa XmlElement then
parse_displayAttNode("Attributes:", str(XmlElement(node).AttributeCount))
for i = 0 to XmlElement(node).AttributeCount - 1
if (parse_nodeStorage.HasKey(node_id + "_" + str(i))) then
n = parse_nodeStorage.Value(node_id + "_" + str(i))
else
n = XmlElement(node).GetAttributeNode(i)
parse_nodeStorage.Value(node_id + "_" + str(i)) = n
end if
parse_displayAttNode(n.Name, n.Value)
next
end if
Exception e as XmlDomException
msgbox e.Message
1. When this line runs:
n = XmlElement(node).GetAttributeNode(i)
n is no longer XMLNode but rather XMLElement is that what the first part of
the syntax is doing, and if so why? Couldn't a separate Dim statement set
something to be an XMLElement and handle this or is there some high reason
for this reuse of n?
2. parse_nodeStorage is used in the next line and is listed as a property
"as dictionary". What is the purpose of this in this context. Isn't it just
storing the XMLElement n's info? Is this the only way that XML data can be
temporarily store as opposed to in a variable?
Every time I think I have a handle on XML something else comes along to
confuse me again, but I know I am gaining on it!
_________________
Regards,
Bill
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|