GetAttribute

Description

The GetAttribute method is overloaded:

  • Syntax 1 returns the PBDOM_ATTRIBUTE object for a PBDOM_ELEMENT object using the name of the PBDOM_ATTRIBUTE.

  • Syntax 2 returns the PBDOM_ATTRIBUTE object for a PBDOM_ELEMENT object with the name provided and within the namespace specified by the prefix and URI provided.

Syntax

For this syntax

See

GetAttribute(string strName)

GetAttribute Syntax 1

GetAttribute(string strName, string strNamespacePrefix, string strNamespaceUri)

GetAttribute Syntax 2


GetAttribute Syntax 1

Description

Returns the PBDOM_ATTRIBUTE object for a PBDOM_ELEMENT object.

Syntax

pbdom_element_name.GetAttribute(string strName)

Argument

Description

pbdom_element_name

The name of a PBDOM_ELEMENT object

strName

The name of the PBDOM_ATTRIBUTE to be returned


Return value

PBDOM_ATTRIBUTE. The PBDOM_ATTRIBUTE object matching the name specified in the method parameter. If no such PBDOM_ATTRIBUTE object exists, the GetAttribute method returns a value of null.

Throws

EXCEPTION_INVALID_NAME -- If the supplied name is a qualified name that contains a namespace prefix.

Examples

The GetAttribute method is invoked for the following XML document:

<MyMusic:abc xmlns:MyMusic="http://www.MyMusic_records.com"  My_Attr="My MyMusic Attribute">Root Element Data</MyMusic:abc>

The GetAttribute method is invoked from the following PowerScript statement:

pbdom_attr = &
   pbdom_doc.GetRootElement().GetAttribute("My_Attr")

The GetAttribute method returns the PBDOM_ATTRIBUTE object My_Attr.

Usage

If the PBDOM_ATTRIBUTE name specified in the method parameter is a qualified name, an exception is thrown. A qualified name appears in the following form: [namespace_prefix]:[local_name].

See also

GetAttribute Syntax 2

GetAttributes

GetAttributeValue

HasAttributes

SetAttribute

SetAttributes

GetAttribute Syntax 2

Description

Returns the PBDOM_ATTRIBUTE object for a PBDOM_ELEMENT object with the name provided and within the namespace specified by the prefix and URI provided.

Syntax

pbdom_element_name.GetAttribute(string strName, string strNamespacePrefix, string strNamespaceUri)

Argument

Description

pbdom_element_name

The name of a PBDOM_ELEMENT object

strName

The name of the PBDOM_ATTRIBUTE to be returned

strNamespacePrefix

The prefix of the namespace of the PBDOM_ATTRIBUTE to return

strNamespaceUri

The URI of the namespace of the PBDOM_ATTRIBUTE to return


Return value

PBDOM_ATTRIBUTE. The PBDOM_ATTRIBUTE object matching the name, namespace prefix, and URI specified in the method parameters. If no such PBDOM_ATTRIBUTE object exists, the GetAttribute method returns a value of null.

Throws

EXCEPTION_INVALID_ARGUMENT -- If any of the arguments is invalid, for example, null.

EXCEPTION_MEMORY_ALLOCATION_FAILURE -- If there was any memory allocation failure during the running of this method.

See also

GetAttribute Syntax 1

GetAttributes

GetAttributeValue

HasAttributes

SetAttribute

SetAttributes