Technical References - [xmlnodesattributes]

This context is used to iterate the attributes of a specific XML node.

numero = 286
interpreted = N
texte = [xmlnodesattributes ref=...&path=...] [/xmlnodesattributes] The 'path' parameter is used to locate the node. As with the [xmlnodes] context, the 'path' parameter has three modes; 'named:', 'indexed:', and 'xpath:'. Optional Tag Parameters: ref - Reference to an xml object variable. If this parameter is not provided, then it is assumed that there is an 'outer' [xmlnode/s] context from which to reference a particular XML node. path - Path to the desired XML node. If an XPath expression is used, it should evaluate to a single node. Optional Context Tags: [name] - The name of the current iterated XML node attribute. [value] - The value of the current iterated XML node attribute. [index] - The 'count' of the current iterated attribute. [numfound] - The total 'count' of iterated attributes. Lets use the [xmlnodesattributes] context to retrieve the attributes of the first CD node of the example1.xml file...
[xmlparse var=xml_var1][include file=example1.xml][/xmlparse]
Attributes for the 'CD' node:
[xmlnode ref=xml_var1&path=indexed:1/1][content][/xmlnode]
Are...
[xmlnodeattributes ref=xml_var1&path=indexed:1/1][name]=[value][/xmlnodeattributes]
Results... Attributes for the 'CD' node:
<CD status="instock" id="123"><TITLE>Empire Burlesque</TITLE><ARTIST>Bob Dylan</ARTIST><COUNTRY>USA</COUNTRY><COMPANY>Columbia</COMPANY><PRICE>10.90</PRICE><YEAR>1985</YEAR></CD>
Are... id=123 status=instock To simplify the code, we could place the [xmlnodesattributes] context 'inside' of the [xmlnode] context. In this case, we will not need to supply the 'path' or 'ref' parameters to [xmlnodesattributes], since it will use the 'implied' XML node in the outer [xmlnode] context. We use...
[xmlparse var=xml_var1][include file=example1.xml][/xmlparse]
Attributes for the 'CD' node:
[xmlnode ref=xml_var1&path=indexed:1/1][content]
Are...
[xmlnodeattributes][name]=[value][/xmlnodeattributes][/xmlnode]
Results... Attributes for the 'CD' node:
<CD status="instock" id="123"><TITLE>Empire Burlesque</TITLE><ARTIST>Bob Dylan</ARTIST><COUNTRY>USA</COUNTRY><COMPANY>Columbia</COMPANY><PRICE>10.90</PRICE><YEAR>1985</YEAR></CD>
Are... id=123 status=instock [xmlnodesattributes ref=...&path=...] [/xmlnodesattributes]

The 'path' parameter is used to locate the node. As with the [xmlnodes] context, the 'path' parameter has three modes; 'named:', 'indexed:', and 'xpath:'.

Optional Tag Parameters:

ref - Reference to an xml object variable. If this parameter is not provided, then it is assumed that there is an 'outer' [xmlnode/s] context from which to reference a particular XML node.

path - Path to the desired XML node. If an XPath expression is used, it should evaluate to a single node.

Optional Context Tags:

[name] - The name of the current iterated XML node attribute.

[value] - The value of the current iterated XML node attribute.

[index] - The 'count' of the current iterated attribute.

[numfound] - The total 'count' of iterated attributes.

Lets use the [xmlnodesattributes] context to retrieve the attributes of the first CD node of the example1.xml file...

[xmlparse var=xml_var1][include file=example1.xml][/xmlparse]

Attributes for the 'CD' node:
[xmlnode ref=xml_var1&path=indexed:1/1]
[content]
[/xmlnode]

Are...
[xmlnodeattributes ref=xml_var1&path=indexed:1/1]
[name]=[value]

[/xmlnodeattributes]

Results...

Attributes for the 'CD' node:
<CD status="instock" id="123">
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>

Are...
id=123
status=instock

To simplify the code, we could place the [xmlnodesattributes] context 'inside' of the [xmlnode] context. In this case, we will not need to supply the 'path' or 'ref' parameters to [xmlnodesattributes], since it will use the 'implied' XML node in the outer [xmlnode] context.

We use...
[xmlparse var=xml_var1][include file=example1.xml][/xmlparse]

Attributes for the 'CD' node:
[xmlnode ref=xml_var1&path=indexed:1/1]
[content]

Are...
[xmlnodeattributes]
[name]=[value]

[/xmlnodeattributes]
[/xmlnode]

Results...

Attributes for the 'CD' node:
<CD status="instock" id="123">
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>

Are...
id=123
status=instock

DOWNLOAD WEBDNA NOW!

Top Articles:

WebDNA Modules

A list of the currently available modules...

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

WebDNA reference

...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

WebDNA Libraries

A list of available libraries for WebDNA...

Tips and Tricks

A list of user-submitted tips ...

Related Readings:

[movefile]

This instructions move a file from one location to another...

[tcpsend]

A powerful feature that sends text to a TCP server program on a remote machine...

Implement BioType

Here is the JavaScript code that captures the keystroke dynamics of a demo user and how to make WebDNA analyze it...

[ddesend]

Sends text to a DDE server program on the local machine...

[addlineitem]

Adds a product to the specified shopping cart...

[listdatabases]

Lists all the currently-open databases...