diff options
author | Michael Stahl <mst@openoffice.org> | 2011-01-19 20:27:27 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-01-19 20:27:27 +0100 |
commit | a877dd2c109e8e76923376b18daca101edb4a5e2 (patch) | |
tree | 34fb95f3be9088a3c0703d4eff1c21a0e29879ab /unoxml | |
parent | 07a097e2815b38011ac05e0c0607149a28f71c8f (diff) |
xmlfix3: unoxml: some cleanup in CNode...
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/document.cxx | 4 | ||||
-rw-r--r-- | unoxml/source/dom/element.cxx | 242 | ||||
-rw-r--r-- | unoxml/source/dom/node.cxx | 258 | ||||
-rw-r--r-- | unoxml/source/dom/node.hxx | 2 |
4 files changed, 254 insertions, 252 deletions
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index bac3bc8f9249..48294e822f31 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -994,7 +994,7 @@ namespace DOM reinterpret_cast<const xmlChar*>(prefix.getStr())); } // eliminate duplicate namespace declarations - _nscleanup(pRoot->children, pRoot); + nscleanup(pRoot->children, pRoot); } saxify(i_xHandler); } @@ -1023,7 +1023,7 @@ namespace DOM reinterpret_cast<const xmlChar*>(prefix.getStr())); } // eliminate duplicate namespace declarations - _nscleanup(pRoot->children, pRoot); + nscleanup(pRoot->children, pRoot); } Context aContext(i_xHandler, diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index eb1d27010c26..53b51f8ff68d 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -488,67 +488,79 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); - Reference< XAttr > aAttr; - if (m_aNodePtr != NULL) + if (0 == m_aNodePtr) { + throw RuntimeException(); + } + + // get the implementation + CNode *const pCNode = CNode::GetImplementation(newAttr); + if (!pCNode) { throw RuntimeException(); } + xmlAttrPtr const pAttr = + reinterpret_cast<xmlAttrPtr>(pCNode->GetNodePtr()); + if (!pAttr) { throw RuntimeException(); } + + // check whether the attribute is not in use by another element + xmlNsPtr pNs = NULL; + if (pAttr->parent != NULL) { - // get the implementation - CNode *const pCNode = CNode::GetImplementation(newAttr); - if (!pCNode) { throw RuntimeException(); } - xmlAttrPtr const pAttr = - reinterpret_cast<xmlAttrPtr>(pCNode->GetNodePtr()); - if (!pAttr) { throw RuntimeException(); } - - // check whether the attribute is not in use by another element - xmlNsPtr pNs = NULL; - if (pAttr->parent != NULL) - if(strcmp((char*)pAttr->parent->name, "__private") == 0 - && pNs && pAttr->ns != NULL) + if (strcmp((char*)pAttr->parent->name, "__private") == 0 + && pNs && pAttr->ns != NULL) + { + pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, + pAttr->ns->prefix); + if (pNs == NULL || + strcmp((char*)pNs->href, (char*)pAttr->ns->href) != 0) { - pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, pAttr->ns->prefix); - if (pNs == NULL || strcmp((char*)pNs->href, (char*)pAttr->ns->href) !=0 ) - pNs = xmlNewNs(m_aNodePtr, pAttr->ns->href, pAttr->ns->href); - else + pNs = xmlNewNs(m_aNodePtr, pAttr->ns->href, + pAttr->ns->href); + } else { throw RuntimeException(); + } } + } - xmlAttrPtr res = NULL; - - if (bNS) - res = xmlNewNsProp(m_aNodePtr, pNs, pAttr->name, pAttr->children->content); - else - res = xmlNewProp(m_aNodePtr, pAttr->name, pAttr->children->content); - - // free carrier node ... - if(pAttr->parent != NULL && strcmp((char*)pAttr->parent->name, "__private")== 0) - xmlFreeNode(pAttr->parent); + xmlAttrPtr res = NULL; - // get the new attr node - aAttr = Reference< XAttr >( - static_cast< XNode* >(GetOwnerDocument().GetCNode( - reinterpret_cast<xmlNodePtr>(res)).get()), - UNO_QUERY_THROW); + if (bNS) { + res = xmlNewNsProp(m_aNodePtr, + pNs, pAttr->name, pAttr->children->content); + } else { + res = xmlNewProp(m_aNodePtr, pAttr->name, pAttr->children->content); } - if (aAttr.is()) + // free carrier node ... + if (pAttr->parent != NULL && + strcmp((char*)pAttr->parent->name, "__private") == 0) { - // attribute adition event - // dispatch DOMAttrModified event - Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); - Reference< XMutationEvent > event(docevent->createEvent( - OUString::createFromAscii("DOMAttrModified")), UNO_QUERY); - event->initMutationEvent(OUString::createFromAscii("DOMAttrModified"), - sal_True, sal_False, Reference< XNode >(aAttr, UNO_QUERY), - OUString(), aAttr->getValue(), aAttr->getName(), AttrChangeType_ADDITION); + xmlFreeNode(pAttr->parent); + } - guard.clear(); // release mutex before calling event handlers + // get the new attr node + Reference< XAttr > const xAttr( + static_cast< XNode* >(GetOwnerDocument().GetCNode( + reinterpret_cast<xmlNodePtr>(res)).get()), + UNO_QUERY_THROW); - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); - dispatchSubtreeModified(); - } - return aAttr; + // attribute adition event + // dispatch DOMAttrModified event + Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); + Reference< XMutationEvent > event(docevent->createEvent( + OUString::createFromAscii("DOMAttrModified")), UNO_QUERY); + event->initMutationEvent(OUString::createFromAscii("DOMAttrModified"), + sal_True, sal_False, Reference< XNode >(xAttr, UNO_QUERY), + OUString(), xAttr->getValue(), xAttr->getName(), + AttrChangeType_ADDITION); + + guard.clear(); // release mutex before calling event handlers + + dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchSubtreeModified(); + + return xAttr; } - Reference< XAttr > CElement::setAttributeNode(const Reference< XAttr >& newAttr) + Reference< XAttr > + CElement::setAttributeNode(const Reference< XAttr >& newAttr) throw (RuntimeException, DOMException) { return setAttributeNode_Impl_Lock(newAttr, false); @@ -557,7 +569,8 @@ namespace DOM /** Adds a new attribute. */ - Reference< XAttr > CElement::setAttributeNodeNS(const Reference< XAttr >& newAttr) + Reference< XAttr > + CElement::setAttributeNodeNS(const Reference< XAttr >& newAttr) throw (RuntimeException, DOMException) { return setAttributeNode_Impl_Lock(newAttr, true); @@ -576,35 +589,34 @@ namespace DOM xmlChar *xName = (xmlChar*)o1.getStr(); OString o2 = OUStringToOString(value, RTL_TEXTENCODING_UTF8); xmlChar *xValue = (xmlChar*)o2.getStr(); - if (m_aNodePtr != NULL) - { - OUString oldValue; - AttrChangeType aChangeType = AttrChangeType_MODIFICATION; - xmlChar *xOld = xmlGetProp(m_aNodePtr, xName); - if (xOld == NULL) - { - aChangeType = AttrChangeType_ADDITION; - xmlNewProp(m_aNodePtr, xName, xValue); - } - else - { - oldValue = OUString((char*)xOld, strlen((char*)xOld), RTL_TEXTENCODING_UTF8); - xmlSetProp(m_aNodePtr, xName, xValue); - } - // dispatch DOMAttrModified event - - Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); - Reference< XMutationEvent > event(docevent->createEvent( - OUString::createFromAscii("DOMAttrModified")), UNO_QUERY); - event->initMutationEvent(OUString::createFromAscii("DOMAttrModified"), - sal_True, sal_False, Reference< XNode >(getAttributeNode(name), UNO_QUERY), - oldValue, value, name, aChangeType); - - guard.clear(); // release mutex before calling event handlers - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); - dispatchSubtreeModified(); + if (0 == m_aNodePtr) { + throw RuntimeException(); + } + OUString oldValue; + AttrChangeType aChangeType = AttrChangeType_MODIFICATION; + xmlChar const*const pOld = xmlGetProp(m_aNodePtr, xName); + if (pOld == NULL) { + aChangeType = AttrChangeType_ADDITION; + xmlNewProp(m_aNodePtr, xName, xValue); + } else { + oldValue = OUString((char*)pOld, strlen((char*)pOld), + RTL_TEXTENCODING_UTF8); + xmlSetProp(m_aNodePtr, xName, xValue); } + + // dispatch DOMAttrModified event + Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); + Reference< XMutationEvent > event(docevent->createEvent( + OUString::createFromAscii("DOMAttrModified")), UNO_QUERY); + event->initMutationEvent(OUString::createFromAscii("DOMAttrModified"), + sal_True, sal_False, + Reference< XNode >(getAttributeNode(name), UNO_QUERY), + oldValue, value, name, aChangeType); + + guard.clear(); // release mutex before calling event handlers + dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchSubtreeModified(); } /** @@ -643,49 +655,49 @@ namespace DOM o5 = OUStringToOString(value, RTL_TEXTENCODING_UTF8); xmlChar *xURI= (xmlChar*)o4.getStr(); xmlChar *xValue = (xmlChar*)o5.getStr(); - if (m_aNodePtr != NULL) - { - //find the right namespace - xmlNsPtr pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, xPrefix); - // if no namespace found, create a new one - if (pNs == NULL) - pNs = xmlNewNs(m_aNodePtr, xURI, xPrefix); - if (strcmp((char*)pNs->href, (char*)xURI) == 0) - { - // found namespace matches + if (0 == m_aNodePtr) { + throw RuntimeException(); + } - OUString oldValue; - AttrChangeType aChangeType = AttrChangeType_MODIFICATION; - xmlChar *xOld = xmlGetNsProp(m_aNodePtr, xLName, pNs->href); - if (xOld == NULL) - { - aChangeType = AttrChangeType_ADDITION; - xmlNewNsProp(m_aNodePtr, pNs, xLName, xValue); - } - else - { - oldValue = OUString((char *)xOld, strlen((char *)xOld), RTL_TEXTENCODING_UTF8); - xmlSetNsProp(m_aNodePtr, pNs, xLName, xValue); - } - // dispatch DOMAttrModified event - Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); - Reference< XMutationEvent > event(docevent->createEvent( - OUString::createFromAscii("DOMAttrModified")), UNO_QUERY); - event->initMutationEvent(OUString::createFromAscii("DOMAttrModified"), sal_True, sal_False, - Reference< XNode >(getAttributeNodeNS(namespaceURI, OUString((char*)xLName, strlen((char*)xLName), RTL_TEXTENCODING_UTF8)), UNO_QUERY), - oldValue, value, qualifiedName, aChangeType); - - guard.clear(); // release mutex before calling event handlers - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); - dispatchSubtreeModified(); - - } else { - // ambigious ns prefix - throw RuntimeException(); - } + //find the right namespace + xmlNsPtr pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, xPrefix); + // if no namespace found, create a new one + if (pNs == NULL) { + pNs = xmlNewNs(m_aNodePtr, xURI, xPrefix); + } + + if (strcmp((char*)pNs->href, (char*)xURI) != 0) { + // ambiguous ns prefix + throw RuntimeException(); + } + // found namespace matches + + OUString oldValue; + AttrChangeType aChangeType = AttrChangeType_MODIFICATION; + xmlChar const*const pOld = xmlGetNsProp(m_aNodePtr, xLName, pNs->href); + if (pOld == NULL) { + aChangeType = AttrChangeType_ADDITION; + xmlNewNsProp(m_aNodePtr, pNs, xLName, xValue); + } else { + oldValue = OUString((char *)pOld, strlen((char *)pOld), + RTL_TEXTENCODING_UTF8); + xmlSetNsProp(m_aNodePtr, pNs, xLName, xValue); } + // dispatch DOMAttrModified event + Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); + Reference< XMutationEvent > event(docevent->createEvent( + OUString::createFromAscii("DOMAttrModified")), UNO_QUERY); + event->initMutationEvent( + OUString::createFromAscii("DOMAttrModified"), + sal_True, sal_False, + Reference< XNode >(getAttributeNodeNS(namespaceURI, OUString((char*)xLName, strlen((char*)xLName), RTL_TEXTENCODING_UTF8)), UNO_QUERY), + oldValue, value, qualifiedName, aChangeType); + + guard.clear(); // release mutex before calling event handlers + dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchSubtreeModified(); } Reference< XNamedNodeMap > SAL_CALL diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index 55978a507a67..a25190a65117 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -198,7 +198,8 @@ namespace DOM } - static void _nsexchange(const xmlNodePtr aNode, xmlNsPtr oldNs, xmlNsPtr newNs) + static void lcl_nsexchange( + xmlNodePtr const aNode, xmlNsPtr const oldNs, xmlNsPtr const newNs) { // recursively exchange any references to oldNs with references to newNs xmlNodePtr cur = aNode; @@ -215,13 +216,13 @@ namespace DOM curAttr->ns = newNs; curAttr = curAttr->next; } - _nsexchange(cur->children, oldNs, newNs); + lcl_nsexchange(cur->children, oldNs, newNs); } cur = cur->next; } } - /*static*/ void _nscleanup(const xmlNodePtr aNode, const xmlNodePtr aParent) + /*static*/ void nscleanup(const xmlNodePtr aNode, const xmlNodePtr aParent) { xmlNodePtr cur = aNode; @@ -243,7 +244,7 @@ namespace DOM while (cur != NULL) { - _nscleanup(cur->children, cur); + nscleanup(cur->children, cur); if (cur->ns != NULL) { xmlNsPtr ns = xmlSearchNs(cur->doc, aParent, cur->ns->prefix); @@ -258,7 +259,7 @@ namespace DOM { // reconnect ns pointers in sub-tree to newly found ns before // removing redundant nsdecl to prevent dangling pointers. - _nsexchange(cur, curDef, ns); + lcl_nsexchange(cur, curDef, ns); *refp = curDef->next; xmlFreeNs(curDef); curDef = *refp; @@ -294,112 +295,119 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - ::rtl::Reference<CNode> pNode; - if (m_aNodePtr != NULL) { - CNode *const pNewChild(CNode::GetImplementation(xNewChild)); - if (!pNewChild) { throw RuntimeException(); } - xmlNodePtr const cur = pNewChild->GetNodePtr(); - if (!cur) { throw RuntimeException(); } + if (0 == m_aNodePtr) { return 0; } - // error checks: - // from other document - if (cur->doc != m_aNodePtr->doc) { - DOMException e; - e.Code = DOMExceptionType_WRONG_DOCUMENT_ERR; - throw e; - } - // same node - if (cur == m_aNodePtr) { - DOMException e; - e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; - throw e; - } - // already has parant and is not attribute - if (cur->parent != NULL && cur->type != XML_ATTRIBUTE_NODE) { - DOMException e; - e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; - throw e; - } + CNode *const pNewChild(CNode::GetImplementation(xNewChild)); + if (!pNewChild) { throw RuntimeException(); } + xmlNodePtr const cur = pNewChild->GetNodePtr(); + if (!cur) { throw RuntimeException(); } - // check whether this is an attribute node so we remove it's - // carrier node if it has one - xmlNodePtr res = NULL; - if (cur->type == XML_ATTRIBUTE_NODE) - { - if (cur->parent != NULL) - { - if (m_aNodePtr->type != XML_ELEMENT_NODE || - strcmp((char*)cur->parent->name, "__private") != 0) - { - DOMException e; - e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; - throw e; - } + // error checks: + // from other document + if (cur->doc != m_aNodePtr->doc) { + DOMException e; + e.Code = DOMExceptionType_WRONG_DOCUMENT_ERR; + throw e; + } + // same node + if (cur == m_aNodePtr) { + DOMException e; + e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; + throw e; + } + // already has parent and is not attribute + if (cur->parent != NULL && cur->type != XML_ATTRIBUTE_NODE) { + DOMException e; + e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; + throw e; + } - xmlNsPtr pAttrNs = cur->ns; - xmlNsPtr pParentNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, pAttrNs->prefix); - if (pParentNs == NULL || strcmp((char*)pParentNs->href, (char*)pAttrNs->href) != 0) - pParentNs = xmlNewNs(m_aNodePtr, pAttrNs->href, pAttrNs->prefix); + // check whether this is an attribute node so we remove it's + // carrier node if it has one + xmlNodePtr res = NULL; + if (cur->type == XML_ATTRIBUTE_NODE) + { + if (cur->parent != NULL) { + if (m_aNodePtr->type != XML_ELEMENT_NODE || + strcmp((char*)cur->parent->name, "__private") != 0) + { + DOMException e; + e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; + throw e; + } - if (cur->children != NULL) - res = (xmlNodePtr)xmlNewNsProp(m_aNodePtr, pParentNs, cur->name, cur->children->content); - else - res = (xmlNodePtr)xmlNewProp(m_aNodePtr, cur->name, (xmlChar*) ""); + xmlNsPtr pAttrNs = cur->ns; + xmlNsPtr pParentNs = + xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, pAttrNs->prefix); + if (pParentNs == NULL || + strcmp((char*)pParentNs->href, (char*)pAttrNs->href) != 0) + { + pParentNs = + xmlNewNs(m_aNodePtr, pAttrNs->href, pAttrNs->prefix); + } - xmlFreeNode(cur->parent); - cur->parent = NULL; + if (cur->children != NULL) { + res = (xmlNodePtr)xmlNewNsProp(m_aNodePtr, + pParentNs, cur->name, cur->children->content); + } else { + res = (xmlNodePtr)xmlNewProp(m_aNodePtr, + cur->name, (xmlChar*) ""); } - else - { - if (cur->children != NULL) - res = (xmlNodePtr)xmlNewProp(m_aNodePtr, cur->name, cur->children->content); - else - res = (xmlNodePtr)xmlNewProp(m_aNodePtr, cur->name, (xmlChar*) ""); + + xmlFreeNode(cur->parent); + cur->parent = NULL; + } else { + if (cur->children != NULL) { + res = (xmlNodePtr)xmlNewProp(m_aNodePtr, + cur->name, cur->children->content); + } else { + res = (xmlNodePtr)xmlNewProp(m_aNodePtr, + cur->name, (xmlChar*) ""); } } - else - { - res = xmlAddChild(m_aNodePtr, cur); - } + } + else + { + res = xmlAddChild(m_aNodePtr, cur); + } - // libxml can do optimizations, when appending nodes. - // if res != cur, something was optimized and the newchild-wrapper - // should be updated - if (res && (cur != res)) { - pNewChild->invalidate(); // cur has been freed - } + // libxml can do optimizations, when appending nodes. + // if res != cur, something was optimized and the newchild-wrapper + // should be updated + if (res && (cur != res)) { + pNewChild->invalidate(); // cur has been freed + } - // use custom ns cleanup instaead of - // xmlReconciliateNs(m_aNodePtr->doc, m_aNodePtr); + // use custom ns cleanup instead of + // xmlReconciliateNs(m_aNodePtr->doc, m_aNodePtr); // because that will not remove unneeded ns decls - _nscleanup(res, m_aNodePtr); + nscleanup(res, m_aNodePtr); - pNode = GetOwnerDocument().GetCNode(res); - } + ::rtl::Reference<CNode> const pNode = GetOwnerDocument().GetCNode(res); + + if (!pNode.is()) { return 0; } //XXX check for errors // dispatch DOMNodeInserted event, target is the new node // this node is the related node // does bubble - if (pNode.is()) - { - pNode->m_bUnlinked = false; // will be deleted by xmlFreeDoc - Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); - Reference< XMutationEvent > event(docevent->createEvent( - OUString::createFromAscii("DOMNodeInserted")), UNO_QUERY); - event->initMutationEvent(OUString::createFromAscii("DOMNodeInserted") - , sal_True, sal_False, - this, - OUString(), OUString(), OUString(), (AttrChangeType)0 ); - - // the following dispatch functions use only UNO interfaces - // and call event listeners, so release mutex to prevent deadlocks. - guard.clear(); - - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); - // dispatch subtree modified for this node - dispatchSubtreeModified(); - } + pNode->m_bUnlinked = false; // will be deleted by xmlFreeDoc + Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); + Reference< XMutationEvent > event(docevent->createEvent( + OUString::createFromAscii("DOMNodeInserted")), UNO_QUERY); + event->initMutationEvent(OUString::createFromAscii("DOMNodeInserted") + , sal_True, sal_False, + this, + OUString(), OUString(), OUString(), (AttrChangeType)0 ); + + // the following dispatch functions use only UNO interfaces + // and call event listeners, so release mutex to prevent deadlocks. + guard.clear(); + + dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + // dispatch subtree modified for this node + dispatchSubtreeModified(); + return pNode.get(); } @@ -429,16 +437,8 @@ namespace DOM Reference< XNamedNodeMap > SAL_CALL CNode::getAttributes() throw (RuntimeException) { - - // return empty reference - // only element node may override this impl + // return empty reference; only element node may override this impl return Reference< XNamedNodeMap>(); - - // get all children that are attributes - /* --> CElement - Reference< NamedNodeMap > aNodeMap(new AttributeNamedNodeMap(m_aNodePtr), UNO_QUERY); - return aNodeMap; - */ } /** @@ -494,17 +494,8 @@ namespace DOM OUString SAL_CALL CNode::getLocalName() throw (RuntimeException) { - OUString aName; - /* - --> Element / Attribute - if(m_aNodePtr != NULL && (m_aNodeType == NodeType::ATTRIBUTE_NODE - || m_aNodeType == NodeType::ELEMENT_NODE)) - { - aName = OUString(m_aNodePtr->name, RTL_TEXTENCODING_UTF8); - } - //XXX error checking - */ - return aName; + // see CElement/CAttr + return ::rtl::OUString(); } @@ -709,7 +700,7 @@ namespace DOM xmlNodePtr const pRefChild(pRefNode->GetNodePtr()); xmlNodePtr cur = m_aNodePtr->children; - //search cild before which to insert + //search child before which to insert while (cur != NULL) { if (cur == pRefChild) { @@ -795,24 +786,23 @@ namespace DOM * Cancelable: No * Context Info: relatedNode holds the parent node */ - if (oldChild.is()) - { - Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); - Reference< XMutationEvent > event(docevent->createEvent( - OUString::createFromAscii("DOMNodeRemoved")), UNO_QUERY); - event->initMutationEvent(OUString::createFromAscii("DOMNodeRemoved"), sal_True, - sal_False, - this, - OUString(), OUString(), OUString(), (AttrChangeType)0 ); - - // the following dispatch functions use only UNO interfaces - // and call event listeners, so release mutex to prevent deadlocks. - guard.clear(); - - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); - // subtree modofied for this node - dispatchSubtreeModified(); - } + Reference< XDocumentEvent > docevent(getOwnerDocument(), UNO_QUERY); + Reference< XMutationEvent > event(docevent->createEvent( + OUString::createFromAscii("DOMNodeRemoved")), UNO_QUERY); + event->initMutationEvent(OUString::createFromAscii("DOMNodeRemoved"), + sal_True, + sal_False, + this, + OUString(), OUString(), OUString(), (AttrChangeType)0 ); + + // the following dispatch functions use only UNO interfaces + // and call event listeners, so release mutex to prevent deadlocks. + guard.clear(); + + dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + // subtree modofied for this node + dispatchSubtreeModified(); + return xReturn; } @@ -920,7 +910,7 @@ namespace DOM /** The value of this node, depending on its type; see the table above. */ - void SAL_CALL CNode::setNodeValue(const OUString& /*nodeValue*/) + void SAL_CALL CNode::setNodeValue(const OUString& /*nodeValue*/) throw (RuntimeException, DOMException) { // use specific node implememntation diff --git a/unoxml/source/dom/node.hxx b/unoxml/source/dom/node.hxx index 37051d4f2f82..cf814b00f9f0 100644 --- a/unoxml/source/dom/node.hxx +++ b/unoxml/source/dom/node.hxx @@ -342,7 +342,7 @@ namespace DOM }; /// eliminate redundant namespace declarations - void _nscleanup(const xmlNodePtr aNode, const xmlNodePtr aParent); + void nscleanup(const xmlNodePtr aNode, const xmlNodePtr aParent); } #endif |