Hi Alberto, the code is in a try block and I catch the exceptions. So far as I can see XMLChar1_0::isValidName() doesn't throw an exception and the crash happens there.
When avoiding to call createElement() with name empty, would I have the empty-element tag like before (according to the code)? Regards Sandro -----Original Message----- From: Alberto Massari [mailto:[EMAIL PROTECTED] Sent: Dienstag, 27. Mai 2008 16:05 To: [email protected] Subject: Re: Crash in DOM_Document::createElement() when name an empty string Hi Sandro, elements must have a name, so you should not be allowed to create one with an empty string (and probably the application crashes because it doesn't catch the exception being thrown). Add a check and avoid the call to createElement when "name" is empty Alberto Piras Sandro (KSDB 121) wrote: > Hi all, > I'm trying to "migrate" some old C++ Code from Xerces 1.7.0 to Xerces > 2.5.0 using the includes from the directory /dom/deprecated instead of > using the new classes. Now the application crashes. > > Here the code: > > DOM_Document domDoc; > DOM_Node parent; > > ... > > // parent created, the path is "CMF/Trade/Product/Identifiers" > > DOM_Element element = domDoc.createElement(name); // name may be empty > -> name = "" > DOM_Text text = domDoc.createTextNode(value); // value may be empty -> > value = "" > element.appendChild(text); > parent.appendChild(element); > > > When the variables name and value were an empty string, on xerces > 1.7.0 we got an empty-element tag: > > ...<Product><Identifiers/></Product>.. > > but on xerces 2.5.0 the method DOM_Document::createElement() crashes > because of XMLChar1_0::isValidName() > > DOM_Document::createElement() -> DocumentImpl::createElement() -> > XMLChar1_0::isValidName() > > I couldn't find anything about this in the migration specs or in the > faq. > > May somebody tell me if it is not allowed anymore to call > createElement() with an empty string and if not allowed, how to > generate the empty-element tag? > > Regards > S. Piras > >
