diff options
author | Michael Stahl <mst@openoffice.org> | 2011-02-10 16:45:03 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-02-10 16:45:03 +0100 |
commit | 141773454451569127d388a1f3fd1fdc65f5554a (patch) | |
tree | 517a18f27d1d630a865aeaebad9c9a4e0846a182 /unoxml/source/dom/node.cxx | |
parent | 83588ab3b791910e6a55cc70a45cbb47452011b2 (diff) |
xmlfix3: unoxml: fix various bugs uncovered by complex test:
CAttr::getSpecified() should return true.
CAttr::getValue() and CElement::setAttributeNode() could crash if no children.
CAttributesMap::*NS() methods ignored namespaceURI parameter.
CDATASection::getNodeValue() forwarded to wrong base class.
CDocument needs to override cloneNode().
CDocument::importNode(), CDocumentBuilder::parseURI() deref null argument.
CElement::getAttributes() should return an empty map.
CElementList could be created for null element.
CNode::insertBefore() did not set parent/children pointers.
CNode::setPrefix() should only work on element/attribute.
CXPathAPI had inverted check for null argument (xmlfix3 regression).
Diffstat (limited to 'unoxml/source/dom/node.cxx')
-rw-r--r-- | unoxml/source/dom/node.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index 4786606c16c0..f134e79230f6 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -724,9 +724,16 @@ namespace DOM pNewChild->next = cur; pNewChild->prev = cur->prev; cur->prev = pNewChild; - if( pNewChild->prev != NULL) + if (pNewChild->prev != NULL) { pNewChild->prev->next = pNewChild; + } + pNewChild->parent = cur->parent; + if (pNewChild->parent->children == cur) { + pNewChild->parent->children = pNewChild; + } + // do not update parent->last here! pNewNode->m_bUnlinked = false; // will be deleted by xmlFreeDoc + break; } cur = cur->next; } @@ -977,6 +984,14 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); + if ((0 == m_aNodePtr) || + ((m_aNodePtr->type != XML_ELEMENT_NODE) && + (m_aNodePtr->type != XML_ATTRIBUTE_NODE))) + { + DOMException e; + e.Code = DOMExceptionType_NO_MODIFICATION_ALLOWED_ERR; + throw e; + } OString o1 = OUStringToOString(prefix, RTL_TEXTENCODING_UTF8); xmlChar *pBuf = (xmlChar*)o1.getStr(); if (m_aNodePtr != NULL && m_aNodePtr->ns != NULL) |