[ 
http://issues.apache.org/jira/browse/XERCESC-1401?page=comments#action_62340 ]
     
Sergiy Michka commented on XERCESC-1401:
----------------------------------------

I found what cause the undocumented exception.

To reproduce this in CreateDOMDocument xerces-c Sample project:

File: CreateDOMDocument.cpp, main
after this lines:

DOMText*    catDataVal = doc->createTextNode(X("XML Parsing Tools"));
catElem->appendChild(catDataVal);

put this code:

catDataVal = 0;
try
{
catElem->appendChild(catDataVal);
}
catch (DOMException& rExc)
{
 // #include <cassert>
 //assert(&rExc); // normal documented exception: not catched
}
catch (...)
{
//assert(false); // not documented: catched 
//access violation in the xercec binary, if the exception isnt handled
}

So the error was, that DOMNode::appendChild(DOMNode* pChild) throws an 
exception, if pChild is null.

Sergiy




> Not documented xerces-c exception: DOMNode::appendChild
> -------------------------------------------------------
>
>          Key: XERCESC-1401
>          URL: http://issues.apache.org/jira/browse/XERCESC-1401
>      Project: Xerces-C++
>         Type: Bug
>   Components: Documentation
>     Versions: 2.6.0
>  Environment: Win NT, MSVC 6.0
>     Reporter: Sergiy Michka

>
> I found that, DOMNode::appendChild throws unspecified xerces exception.
> The documented one 
> (http://xml.apache.org/xerces-c/apiDocs/classDOMNode.html#z113_15) is only 
> DOMException.
> My code looks like this:
> try
> {
> // ...
> DOMElement* child1 = pDoc->createElement(("child1"));
> rootElem->appendChild(child1);
> DOMText* child1_val = pDoc->createTextNode(("child1_val")));
> DOMText* child1_val2 = 0;
> child1_val2 = reinterpret_cast<DOMText*> (child1->appendChild(child1_val));
> // undocumented xerces exception
> }
> catch (DOMException& rExc)
> {
> throw MyException(rExc.getMessage());
> }
> catch (...) // not documented: what kind of Exception will be thrown?
> {
>  throw MyException(_T("Can not append TextNode"));
> }
> So whats wrong?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to