コード例 #1
0
    void test2()
    {
      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")));

      assert(frag.getChildNodes().getLength() == 3);
    } // test2
コード例 #2
0
    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