[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gmetadom example
From: |
Jeff Bailey |
Subject: |
gmetadom example |
Date: |
Fri, 2 Aug 2002 16:34:16 -0700 |
User-agent: |
Mutt/1.3.28i |
For those who care, here's my test DOM app that I finally have all
working. The trick with gmetadom is that a "NULL" imput is not a
Domstring = "" as expected, but an actual 0. I'll file a bug, since
this cost me a good chunk of time. I should be hacking a bunch on it
this weekend.
#include <iostream>
#include <string>
#include <gmetadom/gdome_cpp_smart/GdomeSmartDOM.hh>
#include <gmetadom/gdome_cpp_smart/GdomeSmartDOMDOMStringAux.hh>
int
main ()
{
using namespace GdomeSmartDOM;
DOMImplementation dom;
const DOMString qualifiedName = "book";
const DOMString publicId = "-//OASIS//DTD DocBook XML V4.2//EN";
const DOMString systemId =
"/usr/share/sgml/docbook/dtd/xml/4.2.cr2/docbookx.dtd";
const DocumentType doctype = dom.createDocumentType(qualifiedName, publicId,
systemId);
Document document = dom.createDocument(0, qualifiedName, doctype);
Element root = document.get_documentElement();
DOMString myString = "foo";
Element foo = document.createElement(myString);
myString = "foo2";
Text text = document.createTextNode(myString);
foo.appendChild(text);
root.appendChild(foo);
DOMString gack;
dom.saveDocumentToMemory(document, gack);
std::cout << gack << std::endl;
}
And the sample output:
address@hidden:~/test$ time ./test
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"/usr/share/sgml/docbook/dtd/xml/4.2.cr2/docbookx.dtd">
<book><foo>foo2</foo></book>
real 0m0.078s
user 0m0.040s
sys 0m0.000s
I'm really quite pelased with the speed of the implementation,
considering that it's a C++ DOM wrapper around a C DOM wrapper around
libxml2.
Tks,
Jeff Bailey
--
I reincarnated for this?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gmetadom example,
Jeff Bailey <=