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


C++ DOM_Node类代码示例

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


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

示例1: traverseLeftBoundary

/**
 * Visits the nodes selected by this range when we know
 * a-priori that the start and end containers are not the
 * same, but the end container is an ancestor of the start container
 *
 */
DOM_DocumentFragment RangeImpl::traverseCommonEndContainer( DOM_Node startAncestor, int how )
{
    DOM_DocumentFragment frag = null;
    if ( how!=DELETE_CONTENTS)
        frag = fDocument.createDocumentFragment();
    DOM_Node n = traverseLeftBoundary( startAncestor, how );
    if ( frag!=null )
        frag.appendChild( n );
    int startIdx = indexOf( startAncestor, fEndContainer );
    ++startIdx;  // Because we already traversed it....

    int cnt = fEndOffset - startIdx;
    n = startAncestor.getNextSibling();
    while( cnt > 0 )
    {
        DOM_Node sibling = n.getNextSibling();
        DOM_Node xferNode = traverseFullySelected( n, how );
        if ( frag!=null )
            frag.appendChild( xferNode );
        --cnt;
        n = sibling;
    }

    if ( how != CLONE_CONTENTS )
    {
        setStartAfter( startAncestor );
        collapse( true );
    }

    return frag;
}
开发者ID:mydw,项目名称:mydw,代码行数:37,代码来源:RangeImpl.cpp

示例2: EppCommandCheckContact

EppCommandCheckContact * EppCommandCheckContact::fromXML( const DOM_Node& root )
{
	EppCommandCheckContact * cmd = new EppCommandCheckContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("id") || name.equals("contact:id") )
		{
			DOMString id = EppUtil::getText(node);
			cmd->addId(id);
		}
	}

	return cmd;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:25,代码来源:EppCommandCheckContact.cpp

示例3: getStartOffset

/**
 * Utility method for traversing a text node that we know
 * a-priori to be on a left or right boundary of the range.
 * This method does not properly handle text nodes that contain
 * both the start and end points of the range.
 *
 */
DOM_Node RangeImpl::traverseTextNode( DOM_Node n, bool isLeft, int how )
{
    DOMString txtValue = n.getNodeValue();
    DOMString newNodeValue;
    DOMString oldNodeValue;

    if ( isLeft )
    {
        int offset = getStartOffset();
        newNodeValue = txtValue.substringData( offset , fStartContainer.getNodeValue().length()-offset);
        oldNodeValue = txtValue.substringData( 0, offset );
    }
    else
    {
        int offset = getEndOffset();
        newNodeValue = txtValue.substringData( 0, offset );
        oldNodeValue = txtValue.substringData( offset , fEndContainer.getNodeValue().length()-offset );
    }

    if ( how != CLONE_CONTENTS )
        n.setNodeValue( oldNodeValue );
    if ( how==DELETE_CONTENTS )
        return null;
    DOM_Node newNode = n.cloneNode( false );
    newNode.setNodeValue( newNodeValue );
    return newNode;
}
开发者ID:mydw,项目名称:mydw,代码行数:34,代码来源:RangeImpl.cpp

示例4: if

EppResponseDataTransferContact * EppResponseDataTransferContact::fromXML( const DOM_Node& root )
{
	EppResponseDataTransferContact * res = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("contact:id") )
		{
			if( res == null )
			{
				DOMString id = EppUtil::getText(node);
				res = new EppResponseDataTransferContact(id);
			}
		}
		else if( res != null )
		{
			res->fromXMLCommon(node, name);
		}
	}

	return res;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:33,代码来源:EppResponseDataTransferContact.cpp

示例5: acceptNode

short TreeWalkerImpl::acceptNode (DOM_Node node) {
	
    if (fNodeFilter == 0) {
        if ( ( fWhatToShow & (1 << (node.getNodeType() - 1))) != 0)
        {
            return DOM_NodeFilter::FILTER_ACCEPT;
        }
        else
        {
            return DOM_NodeFilter::FILTER_SKIP;
        }
    } else {
        // REVISIT: This logic is unclear from the spec!
        if ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0 ) {
            return fNodeFilter->acceptNode(node);
        } else {
            // what to show has failed!
            if (fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_REJECT) {
                return DOM_NodeFilter::FILTER_REJECT;
            } else {
                return DOM_NodeFilter::FILTER_SKIP;
            }
        }
    }
}
开发者ID:ksmyth,项目名称:xerces-c,代码行数:25,代码来源:TreeWalkerImpl.cpp

