Skip to content

IsElementNS - cXMLDOMEntity

Returns true if xml node is an element that matches the passed NamespaceURI and basename

Type: Function
Return Data Type: Boolean

Parameters

Parameter Type Description
sNamespaceURI String Namespace-URI string (e.g. http://dataaccess.com/MyURI)
sBaseName String Name of Element excluding the prefix

Syntax

Function IsElementNS String sNamespaceURI String sBaseName Returns Boolean

Call Example

Get IsElementNS sNamespaceURI sBaseName to BooleanVariable

Description

This function is used to search for an xml element by NamespaceURI and BaseName. If the node is an element, it checks to see if the node's psBaseName and psNamespaceURI matches the passed sBaseName sNamespaceURI.

Move "http://www.dataaccess.com/Test/CustomerList" to sNS // the namespace
Get DocumentElement of hoXML to hoRoot
Get FirstChild of hoXml to hoNode
While hoNode
    Get IsElementNS of hoNode sNS "customer" to bIsCust
    If bIsCust begin
        Send HandleCustomerNode hoNode
    end
    Get NextNode of hoNode to hoNode
end

Elements with no NamespaceURI

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.

Col 1 Col 2
Note: When parsing XML documents with namespaces you should always search by NamespaceURI and BaseName. You should not use the element's prefix and you should not attempt to ignore the NamespaceURI.

See Also

ChildElementNS | ChildElementValueNS | NextElementNS | psBaseName | psNamespaceURI | psPrefix

Return Value

Returns true if the node is an element and the element's NamespaceURI and BaseName matches the passed values