realbasic-nug
[Top] [All Lists]

XML Example sample project

To: realbasic-nug at lists dot realsoftware dot com
Subject: XML Example sample project
From: William Antonacchio <wdacld at adelphia dot net>
Date: Fri, 30 Sep 2005 15:49:27 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:sender:to:subject:mime-version:content-type; b=EvEOny17eIQB/S9Z+Qc5cjN44dVjfnhHL4IXn7jJpfJFQGT7Rb5tN9P+OyCJLb19e8wySX4TFxq4mH9hX3abrf7hASTyL/8aOllApKnMzmJER6AsLgAwX5bM61mVR79YOufUwZhJW2cq+fIFyF5/+TrVpvIM7B4Ng7HbwV9gPKQ=
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>

<Prev in Thread] Current Thread [Next in Thread>
  • XML Example sample project, William Antonacchio <=