本文整理汇总了C++中DOMNode::getPrefix方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::getPrefix方法的具体用法?C++ DOMNode::getPrefix怎么用?C++ DOMNode::getPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::getPrefix方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
cmd = EppCommandInfo::fromXML(*node);
}
else if( name.equals("check") )
{
cmd = EppCommandCheck::fromXML(*node);
}
else if( name.equals("renew") )
{
cmd = EppCommandRenew::fromXML(*node);
}
else if( name.equals("transfer") )
{
cmd = EppCommandTransfer::fromXML(*node);
}
else if( name.equals("update") )
{
cmd = EppCommandUpdate::fromXML(*node);
}
/*
* other commands
*/
if( cmd != null )
{
break;
}
}
if( cmd == null )
{
return null;
}
for( i = 0; i < list->getLength(); i++ )
{
DOMNode* node = list->item(i);
DOMString name = node->getLocalName();
if( name.isNull() )
{
name = node->getNodeName();
}
if( name.isNull() )
{
continue;
}
if( name.equals("creds") )
{
if( cmd->creds == null )
{
//cmd->creds = EppCreds::fromXML(node);
}
}
else if( name.equals("extension") )
{
DOMNodeList* clist = node->getChildNodes();
for( unsigned int j = 0; j < clist->getLength(); j++ )
{
DOMNode* cnode = clist->item(j);
DOMString prefix = cnode->getPrefix();
DOMString cname = cnode->getLocalName();
DOMString nsURI = cnode->getNamespaceURI();
if( cname.isNull() )
{
cname = cnode->getNodeName();
}
if( cname.isNull() )
{
continue;
}
if( cname.equals("neulevel:extension")
|| ( (prefix.isNotNull()) && prefix.equals("neulevel")
&& (cname.isNotNull()) && cname.equals("extension") )
|| cname.equals("ex01:extension") )
{
EppUnspec * unspec = EppUnspec::fromXML(*cnode);
if( unspec != null )
{
cmd->addExtension(unspec);
}
}
else if( cname.isNotNull() )
{
EppExtension * ext = EppExtension::fromXML(*cnode);
if( ext != null )
{
cmd->addExtension(ext);
}
// else other extensions
}
else
{
// other extensions
}
}
}
else if( name.equals("clTRID") )
{
cmd->clTRID = EppUtil::getText(*node);
}
}
return cmd;
}
示例2: lookupNamespacePrefix
const XMLCh* DOMNodeImpl::lookupNamespacePrefix(const XMLCh* const namespaceURI, bool useDefault, DOMElement *el) const {
DOMNode *thisNode = castToNode(this);
const XMLCh* ns = thisNode->getNamespaceURI();
// REVISIT: if no prefix is available is it null or empty string, or
// could be both?
const XMLCh* prefix = thisNode->getPrefix();
if (ns != 0 && XMLString::equals(ns,namespaceURI)) {
if (useDefault || prefix != 0) {
const XMLCh* foundNamespace = el->lookupNamespaceURI(prefix);
if (foundNamespace != 0 && XMLString::equals(foundNamespace, namespaceURI)) {
return prefix;
}
}
}
if (thisNode->hasAttributes()) {
DOMNamedNodeMap *nodeMap = thisNode->getAttributes();
if(nodeMap != 0) {
int length = nodeMap->getLength();
for (int i = 0;i < length;i++) {
DOMNode *attr = nodeMap->item(i);
const XMLCh* attrPrefix = attr->getPrefix();
const XMLCh* value = attr->getNodeValue();
ns = attr->getNamespaceURI();
if (ns != 0 && XMLString::equals(ns, XMLUni::fgXMLNSURIName)) {
// DOM Level 2 nodes
if ((useDefault && XMLString::equals(attr->getNodeName(), XMLUni::fgXMLNSString)) ||
(attrPrefix != 0 && XMLString::equals(attrPrefix, XMLUni::fgXMLNSString)) &&
XMLString::equals(value, namespaceURI)) {
const XMLCh* localname= attr->getLocalName();
const XMLCh* foundNamespace = el->lookupNamespaceURI(localname);
if (foundNamespace != 0 && XMLString::equals(foundNamespace, namespaceURI)) {
return localname;
}
}
}
}
}
}
DOMNode *ancestor = getElementAncestor(thisNode);
if (ancestor != 0) {
return castToNodeImpl(ancestor)->lookupNamespacePrefix(namespaceURI, useDefault, el);
}
return 0;
}
示例3: isDefaultNamespace
bool DOMNodeImpl::isDefaultNamespace(const XMLCh* namespaceURI) const{
DOMNode *thisNode = castToNode(this);
short type = thisNode->getNodeType();
switch (type) {
case DOMNode::ELEMENT_NODE: {
const XMLCh *prefix = thisNode->getPrefix();
// REVISIT: is it possible that prefix is empty string?
if (prefix == 0 || !*prefix) {
return XMLString::equals(namespaceURI, thisNode->getNamespaceURI());
}
if (thisNode->hasAttributes()) {
DOMElement *elem = (DOMElement *)thisNode;
DOMNode *attr = elem->getAttributeNodeNS(XMLUni::fgXMLNSURIName, XMLUni::fgXMLNSString);
if (attr != 0) {
const XMLCh *value = attr->getNodeValue();
return XMLString::equals(namespaceURI, value);
}
}
DOMNode *ancestor = getElementAncestor(thisNode);
if (ancestor != 0) {
return ancestor->isDefaultNamespace(namespaceURI);
}
return false;
}
case DOMNode::DOCUMENT_NODE:{
return ((DOMDocument*)thisNode)->getDocumentElement()->isDefaultNamespace(namespaceURI);
}
case DOMNode::ENTITY_NODE :
case DOMNode::NOTATION_NODE:
case DOMNode::DOCUMENT_FRAGMENT_NODE:
case DOMNode::DOCUMENT_TYPE_NODE:
// type is unknown
return false;
case DOMNode::ATTRIBUTE_NODE:{
if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) {
return fOwnerNode->isDefaultNamespace(namespaceURI);
}
return false;
}
default:{
DOMNode *ancestor = getElementAncestor(thisNode);
if (ancestor != 0) {
return ancestor->isDefaultNamespace(namespaceURI);
}
return false;
}
}
}
示例4: isEqualNode
bool DOMNodeImpl::isEqualNode(const DOMNode* arg) const
{
if (!arg)
return false;
if (isSameNode(arg)) {
return true;
}
DOMNode* thisNode = castToNode(this);
if (arg->getNodeType() != thisNode->getNodeType()) {
return false;
}
// the compareString will check null string as well
if (!XMLString::equals(thisNode->getNodeName(), arg->getNodeName())) {
return false;
}
if (!XMLString::equals(thisNode->getLocalName(),arg->getLocalName())) {
return false;
}
if (!XMLString::equals(thisNode->getNamespaceURI(), arg->getNamespaceURI())) {
return false;
}
if (!XMLString::equals(thisNode->getPrefix(), arg->getPrefix())) {
return false;
}
if (!XMLString::equals(thisNode->getNodeValue(), arg->getNodeValue())) {
return false;
}
if (!XMLString::equals(thisNode->getBaseURI(), arg->getBaseURI())) {
return false;
}
return true;
}
示例5: lookupNamespaceURI
const XMLCh* DOMNodeImpl::lookupNamespaceURI(const XMLCh* specifiedPrefix) const {
DOMNode *thisNode = castToNode(this);
short type = thisNode->getNodeType();
switch (type) {
case DOMNode::ELEMENT_NODE : {
const XMLCh* ns = thisNode->getNamespaceURI();
const XMLCh* prefix = thisNode->getPrefix();
if (ns != 0) {
// REVISIT: is it possible that prefix is empty string?
if (specifiedPrefix == 0 && prefix == specifiedPrefix) {
// looking for default namespace
return ns;
} else if (prefix != 0 && XMLString::equals(prefix, specifiedPrefix)) {
// non default namespace
return ns;
}
}
if (thisNode->hasAttributes()) {
DOMNamedNodeMap *nodeMap = thisNode->getAttributes();
if(nodeMap != 0) {
int length = nodeMap->getLength();
for (int i = 0;i < length;i++) {
DOMNode *attr = nodeMap->item(i);
const XMLCh *attrPrefix = attr->getPrefix();
const XMLCh *value = attr->getNodeValue();
ns = attr->getNamespaceURI();
if (ns != 0 && XMLString::equals(ns, XMLUni::fgXMLNSURIName)) {
// at this point we are dealing with DOM Level 2 nodes only
if (specifiedPrefix == 0 &&
XMLString::equals(attr->getNodeName(), XMLUni::fgXMLNSString)) {
// default namespace
return value;
} else if (attrPrefix != 0 &&
XMLString::equals(attrPrefix, XMLUni::fgXMLNSString) &&
XMLString::equals(attr->getLocalName(), specifiedPrefix)) {
// non default namespace
return value;
}
}
}
}
}
DOMNode *ancestor = getElementAncestor(thisNode);
if (ancestor != 0) {
return ancestor->lookupNamespaceURI(specifiedPrefix);
}
return 0;
}
case DOMNode::DOCUMENT_NODE : {
return((DOMDocument*)thisNode)->getDocumentElement()->lookupNamespaceURI(specifiedPrefix);
}
case DOMNode::ENTITY_NODE :
case DOMNode::NOTATION_NODE:
case DOMNode::DOCUMENT_FRAGMENT_NODE:
case DOMNode::DOCUMENT_TYPE_NODE:
// type is unknown
return 0;
case DOMNode::ATTRIBUTE_NODE:{
if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) {
return fOwnerNode->lookupNamespaceURI(specifiedPrefix);
}
return 0;
}
default:{
DOMNode *ancestor = getElementAncestor(castToNode(this));
if (ancestor != 0) {
return ancestor->lookupNamespaceURI(specifiedPrefix);
}
return 0;
}
}
}
示例6: while
const DOMNode *NamespaceAxis::nextNode(DynamicContext *context)
{
const DOMNode *result = 0;
while(result == 0) {
switch(state_) {
case CHECK_ELEMENT: {
const XMLCh* uri = node_->getNamespaceURI();
const XMLCh* prefix = node_->getPrefix();
if(done_.insert(prefix).second && uri && *uri) {
result = createNamespaceNode(prefix, uri, originalNode_);
}
state_ = CHECK_ATTR;
break;
}
case CHECK_ATTR: {
if(nodeMap_ != 0 && i_ < nodeMap_->getLength()) {
DOMNode *tmpAttr = nodeMap_->item(i_);
++i_;
const XMLCh* attrName = tmpAttr->getNodeName();
// Check to see if this attribute starts with xmlns
if(!XMLString::startsWith(attrName, XMLUni::fgXMLNSString)) {
const XMLCh* uri = tmpAttr->getNamespaceURI();
const XMLCh* prefix = tmpAttr->getPrefix();
if(uri && *uri && done_.insert(prefix).second) {
result = createNamespaceNode(prefix, uri, originalNode_);
}
}
else {
// Get uri
const XMLCh* uri = tmpAttr->getNodeValue();
// Figure out prefix
const XMLCh* prefix = 0;
if(XMLString::stringLen(attrName) != 5) {
// A prefix was given
// If the name doesn't start with xmlns: (and its not xmlns) then skip it
// XXX: Is this necessary/allowed?
if(attrName[5] != chColon) {
continue;
}
prefix = attrName + 6;
}
if(done_.insert(prefix).second && uri && *uri) {
result = createNamespaceNode(prefix, uri, originalNode_);
}
}
}
else {
node_ = XPath2NSUtils::getParent(node_);
if(node_ == 0 || node_->getNodeType() != DOMNode::ELEMENT_NODE) {
state_ = DO_XML;
}
else {
nodeMap_ = node_->getAttributes();
i_ = 0;
state_ = CHECK_ELEMENT;
}
}
break;
}
case DO_XML: {
result = createNamespaceNode(XMLUni::fgXMLString, XMLUni::fgXMLURIName, originalNode_);
state_ = DONE;
break;
}
case DONE:
return 0;
}
}
return result;
}
示例7: print
void EppWriter::print( const DOMNode &node, int level, DOMString prefix )
{
unsigned int i = 0;
int j = 0;
DOMNodeList* list;
DOMNamedNodeMap* attrs;
DOMString newPrefix;
int type = node.getNodeType();
switch( type )
{
case DOMNode::DOCUMENT_NODE:
if( ! canonical )
{
out += XS("<?xml version=\"1.0\" encoding=\"")
+ encoding + "\"?>";
out += "\n";
}
list = node.getChildNodes();
if( list != null )
{
for( i = 0; i < list->getLength(); i++ )
{
print(*list->item(i), level, prefix);
}
}
break;
case DOMNode::ELEMENT_NODE:
for( j = 0; j < level; j++ )
{
out += " ";
}
out += "<";
newPrefix = node.getPrefix();
if( newPrefix.isNotNull() )
{
prefix = newPrefix;
}
if( (newPrefix.isNull()) && (prefix.isNotNull()) )
{
out += prefix;
out += ":";
}
out += node.getNodeName();
attrs = node.getAttributes();
if( attrs != null )
{
for( i = 0; i < attrs->getLength(); i++ )
{
DOMNode* attr = attrs->item(i);
out += " ";
out += attr->getNodeName();
out += "=\"";
out += attr->getNodeValue();
out += "\"";
}
}
list = node.getChildNodes();
if( (list == null) || (list->getLength() == 0) )
{
out += "/>\n";
}
else
{
bool cr = false;
out += ">";
for( i = 0; i < list->getLength(); i++ )
{
if( i == 0 )
{
if( list->item(0)->getNodeType() != DOMNode::TEXT_NODE )
{
out += "\n";
cr = true;
}
}
print(*list->item(i), level + 1, prefix);
}
if( cr )
{
for( j = 0; j < level; j++ )
{
out += " ";
}
}
out += "</";
if( (newPrefix.isNull()) && (prefix.isNotNull()) )
{
out += prefix;
out += ":";
}
out += node.getNodeName();
out += ">\n";
}
break;
case DOMNode::TEXT_NODE:
{
DOMString p = node.getNodeValue();
//.........这里部分代码省略.........
示例8: if
//.........这里部分代码省略.........
if( id.isNotNull() && id.length() > 0 )
{
rsp->msgId = id;
}
DOMString str = elm->getAttribute(XS("count"));
if( str.isNotNull() && str.length() > 0 )
{
char * p = str.transcode();
if( p != null )
{
rsp->msgQCount = atoi(p);
XercesString::Delete(p);
}
}
DOMNodeList* qlist = node->getChildNodes();
for( unsigned int j = 0; j < qlist->getLength(); j++ )
{
node = qlist->item(j);
name = node->getLocalName();
if( name.isNull() )
{
name = node->getNodeName();
}
if( name.isNull() )
{
continue;
}
if( name.equals("qDate") )
{
rsp->msgQDate = EppUtil::getDate(*node);
}
else if( name.equals("msg") )
{
rsp->msgQText = EppUtil::getText(*node);
}
}
}
else if( name.equals("resData") )
{
if( rsp->resData == null )
{
rsp->resData = EppResponseData::fromXML(*node);
rsp->freeable = true;
}
}
else if( name.equals("extension") )
{
DOMNodeList* clist = node->getChildNodes();
for( unsigned int j = 0; j < clist->getLength(); j++ )
{
DOMNode* cnode = clist->item(j);
DOMString prefix = cnode->getPrefix();
DOMString cname = cnode->getLocalName();
if( cname.isNull() )
{
cname = cnode->getNodeName();
}
if( cname.isNull() )
{
continue;
}
if( cname.equals("neulevel:extension")
|| ( (prefix.isNotNull()) && prefix.equals("neulevel")
&& (cname.isNotNull()) && cname.equals("extension") ) )
{
EppUnspec * unspec = EppUnspec::fromXML(*cnode);
if( unspec != null )
{
rsp->addExtension(unspec);
}
}
else if( cname.isNotNull() )
{
EppExtension * ext = EppExtension::fromXML(*cnode);
if( ext != null )
{
rsp->addExtension(ext);
}
// else other extension
}
else
{
// other extensions
}
}
}
else if( name.equals("trID") )
{
if( rsp->trID == null )
{
rsp->trID = EppTransactionId::fromXML(*node);
}
}
}
return rsp;
}
示例9: if
EppCommandDelete * EppCommandDelete::fromXML( const DOMNode& root )
{
// FIXME(zhang)
DOMString command = root.getLocalName();
if( command.isNull() )
{
command = root.getNodeName();
}
DOMNodeList* list = root.getChildNodes();
for( unsigned int i = 0; i < list->getLength(); i++ )
{
DOMNode* node = list->item(i);
DOMString prefix = node->getPrefix();
DOMString name = node->getLocalName();
if( name.isNull() )
{
name = node->getNodeName();
}
if( name.isNull() )
{
continue;
}
/*
if( prefix == null )
{
if( name.substringData(name.length() - command.length() - 1,
command.length() + 1).equals(DOMString(":") + command) )
{
prefix = name.substringData(0, name.length() - command.length() - 1);
}
}
if( (prefix == null) || (name == null) )
{
continue;
}
*/
/*
if( name.equals(command) )
{
if( prefix.equals("contact") )
{
return EppCommandDeleteContact.fromXML(node);
}
else if( prefix.equals("domain") )
{
return EppCommandDeleteDomain.fromXML(node);
}
else if( prefix.equals("host") )
{
return EppCommandDeleteHost.fromXML(node);
}
else if( prefix.equals("svcsub") )
{
return EppCommandDeleteSvcsub.fromXML(node);
}
}
*/
if( name.equals("contact") || name.equals("contact:delete") )
{
return EppCommandDeleteContact::fromXML(*node);
}
else if( name.equals("domain") || name.equals("domain:delete") )
{
return EppCommandDeleteDomain::fromXML(*node);
}
else if( name.equals("host") || name.equals("host:delete") )
{
return EppCommandDeleteHost::fromXML(*node);
}
else if( name.equals("svcsub") || name.equals("svcsub:delete") )
{
return EppCommandDeleteSvcsub::fromXML(*node);
}
#if defined(RTK_SUPPORT_XRI)
else if( name.equals("xriAU") || name.equals("xriAU:delete") )
{
return EppCommandDeleteXriAuthority::fromXML(*node);
}
else if( name.equals("xriINU") || name.equals("xriINU:delete") )
{
return EppCommandDeleteXriNumber::fromXML(*node);
}
else if( name.equals("xriINA") || name.equals("xriINA:delete") )
{
return EppCommandDeleteXriName::fromXML(*node);
}
else if( name.equals("xriISV") || name.equals("xriISV:delete") )
{
return EppCommandDeleteXriService::fromXML(*node);
}
else if( name.equals("xriCS") || name.equals("xriCS:delete") )
{
return EppCommandDeleteXriCodeString::fromXML(*node);
}
#endif
}
return null;
//.........这里部分代码省略.........
示例10: fromXML
EppCommandCreate* EppCommandCreate::fromXML( const DOMNode& root )
{
// FIXME(zhang)
DOMString command = root.getLocalName();
if( command.isNull() )
{
command = root.getNodeName();
}
DOMNodeList* list = root.getChildNodes();
EppObject * object = null;
for( unsigned int i = 0; i < list->getLength(); i++ )
{
DOMNode* node = list->item(i);
DOMString prefix = node->getPrefix();
DOMString name = node->getLocalName();
if( name.isNull() )
{
name = node->getNodeName();
}
if( name.isNull() )
{
continue;
}
/*
if( prefix == null )
{
if( name.substringData(name.length() - command.length() - 1,
command.length() + 1).equals(DOMString(":") + command) )
{
prefix = name.substringData(0, name.length() - command.length() - 1);
}
}
if( (prefix == null) || (name == null) )
{
continue;
}
if( name.equals(command) )
{
if( prefix.equals("contact") )
{
object = EppContact::fromXML(node);
}
else if( prefix.equals("domain") )
{
object = EppDomain::fromXML(node);
}
else if( prefix.equals("host") )
{
object = EppHost::fromXML(node);
}
else if( prefix.equals("svcsub") )
{
object = EppSvcsub::fromXML(node);
}
}
*/
if( name.equals("contact") || name.equals("contact:create") )
{
object = EppContact::fromXML(*node);
}
else if( name.equals("domain") || name.equals("domain:create") )
{
object = EppDomain::fromXML(*node);
}
else if( name.equals("host") || name.equals("host:create") )
{
object = EppHost::fromXML(*node);
}
else if( name.equals("svcsub") || name.equals("svcsub:create") )
{
object = EppSvcsub::fromXML(*node);
}
#if defined(RTK_SUPPORT_XRI)
else if( name.equals("xriAU") || name.equals("xriAU:create") )
{
object = EppXriAuthority::fromXML(*node);
}
else if( name.equals("xriINU") || name.equals("xriINU:create") )
{
object = EppXriNumber::fromXML(*node);
}
else if( name.equals("xriINA") || name.equals("xriINA:create") )
{
object = EppXriName::fromXML(*node);
}
else if( name.equals("xriISV") || name.equals("xriISV:create") )
{
object = EppXriService::fromXML(*node);
}
else if( name.equals("xriCS") || name.equals("xriCS:create") )
{
object = EppXriCodeString::fromXML(*node);
}
#endif
if( object != null )
{
EppCommandCreate * cmd = new EppCommandCreate(object);
cmd->freeable = true;
//.........这里部分代码省略.........