当前位置: 首页>>代码示例>>C++>>正文


C++ DOMException函数代码示例

本文整理汇总了C++中DOMException函数的典型用法代码示例。如果您正苦于以下问题:C++ DOMException函数的具体用法?C++ DOMException怎么用?C++ DOMException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DOMException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: throw

void
Attr::setPrefix(String * prefix)
  throw(DOMException)
{
  if (isReadOnly())
    throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
  // +++FIXME more checks
  unicode::StringBuffer buf(prefix);
  buf += ":";
  buf += localName;
  name = buf.internString();
}
开发者ID:CaptEmulation,项目名称:svgl,代码行数:12,代码来源:Attr.cpp

示例2: DOMException

DOMNode *DOMAttrMapImpl::setNamedItem(DOMNode *arg)
{
    if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);

    DOMDocument *doc = fOwnerNode->getOwnerDocument();
    DOMNodeImpl *argImpl = castToNodeImpl(arg);
    if(argImpl->getOwnerDocument() != doc)
        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNamedNodeMapMemoryManager);
    if (this->readOnly())
        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
    if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode))
        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);

    argImpl->fOwnerNode = fOwnerNode;
    argImpl->isOwned(true);
    int i=findNamePoint(arg->getNodeName());
    DOMNode * previous=0;
    if(i>=0)
    {
        previous = fNodes->elementAt(i);
        fNodes->setElementAt(arg,i);
    }
    else
    {
        i=-1-i; // Insert point (may be end of list)
        if(0==fNodes)
        {
            fNodes=new (doc) DOMNodeVector(doc);
        }
        fNodes->insertElementAt(arg,i);
    }
    if (previous != 0) {
        castToNodeImpl(previous)->fOwnerNode = fOwnerNode->getOwnerDocument();
        castToNodeImpl(previous)->isOwned(false);
    }

    return previous;
}
开发者ID:js422,项目名称:PERL,代码行数:39,代码来源:DOMAttrMapImpl.cpp

示例3: throw

Node *
DocumentType::insertBefore(Node * newChild, Node * refChild)
  throw(DOMException)
{
  NodeType type = newChild->getNodeType();
  if ((type != Node::ELEMENT_NODE) &&
      (type != Node::COMMENT_NODE))
    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
  ParentNode::insertBefore(newChild, refChild);
  if (type == Node::ELEMENT_NODE)
    elements->setNamedItemNS(newChild);
  return newChild;
}
开发者ID:CaptEmulation,项目名称:svgl,代码行数:13,代码来源:DocumentType.cpp

示例4: MutationEvent

Event* Document::createEvent(const XMLString& eventType) const
{
	if (eventType == MutationEvent::DOMSubtreeModified          ||
	    eventType == MutationEvent::DOMNodeInserted             ||
		eventType == MutationEvent::DOMNodeRemoved              ||
		eventType == MutationEvent::DOMNodeRemovedFromDocument  ||
		eventType == MutationEvent::DOMNodeInsertedIntoDocument ||
		eventType == MutationEvent::DOMAttrModified             ||
		eventType == MutationEvent::DOMCharacterDataModified)
	{
		return new MutationEvent(const_cast<Document*>(this), eventType);
	}
	throw DOMException(DOMException::NOT_SUPPORTED_ERR);
}
开发者ID:beneon,项目名称:MITK,代码行数:14,代码来源:Document.cpp

示例5: DOMException

void CharacterData::deleteData(unsigned long offset, unsigned long count)
{
	if (offset >= _data.length())
		throw DOMException(DOMException::INDEX_SIZE_ERR);

	if (events())
	{
		XMLString oldData = _data;
		_data.replace(offset, count, EMPTY_STRING);
		dispatchCharacterDataModified(oldData, _data);
	}
	else
		_data.replace(offset, count, EMPTY_STRING);
}
开发者ID:Kampbell,项目名称:poco,代码行数:14,代码来源:CharacterData.cpp

示例6: DOMException

