void test4() { Arabica::DOM::Element<string_type, string_adaptor> root; { Arabica::DOM::Document<string_type, string_adaptor> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); root = d.createElement(SA::construct_from_utf8("root")); d.appendChild(root); root.appendChild(d.createElement(SA::construct_from_utf8("child1"))); root.appendChild(d.createElement(SA::construct_from_utf8("child2"))); } Arabica::DOM::Node<string_type, string_adaptor> c1 = root.getFirstChild(); Arabica::DOM::Node<string_type, string_adaptor> c2 = root.getLastChild(); try { c1.purgeChild(c2); } catch(Arabica::DOM::DOMException& e) { assert(e.code() == Arabica::DOM::DOMException::NOT_FOUND_ERR); } // catch assert(c1 != 0); assert(c2 != 0); assert(c1.getNextSibling() == c2); assert(c2.getPreviousSibling() == c1); } // test4
void test3() { Arabica::DOM::Element<string_type, string_adaptor> root; { Arabica::DOM::Document<string_type, string_adaptor> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); root = d.createElement(SA::construct_from_utf8("root")); d.appendChild(root); root.appendChild(d.createElement(SA::construct_from_utf8("child1"))); root.appendChild(d.createElement(SA::construct_from_utf8("child2"))); } Arabica::DOM::Node<string_type, string_adaptor> c = root.getFirstChild(); assert(c.getNextSibling() == root.getLastChild()); root.purgeChild(c); assert(c == 0); assert(root.getLastChild() == root.getFirstChild()); } // test3
void test3() { Arabica::DOM::Document<string_type, string_adaptor> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::DocumentFragment<string_type, string_adaptor> frag = d.createDocumentFragment(); frag.appendChild(d.createElement(SA::construct_from_utf8("child"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child2"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child3"))); Arabica::DOM::Element<string_type, string_adaptor> elem = d.createElement(SA::construct_from_utf8("root")); elem.appendChild(frag); assert(elem.getChildNodes().getLength() == 3); assert(elem.getFirstChild().getNodeName() == SA::construct_from_utf8("child")); assert(elem.getLastChild().getNodeName() == SA::construct_from_utf8("child3")); assert(frag.getChildNodes().getLength() == 0); } // test3