"Lars Preben S. Arnesen" <[EMAIL PROTECTED]> writes:
> # My modification
> my $foo = $doc->createElement ("bar");
> $doc->appendChild ($foo);
> # End of my modification
The problem here is two-fold:
1) appending a child element directly to a document that already has a
root element is illegal since a document can only (legally) have a
single top-level element, so appendChild() throws an exception.
2) appendChild is throwing a DOMException but Xerces.pm is not set up
to catch that exception, so you see 'Aborted'. Exception handling
is the weakest supported feature of Xerces at the moment. I
currently have to hand-code each function that needs handling (SWIG
has it's limitations).
what you want to do is something like:
# My modification
my $root = $doc->getDocumentElement();
my $foo = $doc->createElement ("bar");
$root->appendChild ($foo);
# End of my modification
That way you will be inserting <bar/> into the existing top-level
element.
Thanks for the error report, I'll be happy to fix all the DOM
functions so that they catch exceptions. Look for a new release next
week some time.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]