void DOMElementNSImpl::setName(const XMLCh *namespaceURI,
                               const XMLCh *qualifiedName)
{
    DOMDocumentImpl* ownerDoc = (DOMDocumentImpl *) fParent.fOwnerDocument;
    this->fName = ownerDoc->getPooledString(qualifiedName);

    int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
    if (index < 0)
        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);

    if (index == 0)
    {
        //qualifiedName contains no ':'
        //
        fPrefix = 0;
        fLocalName = fName;
    }
    else
    {	//0 < index < this->name.length()-1
        //
        fPrefix = ownerDoc->getPooledNString(qualifiedName, index);
        fLocalName = ownerDoc->getPooledString(fName+index+1);

        // Before we carry on, we should check if the prefix or localName are valid XMLName
        if (!ownerDoc->isXMLName(fPrefix) || !ownerDoc->isXMLName(fLocalName))
          throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
    }

    // DOM Level 3: namespace URI is never empty string.
    //
    const XMLCh * URI = DOMNodeImpl::mapPrefix (
      fPrefix,
      (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
      DOMNode::ELEMENT_NODE);

    fNamespaceURI = (URI == 0) ? 0 : ownerDoc->getPooledString(URI);
}
开发者ID:kanbang,项目名称:Colt,代码行数:37,代码来源:DOMElementNSImpl.cpp

示例7: DOMException

// Non standard extension for the range to work
DOMProcessingInstruction *DOMProcessingInstructionImpl::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();
    DOMProcessingInstruction *newText =
      doc->createProcessingInstruction(
        fTarget, 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;
}
开发者ID:JohnWilliam1988,项目名称:TCIDE,代码行数:37,代码来源:DOMProcessingInstructionImpl.cpp

示例8: DOMException

// removeNamedItemNS() - Remove the named item, and return it.
//                      The caller can release the
//                      returned item if it's not used
//                      we can't do it here because the caller would
//                      never see the returned node.
DOMNode *DOMNamedNodeMapImpl::removeNamedItemNS(const XMLCh *namespaceURI,
                                                 const XMLCh *localName)
{
    if (this->readOnly())
        throw DOMException(
        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);

    // the map is indexed using the full name of nodes; to search given a namespace and a local name
    // we have to do a linear search
    for (int index = 0; index < MAP_SIZE; index++) {
        if(fBuckets[index]==0)
            continue;

        int i = 0;
        int size = fBuckets[index]->size();
        for (i = 0; i < size; ++i) {
            DOMNode *n=fBuckets[index]->elementAt(i);
            const XMLCh * nNamespaceURI = n->getNamespaceURI();
            const XMLCh * nLocalName = n->getLocalName();
            if (!XMLString::equals(nNamespaceURI, namespaceURI))    //URI not match
                continue;
            else {
                if (XMLString::equals(localName, nLocalName)
                    ||
                    (nLocalName == 0 && XMLString::equals(localName, n->getNodeName()))) {
                    fBuckets[index]->removeElementAt(i);
                    castToNodeImpl(n)->fOwnerNode = fOwnerNode->getOwnerDocument();
                    castToNodeImpl(n)->isOwned(false);
                    return n;
                }
            }
        }
    }
    throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
    return 0;
}
开发者ID:brock7,项目名称:TianLong,代码行数:41,代码来源:DOMNamedNodeMapImpl.cpp

示例9: DOMException

 AttributeP Document::createAttributeNS(DOMString* nsUri, 
     DOMString* nsPrefix, 
     DOMString* localName,
     DOMString* value )
 {
   Element* ownerElement = NULL;
   
   if(_stateful) { 
     if(_currentElement) {
       ownerElement = _currentElement;
     }
     else {
       throw DOMException("createAttributeNS: found an attrNode without any owner element");
     }
   }
   return new Attribute( localName, value, nsUri, nsPrefix, ownerElement, this);
 }
开发者ID:bly3,项目名称:xplus-xsd2cpp,代码行数:17,代码来源:Document.cpp

示例10: CSSException

