## 29.2 Parsing XML Documents (cont.)

- Text node stored in `DOMText`
- If no mixed content, should be only child
- Use `getFirstChild` to retrieve
- Use `getData` to read the text

> `DOMNode* price_element = . . .;
> DOMText* price_data = dynamic_cast<DOMText*>(
> price_element->getFirstChild());
> string price_string = XMLCh_to_string(price_data->getData());
> // For example, "24.95"
> double price = string_to_double(price_string);
> // For example, 24.95`

prev |top |next