Community articlegetAttributeList method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This method returns a list of attributes and a list of corresponding namespaces for a given node. For example, the following XFDL represents a mimedata node:
   <mimedata encoding="base64"></mimedata>

In this sample, getAttributeList will return a list of attributes that contains encoding and a list of namespaces that contains http://www.ibm.com/xmlns/prod/XFDL/7.5.

Method

public void getAttributeList(
   StringListHolder theNamespaces,
   StringListHolder theAttributeList
   ) throws UWIException;


Parameters

Table 1. Method parameters
ExpressionTypeDescription
theNamespacesStringListHolderA pointer that contains a list of namespace URIs. For example:
http://www.ibm.com/xmlns/prod/XFDL/7.7

Each URI corresponds to the attribute in the same position in the attribute list.
theAttributeListStringListHolderA list of attributes. For example, compute, encoding, and so on. Each attribute corresponds to a URI in the same position in the namespace list.


Returns

Nothing or throws a generic exception (UWIException) if an error occurs.

Example

The following method uses getAttributeList to retrieve the list of a node's attributes. It then searches through the list looking for a compute attribute. When it locates a compute attribute, it uses removeAttribute to remove the compute from the node.
   private static void stripComputes(FormNodeP theNode) throws Exception
   {
   int counter;
   StringListHolder URIList = new StringListHolder[];
   StringListHolder attributeList = new StringListHolder[];
      /* Retrieve the list of attributes for the supplied node. */   
      theNode.getAttributeList(URIList, attributeList);
      /* Step through the list searching for the compute attribute. If the
         compute attributes is found, delete it. */
      for (counter = 0; counter < attributeList.value.length; counter++)
      {
         if (attributeList.value[counter].equals("compute"))
         {
            theNode.removeAttribute(URIList.value[counter],
               attributeList.value[counter]);
         }
      }
   }


Parent topic:
FormNodeP class