AddAttributeNS - cXMLDOMDocumentFragment

Creates an attribute node (that is namespace aware) and adds it to the element node

Type: Procedure

Parameters: String sNameSpace String sName String sValue

ParameterDescription
sNameSpacethe attribute NamespaceURI
sName the name of the attribute node, including a prefix.
sValuethe value of the attribute node


Syntax
Procedure AddAttributeNS String sNameSpace String sName String sValue

Call: Send AddAttributeNS sNameSpace sName sValue


Description

AddAttributeNS encapsulates creation and addition of attributes to an element node. This procedure creates the attribute, sets the values and adds it to the element node that received the message.

If for any reason the node cannot be added to the element, an error will be generated.

This sample adds an attribute using a namespace. Note the use of the prefix (m:).

Move "http://www.dataaccess.com/Test/CustomerList" to sNS
:
Get AddElementNS of hoRoot sNS "Customer"  ""  to hoCust
Send AddAttributeNS of hoCust sNS "m:table" iTable
Send Destroy of hoCust

Attributes are often added to the global namespace. This sample creates an attribute with a global ("") namespace.

// add attribute with no namespace or prefix 
Send AddAttributeNS Of  hoEle "" "table" iTable

You could also use the AddAttribute to create such an attribute

Send AddAttribute Of  hoEle "table" iTable

Attributes and Namespaces

This message creates a node and a document that is namespace aware. This requires that you always pass a NameSpaceURI.

See Also

AttributeValueNS | RemoveAttributeNS | CreateAttributeNodeNS | AddElementNS(send) | AddElementNS(get) | CreateDocumentElementNS | CreateElementNodeNS