void CSSPrimitiveValue::setFloatValue( unsigned short unitType, float floatValue )
{
    if(!impl) return;
    int exceptioncode = 0;
    ((CSSPrimitiveValueImpl *)impl)->setFloatValue( unitType, floatValue, exceptioncode );
#if KHTML_NO_EXCEPTIONS
    if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
	{ _exceptioncode =  exceptioncode - CSSException::_EXCEPTION_OFFSET; return; }
    if ( exceptioncode )
	{ _exceptioncode =  exceptioncode ; return; }
#else
    if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
	throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
    if ( exceptioncode )
	throw DOMException( exceptioncode );
#endif
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:17,代码来源:css_value.cpp

示例11: DOMException

void DOMCharacterDataImpl::setNodeValue(const DOMNode *node, const XMLCh *value)
{
    if (castToNodeImpl(node)->isReadOnly())
        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
    fDataBuf->set(value);

    if (node->getOwnerDocument() != 0) {
        Ranges* ranges = ((DOMDocumentImpl *)node->getOwnerDocument())->getRanges();
        if (ranges != 0) {
            XMLSize_t sz = ranges->size();
            if (sz != 0) {
                for (XMLSize_t i =0; i<sz; i++) {
                    ranges->elementAt(i)->receiveReplacedText((DOMNode*)node);
                }
            }
        }
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:18,代码来源:DOMCharacterDataImpl.cpp

示例12: getOwnerDocument

void
Attr::setOwnerElement(Element * e)
{
  if (e == null) {
    if (ownerNode != null) {
      ownerNode = getOwnerDocument();
      isOwned(false);
      isSpecified(true);
      isId(false);
    }
  }
  else {
    if (isOwned())
      throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR);
    ownerNode = e;
    isOwned(true);
    setId();
  }
}
开发者ID:CaptEmulation,项目名称:svgl,代码行数:19,代码来源:Attr.cpp

示例13: poco_check_ptr

void NodeAppender::appendChild(Node* newChild)
{
	poco_check_ptr (newChild);
	poco_assert (_pLast == 0 || _pLast->_pNext == 0);

	if (static_cast<AbstractNode*>(newChild)->_pOwner != _pParent->_pOwner)
		throw DOMException(DOMException::WRONG_DOCUMENT_ERR);
		
	if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
	{
		AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
		AbstractNode* pChild = pFrag->_pFirstChild;
		if (pChild)
		{
			if (_pLast)
				_pLast->_pNext = pChild;
			else
				_pParent->_pFirstChild = pChild;
			while (pChild)
			{
				_pLast = pChild;
				pChild->_pParent = _pParent;
				pChild = pChild->_pNext;
			}
			pFrag->_pFirstChild = 0;
		}
	}
	else
	{
		AbstractNode* pAN = static_cast<AbstractNode*>(newChild);
		pAN->duplicate();
		if (pAN->_pParent) 
			pAN->_pParent->removeChild(pAN);
		pAN->_pParent = _pParent;
		if (_pLast)
			_pLast->_pNext = pAN;
		else
			_pParent->_pFirstChild = pAN;
		_pLast = pAN;
	}
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:41,代码来源:NodeAppender.cpp

示例14: DOMException

DOMNode* DOMNodeIteratorImpl::nextNode () {
	if (fDetached)
		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);

    // if root is 0 there is no next node->
    if (!fRoot)
			return 0;

    DOMNode* aNextNode = fCurrentNode;
    bool accepted = false; // the next node has not been accepted.

    while (!accepted) {

        // if last direction is not forward, repeat node->
        if (!fForward && (aNextNode != 0)) {
            //System.out.println("nextNode():!fForward:"+fCurrentNode.getNodeName());
            aNextNode = fCurrentNode;
        } else {
        // else get the next node via depth-first
            aNextNode = nextNode(aNextNode, true);
        }

        fForward = true; //REVIST: should direction be set forward before 0 check?

        // nothing in the list. return 0.
        if (!aNextNode) return 0;

        // does node pass the filters and whatToShow?
        accepted = acceptNode(aNextNode);
        if (accepted) {
            // if so, then the node is the current node->
            fCurrentNode = aNextNode;
            return fCurrentNode;
        }
    }

    // no nodes, or no accepted nodes.
    return 0;
}
开发者ID:xin3liang,项目名称:platform_external_xerces-cpp,代码行数:39,代码来源:DOMNodeIteratorImpl.cpp

示例15: DOMException

const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t offset,
                                           XMLSize_t count) const
{

    // Note: the C++ XMLCh * operation throws the correct DOMExceptions
    //       when parameter values are bad.
    //


    XMLSize_t len = fDataBuf->getLen();

    if (offset > len)
        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);

    DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();

    XMLCh* newString;
    XMLCh temp[4096];
    if (len >= 4095)
      newString = (XMLCh*) doc->getMemoryManager()->allocate
        (
            (len + 1) * sizeof(XMLCh)
        );//new XMLCh[len+1];
    else
        newString = temp;

    XMLString::copyNString(newString, fDataBuf->getRawBuffer()+offset, count);
    newString[count] = chNull;

    const XMLCh* retString = doc->getPooledString(newString);

    if (len >= 4095)
      doc->getMemoryManager()->deallocate(newString);//delete[] newString;

    return retString;

}
开发者ID:JohnWilliam1988,项目名称:TCIDE,代码行数:37,代码来源:DOMCharacterDataImpl.cpp


注:本文中的DOMException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。