## 29.3 Creating XML Documents (cont.)

- Use `createElement` and `createTextNode` methods of `DOMDocument`
- Inputs are an `XMLCh` array
- So, wrap above methods, to take `string`s
- Wrapper for `DOMDocument::createElement`:

  >     DOMElement* create_element(DOMDocument* doc, string name)
  >     {
  >        XMLCh* xname = new XMLCh[name.length() + 1];
  >        XMLString::transcode(name.c_str(), xname, name.length());
  >        DOMElement* r = doc->createElement(xname);
  >        delete xname;
  >        return r;
  >     }

prev |top |next