## 29.2 Parsing XML Documents (cont.)

- Use `DOMNamedNodeMap` to iterate over attributes
- Returned by `getAttributes`:

  > `DOMNamedNodeMap* attributes = price_element->getAttributes();`

- Use `item` method to get a particular attribute:

  > `int i = . . .;
  > // # between 0 and attributes->getLength() - 1
  > DOMNode* attribute_node = attributes->item(i);
  > XMLCh* attribute_name = attribute_node->getNodeName();
  > // For example, "currency"
  > XMLCh* attribute_value = attribute_node.getNodeValue();
  > // For example, "USD"`

prev |top |next