示例6: while

//======================================================================
//======================================================================
bool XMLDocument::doAttributesMatch(DOM_Node currNode, DataTypeAttribute** dtAttributes)
{
	DOM_NamedNodeMap nnodeMap = currNode.getAttributes();
	int len = nnodeMap.getLength();
	int a = 0;
	DataTypeAttribute* dtAttribute;
	while ((dtAttribute = (DataTypeAttribute*)dtAttributes[a++]) != (DataTypeAttribute*)NULL)
	{
		bool isFound = false;
		for (int i = 0; i < len && !isFound; i++)
		{
			DOM_Node attNode = nnodeMap.item(i);
      char* tmp = attNode.getNodeName().transcode();
      char* tmp1 = attNode.getNodeValue().transcode();
			if (strcmp(dtAttribute->getName(), tmp) == 0 &&
				strcmp(dtAttribute->getValue(), tmp1) == 0)
			{
				isFound = true;
			}
      delete[] tmp;
      delete[] tmp1;
		}
		if (!isFound)
			return false;
	}

	return true;
}
开发者ID:gres147679,项目名称:openipmp,代码行数:30,代码来源:XMLDocument.cpp

示例7: EppCommandLogin

EppCommandLogin * EppCommandLogin::fromXML( const DOM_Node& root )
{
	EppCommandLogin * cmd = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.equals("svcs") )
		{
			EppServiceMenu * menu = EppServiceMenu::fromXML(node);
			if( menu != null )
			{
				cmd = new EppCommandLogin(*menu);
				delete menu;
				return cmd;
			}
		}
	}

	return null;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:30,代码来源:EppCommandLogin.cpp

示例8: DOM_SetBoundaryPoint

