本文整理汇总了C++中DOMString::substringData方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMString::substringData方法的具体用法?C++ DOMString::substringData怎么用?C++ DOMString::substringData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMString
的用法示例。
在下文中一共展示了DOMString::substringData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverseTextNode
/**
* 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;
}
示例2: fromXML
EppMarkMark* EppMarkMark::fromXML( const DOMNode& root, const char* ns)
{
EppMarkMark *_ret = new EppMarkMark(ns);
DOMNodeList* list = root.getChildNodes();
int nsLen = strlen(ns);
if( list == 0 )
{
delete _ret;
return NULL;
}
for( unsigned int 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.substringData(0, nsLen + 1).equals((_ret->getNameSpace() + ":").c_str()) )
{
name = name.substringData(nsLen + 1, name.length() - ( nsLen + 1 ));
}
if( name.equals("trademark") )
{
EppTrademarkData *_tmd = EppTrademarkData::fromXML(*node, ns);
if( NULL != _tmd )
{
_ret->_marks.addElement(_tmd);
}
}
else if ( name.equals("court") )
{
EppCourtData *_cd = EppCourtData::fromXML(*node, ns);
if( NULL != _cd )
{
_ret->_marks.addElement(_cd);
}
}
else if ( name.equals("treatyOrStatute") )
{
EppTreatyOrStatuteData *_tsd = EppTreatyOrStatuteData::fromXML(*node, ns);
if( NULL != _tsd )
{
_ret->_marks.addElement(_tsd );
}
}
}
return _ret;
}
示例3: if
EppCommandInfoLaunchRegistration* EppCommandInfoLaunchRegistration::fromXML( const DOMNode& root )
{
EppCommandInfoLaunchRegistration* cmd = new EppCommandInfoLaunchRegistration();
if( cmd == null )
{
return null;
}
DOMNodeList* list = root.getChildNodes();
DOMNamedNodeMap* attrs = root.getAttributes();
for( unsigned int 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.length() > 7) && name.substringData(0, 7).equals("launch:") )
{
name = name.substringData(7, name.length() - 7);
}
if( name.equals("phase") )
{
EppLaunchPhase *_pptr = EppLaunchPhase::fromXML(*node);
if( null != _pptr )
{
cmd->_phase = *_pptr;
delete _pptr;
}
_pptr = null;
}
else if ( name.equals("applicationID") )
{
cmd->_appId = EppUtil::getText(*node);
}
}
for( unsigned int i = 0;i<attrs->getLength();i++ )
{
DOMNode* attr = attrs->item(i);
if( XS(attr->getNodeName()).equals("includeMark") )
{
DOMString _v = attr->getNodeValue();
if( _v.length() > 0 )
{
if( _v.equals("true") )
{
cmd->includeMark(true);
}
}
break;
}
}
return cmd;
}
示例4: fromXML
EppCommandCreateSecDns* EppCommandCreateSecDns::fromXML( const DOMNode &root )
{
EppCommandCreateSecDns * cmd = new EppCommandCreateSecDns();
if( cmd == null )
{
return null;
}
DOMNodeList* list = root.getChildNodes();
for( unsigned int 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.substringData(0, 7).equals("secDNS:") )
{
name = name.substringData(7, name.length() - 7);
}
if( name.equals("dsData") )
{
EppSecDnsDsData * ds = EppSecDnsDsData::fromXML(*node);
if( ds != null )
{
cmd->add(*ds);
delete ds;
}
}
else if( name.equals("maxSigLife") )
{
DOMString value = EppUtil::getText(*node);
char *p = value.transcode();
if( p != null )
{
cmd->maxSigLife = ::atoi(p);
XercesString::Delete(p);
}
}
else if( name.equals("keyData") )
{
// FIXME(zhang) not supported
cmd->keyDataPresent = true;
EppSecDnsKeyData *kd = EppSecDnsKeyData::fromXML(*node);
if( kd != null )
{
cmd->add(*kd);
delete kd;
}
}
}
return cmd;
}
示例5: if
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;
}
示例6: if
EppResponseDataCreateLaunchRegistration* EppResponseDataCreateLaunchRegistration::fromXML( const DOMNode& root )
{
EppResponseDataCreateLaunchRegistration *cmd = new EppResponseDataCreateLaunchRegistration();
if( cmd == null )
{
return null;
}
DOMNodeList* list = root.getChildNodes();
for( unsigned int 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.length() > 7) && name.substringData(0, 7).equals("launch:") )
{
name = name.substringData(7, name.length() - 7);
}
if( name.equals("phase") )
{
EppLaunchPhase *_pptr = EppLaunchPhase::fromXML(*node);
if( null != _pptr )
{
cmd->_phase = *_pptr;
delete _pptr;
}
_pptr = null;
}
else if( name.equals("applicationID") )
{
cmd->_appId = EppUtil::getText(*node);
}
}
return cmd;
}
示例7: if
EppHost * EppHost::fromXML( const DOM_Node& root )
{
EppHost * host = new EppHost();
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, 5).equals("host:") )
{
name = name.substringData(5, name.length() - 5);
}
if( name.equals("name") )
{
host->setName(EppUtil::getText(node));
}
else if( name.equals("addr") )
{
EppIpAddress * ip = EppIpAddress::fromXML(node);
if ( ip != null )
{
host->addAddress(*ip);
delete ip;
}
}
else
{
host->fromXMLCommon(node, name);
}
}
return host;
}
示例8: fromXML
EppLaunchProtection* EppLaunchProtection::fromXML( const DOMNode& root, const char* ns )
{
EppLaunchProtection *_ret = new EppLaunchProtection(ns);
if( null == _ret )
return null;
DOMNodeList* list = root.getChildNodes();
int nsLen = strlen(ns);
for( unsigned int 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.substringData(0, nsLen + 1).equals((_ret->getNameSpace() + ":").c_str() ) )
{
name = name.substringData(nsLen + 1, name.length() - (nsLen + 1));
}
if( name.equals("cc") )
{
_ret->_cc = (EppUtil::getText(*node)).substringData(0, 2);
}
else if( name.equals("region") )
{
_ret->_region = EppUtil::getText(*node);
}
else if( name.equals("ruling") )
{
_ret->_ruling = EppUtil::getText(*node);
}
}
return _ret;
}
示例9: fromXML
EppLaunchPhase* EppLaunchPhase::fromXML( const DOMNode& root )
{
DOMNamedNodeMap* attrs = root.getAttributes();
EppLaunchPhase *_ret = new EppLaunchPhase();
if( null == _ret )
return null;
{
DOMNode* node = (DOMNode*)&root;
DOMString name = node->getLocalName();
if( name.isNull() )
{
name = node->getNodeName();
}
if( name.isNotNull() )
{
if( name.substringData(0, 7).equals("launch:") )
{
name = name.substringData(7, name.length() - 7);
}
if( name.equals("phase") )
{
_ret->_phase = EppUtil::getText(*node);
}
}
}
for( unsigned int i = 0; i<attrs->getLength(); i++ )
{
DOMNode* attr = attrs->item(i);
DOMString _v = attr->getNodeValue();
if( XS(attr->getNodeName()).equals("name") )
{
_ret->_sub_phase = attr->getNodeValue();
break;
}
}
return _ret;
}
示例10: substring
DOMString EppUtil::substring(char sep , const DOMString & src)
{
DOMString name;
if ( src.isNull() ) return name;
name = src;
char * nameStr = name.transcode();
if ( nameStr == null ) return name;
int totalLen = name.length();
char * indexPtr = strchr(nameStr, sep);
if ( indexPtr != null )
{
int len = indexPtr - nameStr;
name = name.substringData(len+1, totalLen);
}
XercesString::Delete(nameStr);
return name;
}
示例11: if
EppAddress * EppAddress::fromXML( const DOMNode& root )
{
DOMString street[MAX_NUM_OF_STREETS];
DOMString city;
DOMString sp;
DOMString pc;
DOMString cc;
unsigned int i;
for( i = 0; i < MAX_NUM_OF_STREETS; i++ )
{
street[i] = NULLXS;
}
DOMNodeList* list = root.getChildNodes();
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.substringData(0, 8).equals("contact:") )
{
name = name.substringData(8, name.length() - 8);
}
if( name.substringData(0, 6).equals("xriAU:") )
{
name = name.substringData(6, name.length() - 6);
}
if( name.equals("street") )
{
for( int j = 0; j < MAX_NUM_OF_STREETS; j++ )
{
if( street[j].isNull() )
{
street[j] = EppUtil::getText(*node);
break;
}
}
}
else if( name.equals("city") )
{
city = EppUtil::getText(*node);
}
else if( name.equals("sp") )
{
sp = EppUtil::getText(*node);
}
else if( name.equals("pc") )
{
pc = EppUtil::getText(*node);
}
else if( name.equals("cc") )
{
cc = EppUtil::getText(*node);
}
}
return new EppAddress(street, city, sp, pc, cc);
}
示例12: countryCode
void EppLaunchProtection::countryCode(const DOMString &_c)
{
this->_cc = _c.substringData(0, 2);
}
示例13: ruling
void EppLaunchProtection::ruling(const DOMString& _c)
{
this->_ruling = _c.substringData(0, 2);
}
示例14: if
EppContactData * EppContactData::fromXML( const DOMNode& root )
{
DOMString contact_name = NULLXS;
DOMString contact_org = NULLXS;
EppAddress * contact_addr = null;
EppContactData * contact_data = null;
bool has_org = false;
DOMNodeList* list = root.getChildNodes();
for( unsigned int 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.substringData(0, 8).equals("contact:") )
{
name = name.substringData(8, name.length() - 8);
}
if( name.substringData(0, 6).equals("xriAU:") )
{
name = name.substringData(6, name.length() - 6);
}
if( name.equals("name") )
{
contact_name = EppUtil::getText(*node);
}
else if( name.equals("org") )
{
contact_org = EppUtil::getText(*node);
has_org = true;
}
else if( name.equals("addr") )
{
if( contact_addr != null )
{
delete contact_addr;
}
contact_addr = EppAddress::fromXML(*node);
}
}
if( has_org ||
(contact_name.isNotNull()) ||
(contact_org.isNotNull()) ||
(contact_addr != null) )
{
contact_data = new EppContactData();
if( contact_data != null )
{
contact_data->setName(contact_name);
contact_data->setOrganization(contact_org);
if( contact_addr != null )
{
contact_data->setAddress(*contact_addr);
delete contact_addr;
contact_addr = null;
}
contact_data->hasOrg = has_org;
}
}
return contact_data;
}
示例15: fromXML
/* NOTE: need to keep _type field in consideration as attribute type/entitlement depends on it.*/
EppMarkHolder* EppMarkHolder::fromXML( const DOMNode& root, const char* ns )
{
/*
this->_name = _src._name;
this->_org = _src._org;
this->_addr = _src._addr;
this->_voice = _src._voice;
this->_fax = _src._fax;
this->_email = _src._email;
this->_addParam = _src._addParam;
this->_type = _src._type;
*/
EppMarkHolder *_ret = new EppMarkHolder(EPPMARK_HOLDER, ns);
//_ret->setNameSpace(ns);
int nsLen = strlen(ns);
if( null == _ret )
return null;
DOMNodeList* list = root.getChildNodes();
DOMNamedNodeMap* attrs = root.getAttributes();
for( unsigned int 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.substringData(0, nsLen + 1).equals((_ret->getNameSpace() + ":").c_str()) )
{
name = name.substringData(nsLen + 1, name.length() - ( nsLen + 1 ));
if( name.equals("name") )
{
_ret->_name = EppUtil::getText(*node);
}
else if ( name.equals("org") )
{
_ret->_org = EppUtil::getText(*node);
}
else if ( name.equals("addr") )
{
EppMarkAddress* mAddr = (EppMarkAddress*)EppMarkAddress::fromXML( *node, ns );
_ret->_addr = *mAddr;
delete mAddr;
}
else if ( name.equals("voice") )
{
EppE164 *_v = EppE164::fromXML(*node);
if( NULL != _v )
{
_ret->_voice = *_v;
delete _v;
}
}
else if ( name.equals("fax") )
{
EppE164 *_f = EppE164::fromXML(*node);
if( NULL != _f )
{
_ret->_fax = *_f;
delete _f;
}
}
else if ( name.equals("email") )
{
_ret->_email = EppUtil::getText(*node);
}
}
}
for( unsigned int i = 0; i < attrs->getLength();i++ )
{
DOMNode* attr = attrs->item(i);
DOMString _v = attr->getNodeValue();
if( XS(attr->getNodeName()).equals("entitlement") )
{
_ret->_type = EPPMARK_HOLDER;
if( _v.length() > 0 )
{
_ret->_addParam = _v;
}
break;
}
else if ( XS(attr->getNodeName()).equals("type") )
{
_ret->_type = EPPMARK_CONTACT;
if( _v.length() > 0 )
{
_ret->_addParam = _v;
}
break;
}
}
return _ret;
}