The code that you have written to create a new document
looks correct.  This is the right way to do it, and is
essentially the same thing that the DOM parser does
when parsing a document from the XML source.

If you have rebuilt Xerces itself, does the DOMPrint sample
work?

If you are using the prebuilt library, does the prebuilt
DOMPrint work?  If you rebuild the sample, does it still work?

  -- Andy


Steve Kotsopoulos <[EMAIL PROTECTED]> asks

> I'm using Xerces-C version 1.0.1 15-Dec-99 under RedHat Linux 6.1
> with g++ (egcs-2.91.66).
>
> I'm trying to build documents by hand, not by reading an XML file.
> I haven't been able to find any examples of the correct way of doing this,
> but here's what I have right now:
>
> DOM_Document doc = DOM_Document::createDocument();
> DOM_Element del  = doc.createElement(DOMString("name"));
> DOM_Element tag1 = doc.createElement(DOMString("foo"));
> DOM_Text    val1 = doc.createTextNode(DOMString("bar"));
> doc.appendChild(del);
> del.appendChild(tag1);
> tag1.appendChild(val1);
>
> The idea is to build an XML document something like this:
>
> <name>
> <foo>bar</foo>
> </name>
>
> When I create a document with the above, and then pass it to code
> based on the DOMPrint parsing example, I'm seeing a segmentation fault
> in DOM_Node::getNodeName() of libxerces-c1_0.so
> when my parsing code starts with:
>
> char *nname = node.getNodeName().transcode();
> char *nvalue = node.getNodeValue().transcode();
>
> I suspect that I might not be building my document correctly,
> is this the case? If so, what is the correct way to do it?
>
> Thanks
>
> Steve
>

Reply via email to