static OP_STATUS
DOM_SetBoundaryPoint(DOM_EnvironmentImpl *environment, DOM_Document *document, DOM_Range::BoundaryPoint &bp, HTML_Element *elm, unsigned offset, BOOL place_after)
{
	OP_ASSERT(elm);

	DOM_Node *node;
	RETURN_IF_ERROR(environment->ConstructNode(node, elm, document));

	if (!node->IsA(DOM_TYPE_CHARACTERDATA) && !elm->FirstChildActual())
	{
		HTML_Element *parent = elm->ParentActual();
		if (parent)
		{
			RETURN_IF_ERROR(environment->ConstructNode(bp.node, parent, document));

			bp.offset = DOM_Range::CalculateOffset(elm);
			if (place_after)
			{
				bp.offset++;
				bp.unit = NULL;
			}
			else
				bp.unit = node;

			return OpStatus::OK;
		}
	}

	bp.node = node;
	bp.offset = offset;
	bp.unit = NULL;

	return OpStatus::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:34,代码来源:domselection.cpp

示例9: indexOf

unsigned short RangeImpl::indexOf(const DOM_Node& child, const DOM_Node& parent) const
{
    unsigned short i = 0;
    if (child.getParentNode() != parent) return (unsigned short)-1;
    for(DOM_Node node = child.getPreviousSibling(); node!= null; node=node.getPreviousSibling()) {
        i++;
    }
    return i;
}
开发者ID:mydw,项目名称:mydw,代码行数:9,代码来源:RangeImpl.cpp

示例10: isValidAncestorType

bool RangeImpl::isValidAncestorType(const DOM_Node& node) const
{
    for (DOM_Node aNode = node; aNode!=null; aNode = aNode.getParentNode()) {
        short type = aNode.getNodeType();
        if ( type == DOM_Node::ENTITY_NODE
                || type == DOM_Node::NOTATION_NODE
                || type == DOM_Node::DOCUMENT_TYPE_NODE)
            return false;
    }
    return true;
}
开发者ID:mydw,项目名称:mydw,代码行数:11,代码来源:RangeImpl.cpp

示例11: getNextSibling

DOM_Node TreeWalkerImpl::nextSibling () {
		
	DOM_Node result;

    if (fCurrentNode.isNull()) return result;

    DOM_Node node = getNextSibling(fCurrentNode);
    if (! node.isNull()) {
        fCurrentNode = node;
    }
    return node;
}
开发者ID:ksmyth,项目名称:xerces-c,代码行数:12,代码来源:TreeWalkerImpl.cpp

示例12: if

EppCommandInfoSvcsub * EppCommandInfoSvcsub::fromXML( const DOM_Node& root )
{
	EppCommandInfoSvcsub * cmd = null;
	EppAuthInfo * authInfo = null;
	DOMString userid = null;
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
//		if( name.equals("id") )
		if( name.equals("id") || name.equals("svcsub:id") )
		{
			DOMString id = EppUtil::getText(node);
			if( cmd == null )
			{
				cmd = new EppCommandInfoSvcsub(id);
			}
		}
//		if( name.equals("userid") )
		if( name.equals("userid") || name.equals("svcsub:userid") )
		{
			userid = EppUtil::getText(node);
		}
//		else if( name.equals("authInfo") )
		else if( name.equals("authInfo") || name.equals("svcsub:authInfo") )
		{
			if( authInfo == null )
			{
				authInfo = EppAuthInfo::fromXML(node);
			}
		}
	}
	if( cmd != null )
	{
		cmd->authInfo = authInfo;
		cmd->userid = userid;
	}
	else if( authInfo != null )
	{
		delete authInfo;
	}

	return cmd;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:53,代码来源:EppCommandInfoSvcsub.cpp

示例13: getLastChild

/** Return the last child Node from the current node,
 *  after applying filter, whatToshow.
 *  If result is not null, set the current Node.
 */
DOM_Node TreeWalkerImpl::lastChild () {

    DOM_Node result;

    if (fCurrentNode.isNull()) return result;

    DOM_Node node = getLastChild(fCurrentNode);
    if (! node.isNull()) {
        fCurrentNode = node;
    }
    return node;
}
开发者ID:ksmyth,项目名称:xerces-c,代码行数:16,代码来源:TreeWalkerImpl.cpp

示例14: EppContact

EppContact * EppContact::fromXML( const DOM_Node& root )
{
	EppContact * contact = new EppContact();
	DOM_NodeList list = root.getChildNodes();
	for( unsigned int i = 0; i < list.getLength(); i++ )
	{
		DOM_Node node = list.item(i);
		DOMString name = node.getLocalName();
		if( name == null )
		{
			name = node.getNodeName();
		}
		if( name == null )
		{
			continue;
		}
		if( name.substringData(0, 8).equals("contact:") )
		{
			name = name.substringData(8, name.length() - 8);
		}
		if( name.equals("id") )
		{
			contact->id = EppUtil::getText(node);
		}
		else if( name.equals("ascii") )
		{
			contact->ascii = EppContactData::fromXML(node);
		}
		else if( name.equals("i15d") )
		{
			contact->i15d = EppContactData::fromXML(node);
		}
		else if( name.equals("voice") )
		{
			contact->voice = EppE164::fromXML(node);
		}
		else if( name.equals("fax") )
		{
			contact->fax = EppE164::fromXML(node);
		}
		else if( name.equals("email") )
		{
			contact->email = EppUtil::getText(node);
		}
		else
		{
			contact->fromXMLCommon(node, name);
		}
	}

	return contact;
}
开发者ID:davin-bao,项目名称:registrar_epp04toolkit,代码行数:52,代码来源:EppContact.cpp

示例15: DOM_DOMException

void RangeImpl::checkReadOnly(DOM_Node& start, DOM_Node& end,
                              unsigned int startOffset, unsigned int endOffset)
{
    if ((start == null) || (end == null) ) return;
    //if both start and end are text check and return
    if (start.getNodeType() == DOM_Node::TEXT_NODE) {
        if (start.fImpl->isReadOnly()) {
            throw DOM_DOMException(
                DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
        }
        if (start == end)
            return;
    }
    //set the start and end nodes to check
    DOM_Node sNode = start.getFirstChild();
    for(unsigned int i = 0; i<startOffset; i++)
        sNode = sNode.getNextSibling();

    DOM_Node eNode;
    if (end.getNodeType() == DOM_Node::TEXT_NODE) {
        eNode = end; //need to check only till this node
    }
    else { //need to check all the kids that fall before the end offset value
        eNode = end.getFirstChild();
        for (unsigned int i = 0; i<endOffset-1; i++)
            eNode = eNode.getNextSibling();
    }
    //recursivly search if any node is readonly
    recurseTreeAndCheck(sNode, eNode);
}
开发者ID:mydw,项目名称:mydw,代码行数:30,代码来源:RangeImpl.cpp


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