Skip to content

RemoveAttributeNS - cXMLDOMElement

Removes an attribute from an element node based on NamespaceURI and BaseName

Type: Procedure

Parameters

Parameter Type Description
sNameSpace String The attribute NamespaceURI
sBaseName String the name of the attribute node to be removed

Syntax

Procedure RemoveAttributeNS String sNameSpace String sBaseName

Call Example

Send RemoveAttributeNS sNameSpace sBaseName

Description

RemoveAttributeNS removes a named (NamespaceURI and BaseName) attribute from an element node.

This sample removes an attribute with a global ("") namespace. This will be very typical.

Send RemoveAttributeNS of hoElement "" "Type"

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

Move "http://www.dataaccess.com/Test/CustomerList" to sNS
:
Get ChildElementNS of hoRoot sNS "Customer" to hoCust

If (hoCust > 0) Begin
    Send RemoveAttributeNS of hoCust sNS "m:table" iTable
    Send Destroy of hoCust
End

Namespaces

This message removes a node and a document that is namespace aware. This requires that you always pass a NameSpaceURI. It is suggested that you always create documents using namespace methods (the methods that end in NS) and that you no longer use the non-namespace methods (e.g. use RemoveAttributeNS and not RemoveAttribute).

If your document does not have any namespaces or an element within the document does not have a namespace, its namespace is considered to be global and its NamespaceURI is represented as an empty string (""). In such a case you can and should use these namespace aware messages passing an empty string for the NameSpaceURI.

Attributes and Namespaces

Attributes are less likely to use namespaces (i.e., they are more likely to use the global namespace) which means you will often be passing the "" NamespaceURI string.Attributes never use the default namespace (xmlns="xx"). If the attribute does not have a prefix, it is in the global namespace.A Prefix will get added to the attribute name by adding the prefix to the sName (e.g., sName="m:table").

See Also

AddAttributeNS | AttributeValueNS | AttributeValueNodeNS