void DOMAttrImpl::setValue(const XMLCh *val) { if (fNode.isReadOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); } // If this attribute was of type ID and in the map, take it out, // then put it back in with the new name. For now, we don't worry // about what happens if the new name conflicts // DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument(); if (fNode.isIdAttr()) doc->getNodeIDMap()->remove(this); DOMNode *kid; while ((kid = fParent.fFirstChild) != 0) // Remove existing kids { DOMNode* node = removeChild(kid); if (node) node->release(); } if (val != 0) // Create and add the new one appendChild(doc->createTextNode(val)); fNode.isSpecified(true); fParent.changed(); if (fNode.isIdAttr()) doc->getNodeIDMap()->add(this); }
DOMText *DOMTextImpl::splitText(XMLSize_t offset) { if (fNode.isReadOnly()) { throw DOMException( DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); } XMLSize_t len = fCharacterData.fDataBuf->getLen(); if (offset > len) throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager); DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument(); DOMText *newText = doc->createTextNode( this->substringData(offset, len - offset)); DOMNode *parent = getParentNode(); if (parent != 0) parent->insertBefore(newText, getNextSibling()); fCharacterData.fDataBuf->chop(offset); if (doc != 0) { Ranges* ranges = doc->getRanges(); if (ranges != 0) { XMLSize_t sz = ranges->size(); if (sz != 0) { for (XMLSize_t i =0; i<sz; i++) { ranges->elementAt(i)->updateSplitInfo( this, newText, offset); } } } } return newText; }