+ Start a Discussion
SalesRedSalesRed 

How To Get Full XMLNode Element Attributes WIthout Using getAttributeKeyAt Function

Hello,

 

If I have the following node element <MyNodeElement EchoToken="5437596" TimeStamp="2006-02-04T15:06:15-0500" Target="MyOrg" Version="1" SequenceNmbr="123456" xmlns="http://www.myns.org/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 

and in my Apex Code I need to get the full Node element Attributes and Namespaces (without child elements).  Can this be done without having to do something like the following (a for loop to get attributes)

 

for (Integer attributeInt=0; attributeInt<requestTypeNode.getAttributeCount(); attributeInt++){

System.debug('Attribute Name=' + requestTypeNode.getAttributeKeyAt(attributeInt));
System.debug('Attribute Value=' + requestTypeNode.getAttributeKeyNsAt(attributeInt));

}

 

Is there a function I can use to return all attributes and namespaces in the element or do I have to get each attribute/namespace individually using a processs similar to the above?

 

Thanks in advance.