您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xmlHasProp函数代码示例

51自学网 2021-06-03 11:45:52
  C++
这篇教程C++ xmlHasProp函数代码示例写得很实用,希望能帮到您。

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

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

示例1: iterate_and_get_elements

void iterate_and_get_elements(xmlNode * a_node){	xmlNode *cur_node = NULL;	xmlAttr *attribute;	xmlChar *text;	double minLatitude = 200;	double maxLatitude = -200;	double minLongitude = 200;	double maxLongitude = -200;	double latitude;	double longitude;	for(cur_node = a_node->children; cur_node; cur_node = cur_node->next){		if(cur_node->type == XML_ELEMENT_NODE) {			attribute = cur_node->properties;			if(verbose)				printf("node type: Element, name: %s/n", cur_node->name);			if (xmlHasProp(cur_node, "lat") == NULL) continue;			text = xmlGetProp(cur_node,"lat");			latitude = atof(text);			if(verbose)				printf("  latitude: %s/n", text);			if (xmlHasProp(cur_node, "lon") == NULL) continue;			text = xmlGetProp(cur_node,"lon");			longitude = atof(text);			if(verbose)				printf("  longitude: %s/n", text);			if(latitude > maxLatitude) maxLatitude = latitude;			if(latitude < minLatitude) minLatitude = latitude;			if(longitude < minLongitude) minLongitude = longitude;			if(longitude > maxLongitude) maxLongitude = longitude;		} 	}	if(verbose){		printf("The maximum latitude is: %8.8f/n",maxLatitude);		printf("The minimum latitude is: %8.8f/n",minLatitude);		printf("The maximum longitude is: %8.8f/n",maxLongitude);		printf("The minimum longitude is: %8.8f/n",minLongitude);	}	printf("(");	printf("%8.7f,",minLatitude-addTo);	printf("%8.7f,",minLongitude-addTo);	printf("%8.7f,",maxLatitude+addTo);	printf("%8.7f",maxLongitude+addTo);	printf(")/n");}
开发者ID:rubund,项目名称:addrnodeimport,代码行数:49,


示例2: return

char *getIDs (xmlNodePtr parentTag) {	char *retVal = NULL;	xmlNodePtr curNode;	xmlChar *tmpStr;	if (parentTag->children)		curNode=parentTag->children;	else		return (NULL);	while (curNode) {		if (curNode->type == XML_ELEMENT_NODE) {			if (strcasecmp ((char*)curNode->name, "id") == 0) {				if (xmlHasProp(curNode, (xmlChar*)"moviedb")) {					tmpStr = xmlGetProp(curNode, (xmlChar*)"moviedb");					if (strcasecmp((char*)tmpStr, "imdb") == 0) {						xmlFree (tmpStr);						tmpStr = xmlNodeGetContent(curNode);						retVal = strdup ((char*)tmpStr);						xmlFree (tmpStr);						return (retVal);					}					else						xmlFree (tmpStr);				}			}		}		curNode=curNode->next;	}	return (NULL);}
开发者ID:theknurz,项目名称:yamj-ro-suite,代码行数:31,


示例3: put

bool ParticleParser::put(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur){  if(xmlHasProp(cur, (const xmlChar *) "file"))  {    const char* fname    =(const char*)(xmlGetProp(cur, (const xmlChar *) "file"));    string pformat = getExtension(fname);    if(pformat == "xml")    {      XMLParticleParser aHandle(ref_);      return  aHandle.put(fname);    }    else    {      WARNMSG("Using old formats")      ifstream fin(fname);      if(fin)      {        ParticleInputFactory::createParticle(ref_,fin);      }      else      {        ERRORMSG("File " << fname << "is not found.");      }      return true;    }  }  XMLParticleParser aHandle(ref_);  aHandle.put(doc,ns,cur);  return false;}
开发者ID:digideskio,项目名称:qmcpack,代码行数:31,


示例4: xmlHasProp

/** * Returns the attribute with the specified name in no namespace, or null if * this element does not have an attribute with that name in no namespace. * @param name the name of the attribute . * @return the attribute of this element with the specified name. */Attribute *Element::getAttribute(String name) {	xmlAttr *attr = xmlHasProp(NODE(node), name);	if(!attr)		return 0;	else		return static_cast<Attribute *>(get(attr));}
开发者ID:alexjordan,项目名称:otawa,代码行数:13,


示例5: xmlelem_removeAttribute

static HRESULT WINAPI xmlelem_removeAttribute(IXMLElement *iface, BSTR strPropertyName){    xmlelem *This = impl_from_IXMLElement(iface);    xmlChar *name;    xmlAttrPtr attr;    int res;    HRESULT hr = S_FALSE;    TRACE("(%p, %s)/n", iface, debugstr_w(strPropertyName));    if (!strPropertyName)        return E_INVALIDARG;    name = xmlChar_from_wchar(strPropertyName);    attr = xmlHasProp(This->node, name);    if (!attr)        goto done;    res = xmlRemoveProp(attr);    if (res == 0)        hr = S_OK;done:    HeapFree(GetProcessHeap(), 0, name);    return hr;}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:27,


示例6: osync_xml_node_remove_unknown_mark

void osync_xml_node_remove_unknown_mark(xmlNode *node){	xmlAttr *attr = xmlHasProp(node, (xmlChar*)"Type");	if (!attr)		return;	xmlRemoveProp(attr);}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:7,


示例7: GetNodeFromXPath

int CXML::GetAttrPtr(const char *a_chPath, const char *a_chAttrName, int nIndex, xmlAttrPtr *a_stAttrPtr){		int nRet = XML_OK;		int i = 0;		xmlAttrPtr pAttr = NULL;		xmlAttrPtr pFindAttr = NULL;		xmlNodePtr pNode = NULL;		nRet = GetNodeFromXPath(a_chPath, &pNode);		if(nRet != XML_OK){				XML_LOG(XML_ERR,"Node not exist(ret=%d, path=%s, attrName=%s)/n",nRet, a_chPath, a_chAttrName);				return nRet;		}		pAttr = xmlHasProp(pNode, (const xmlChar*)a_chAttrName);		if(nIndex < 1){				nIndex = 1;		}		for(i=1;(pAttr != NULL);pAttr=pAttr->next){				if(strcasecmp((const char*)pAttr->name,a_chAttrName) == 0){						if(nIndex == i){								*a_stAttrPtr = pAttr;								return XML_OK;						}						else {								i++;						}				}		}		XML_LOG(XML_ERR,"Attribute not exit(path=%s, attrName=%s, index=%d)/n",a_chPath, a_chPath, nIndex);		return XML_ATTR_NOT_EXIT;}
开发者ID:Ntels-sup,项目名称:SRC_ATOM_BE,代码行数:34,


示例8: xmlDocGetRootElement

voidThreadedBlock::postInvoke(Context *ctx, InvokeContext *invoke_ctx) {    Block::postInvoke(ctx, invoke_ctx);    if (invoke_ctx->error()) {        return;    }    bool show_elapsed_time = trb_data_->check_elapsed_time_ ? trb_data_->check_elapsed_time_ :    OperationMode::instance()->checkDevelopmentVariable(ctx->request(), ThreadedBlockData::SHOW_ELAPSED_TIME);           if (!show_elapsed_time || tagged()) {        return;    }        xmlNodePtr node = xmlDocGetRootElement(invoke_ctx->resultDoc().get());    if (NULL == node) {        return;    }        const xmlChar* elapsed_attr = (const xmlChar*)"elapsed-time";    std::string elapsed = boost::lexical_cast<std::string>(0.001*ctx->timer().elapsed());    if (xmlHasProp(node, elapsed_attr) &&        xmlUnsetProp(node, elapsed_attr) < 0) {        log()->error("Cannot unset elapsed-time attribute");        return;    }    xmlNewProp(node, elapsed_attr, (const xmlChar*)elapsed.c_str());}
开发者ID:bacek,项目名称:xscript,代码行数:28,


示例9: rss_parse_document

void rss_parse_document(RSS* rss, xmlDocPtr doc) {	xmlNodePtr node;	// Get the root node	if (!rss->errno && (node = xmlDocGetRootElement(doc)) == NULL)		rss->errno = RSS_E_UNABLE_TO_PARSE;	// Make sure it's an RSS document	if (!rss->errno && node->ns == NULL && xmlStrcmp(node->name, (xmlChar*)"rss"))		rss->errno = RSS_E_FILE_NOT_RSS;	// Get the version number	if (!rss->errno && xmlHasProp(node, (xmlChar*)"version")) {		char *version = (char*)xmlGetProp(node, (xmlChar*)"version");		rss->version = atof(version);		free(version);		if (rss->version != 0.91				&& rss->version != 0.92				&& rss->version != 2.0)			rss->errno = RSS_E_FILE_NOT_RSS;	}	else if (!rss->errno)		rss->errno = RSS_E_FILE_NOT_RSS;	// Make sure the channel element exists	if (!rss->errno			&& (node = node->children) != NULL			&& node->ns == NULL			&& xmlStrcmp(node->name, (xmlChar*)"channel"))		rss->errno = RSS_E_FILE_NOT_RSS;	// Get the various channel attributes	rss->errno = !rss->errno ? rss_parse_channel(rss, doc, node) : rss->errno;}
开发者ID:Xertoz,项目名称:librss,代码行数:35,


示例10: parse_avt

static int parse_avt(elcgen *gen, xmlNodePtr n, const char *attr,                     expression **expr, int required, expression *pnode){  char *value;  char *tmp;  assert(pnode->xmlnode == n);  if (!xmlHasProp(n,attr)) {    *expr = NULL;    if (required)      return gen_error(gen,"%s element missing %s attribute",n->name,attr);    else      return 1;  }  value = xmlGetProp(n,attr);  if (gen->ispattern && (!strncmp(value,"#E",2))) {    *expr = new_expression(XPATH_DSVAR);    (*expr)->str = strdup(value+1);  }  else {    tmp = (char*)malloc(strlen(value)+3);    sprintf(tmp,"}%s{",value);    *expr = parse_xpath(gen,pnode,tmp);    free(tmp);  }  free(value);  return (NULL != *expr);}
开发者ID:amirsalah,项目名称:cs2007,代码行数:29,


示例11: xmlParseFile

string Funcionality::getValue(){    string url=host+devicesURL+"/device/"+to_string<int>(id_padre)+"/read/"+getName();    string dev="";    xmlDocPtr doc;    doc = xmlParseFile(url.c_str());    if (doc == NULL)    {        std::cerr<<"Error: imposible parsear "+url<<std::endl;        exit(-1);    }    xmlNode *root = NULL;    root = xmlDocGetRootElement(doc);    if( !root || !root->name || xmlStrcmp(root->name,(const xmlChar *)"response") )    {        xmlFreeDoc(doc);        std::cerr<<"Error: No existe elemento root o problemas con la etiqueta de respuesta."<<std::endl;        exit(-1);    }    xmlNode *cur_node, *child_node, *child_func;    bool encontrado=false;    for(cur_node = root->children; cur_node != NULL; cur_node = cur_node->next)    {        if ( cur_node->type == XML_ELEMENT_NODE  && !xmlStrcmp(cur_node->name, (const xmlChar *) "value" ))        {            if(xmlHasProp(cur_node,(const xmlChar *) "type"))            {                if(strcmp((char *)xmlGetProp(cur_node,(xmlChar *)"type"),"error")==0)                {                    dev="Error.";                }                else                {                    dev=(char *)xmlNodeGetContent(cur_node);                }            }        }    }    //xmlFreeNode(cur_node);    //xmlFreeNode(child_node);    //xmlFreeNode(root);    //xmlFreeNode(child_func);    //xmlFreeDoc(doc);    xmlCleanupParser();    return dev;}
开发者ID:msempere,项目名称:AISoy1-DAI-WebServices,代码行数:59,


示例12: infc_session_proxy_handle_user_join

static gbooleaninfc_session_proxy_handle_user_join(InfcSessionProxy* proxy,                                    InfXmlConnection* connection,                                    xmlNodePtr xml,                                    GError** error){  InfcSessionProxyPrivate* priv;  InfSessionClass* session_class;  GArray* array;  InfUser* user;  GParameter* param;  guint i;  priv = INFC_SESSION_PROXY_PRIVATE(proxy);  session_class = INF_SESSION_GET_CLASS(priv->session);  array = session_class->get_xml_user_props(priv->session, connection, xml);  /* Set local flag if the join was requested by us (seq is present in   * server response). */  param = inf_session_get_user_property(array, "flags");  g_assert(!G_IS_VALUE(&param->value)); /* must not have been set already */  g_value_init(&param->value, INF_TYPE_USER_FLAGS);  if(xmlHasProp(xml, (const xmlChar*)"seq") != NULL)    g_value_set_flags(&param->value, INF_USER_LOCAL);  else    g_value_set_flags(&param->value, 0);  /* Set connection. If none was given, use publisher connection */  param = inf_session_get_user_property(array, "connection");  if(!G_IS_VALUE(&param->value))  {    g_value_init(&param->value, INF_TYPE_XML_CONNECTION);    g_value_set_object(&param->value, G_OBJECT(connection));  }  /* This validates properties */  user = inf_session_add_user(    priv->session,    (const GParameter*)array->data,    array->len,    error  );  for(i = 0; i < array->len; ++ i)    g_value_unset(&g_array_index(array, GParameter, i).value);  g_array_free(array, TRUE);  if(user != NULL)  {    infc_session_proxy_succeed_user_request(proxy, xml, user);    return TRUE;  }  else  {    return FALSE;  }}
开发者ID:pkern,项目名称:infinote,代码行数:59,


示例13: key_eh

/* * call-seq: *  key?(attribute) * * Returns true if +attribute+ is set */static VALUE key_eh(VALUE self, VALUE attribute){  xmlNodePtr node;  Data_Get_Struct(self, xmlNode, node);  if(xmlHasProp(node, (xmlChar *)StringValuePtr(attribute)))    return Qtrue;  return Qfalse;}
开发者ID:2GenRepo,项目名称:ecosynthetix,代码行数:14,


示例14: remove_prop

/* *  call-seq: *    remove_attribute(property) * *  remove the property +property+ */static VALUE remove_prop(VALUE self, VALUE property){  xmlNodePtr node;  xmlAttrPtr attr ;  Data_Get_Struct(self, xmlNode, node);  attr = xmlHasProp(node, (xmlChar *)StringValuePtr(property));  if (attr) { xmlRemoveProp(attr); }  return Qnil;}
开发者ID:daustin,项目名称:analysis-xml-processor,代码行数:15,


示例15: _hasAttribute

// boolean hasAttribute(in DOMString name) raises(DOMException);static void _hasAttribute(Request& r, MethodParams& params) {	const xmlChar* name=as_xmlname(r, params, 0);	VXnode& vnode=GET_SELF(r, VXnode);	xmlNode& element=get_self_element(vnode);	// @todo: when name="xmlns"	// write out result	r.write_no_lang(VBool::get(xmlHasProp(&element, name)!=0));}
开发者ID:viatsko,项目名称:parser3,代码行数:11,


示例16: HasAttribute

bool SXmlNode::HasAttribute(const std::string& name){    if(!_node)        return false;    if(xmlHasProp(_node, (const xmlChar *)(name.c_str())))        return true;    return false;}
开发者ID:xjtukanif,项目名称:ScribeTool,代码行数:10,


示例17: attr

/* * call-seq: *   attribute(name) * * Get the attribute node with +name+ */static VALUE attr(VALUE self, VALUE name){  xmlNodePtr node;  xmlAttrPtr prop;  Data_Get_Struct(self, xmlNode, node);  prop = xmlHasProp(node, (xmlChar *)StringValuePtr(name));  if(! prop) return Qnil;  return Nokogiri_wrap_xml_node((xmlNodePtr)prop);}
开发者ID:jmhodges,项目名称:nokogiri,代码行数:16,


示例18: getXmlStringProp

std::string getXmlStringProp(xmlNode* xmlNode, const char* xmlLabel, std::string defVal){  std::string     value = defVal;  if ( xmlHasProp(xmlNode, (xmlChar*) xmlLabel) ) {    xmlChar* xc = xmlGetProp(xmlNode, (xmlChar*) xmlLabel);    value = (char*) xc;    xmlFree(xc);  }  return value;}
开发者ID:Wittyshare,项目名称:gdcore,代码行数:10,


示例19: getXmlDoubleProp

double getXmlDoubleProp(xmlNode* xmlNode, const char* xmlLabel, double defVal){  double          value = defVal;  if ( xmlHasProp(xmlNode, (xmlChar*) xmlLabel) ) {    xmlChar* xc = xmlGetProp(xmlNode, (xmlChar*) xmlLabel);    value = atof((const char*) xc);    xmlFree(xc);  }  return value;}
开发者ID:Wittyshare,项目名称:gdcore,代码行数:10,


示例20: xmlParseFile

bool Scene::getResponse(string url){    bool dev=false;    xmlDocPtr doc;    doc = xmlParseFile(url.c_str());    if (doc == NULL)    {        cerr<<"Error: imposible parsear "+url<<std::endl;        exit(-1);    }    xmlNode *root = NULL;    root = xmlDocGetRootElement(doc);    string string_temp="";    if( !root || !root->name || xmlStrcmp(root->name,(const xmlChar *)"response") )    {        xmlFreeDoc(doc);        std::cerr<<"Error: No existe elemento root o problemas con la etiqueta de respuesta de scenes."<<std::endl;        exit(-1);    }    xmlNode *cur_node;    for(cur_node = root->children; cur_node != NULL; cur_node = cur_node->next)    {        if ( cur_node->type == XML_ELEMENT_NODE  && !xmlStrcmp(cur_node->name, (const xmlChar *) "value" ))        {            if(xmlHasProp(cur_node,(const xmlChar *) "type"))            {                if(strcmp((char *)xmlGetProp(cur_node,(xmlChar *)"type"),"error")==0)                {                }                else                {                    string_temp=(char *)xmlNodeGetContent(cur_node);                    if(string_temp=="true")                        dev=true;                }            }        }    }    xmlFreeDoc(doc);    xmlCleanupParser();    return dev;}
开发者ID:msempere,项目名称:AISoy1-DAI-WebServices,代码行数:55,


示例21: xmlHasProp

const char *XMLAttr::getAttributeValue(const char *name) const{    xmlNode *node = elem.getRealNode();    xmlAttr *attrs = xmlHasProp(node, (const xmlChar *)name);    if (attrs)    {        return (const char *)attrs->children->content;    }    return 0;}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:11,


示例22: getXmlBoolProp

bool getXmlBoolProp(xmlNode* xmlNode, const char* xmlLabel, bool defVal){  bool            value = defVal;  if ( xmlHasProp(xmlNode, (xmlChar*) xmlLabel) ) {    xmlChar* xc = xmlGetProp(xmlNode, (xmlChar*) xmlLabel);    if ( !strcmp((const char*) xc, "1") || !strcmp((const char*) xc, "true") )      value = true;    xmlFree(xc);  }  return value;}
开发者ID:Wittyshare,项目名称:gdcore,代码行数:11,


示例23: element__attr

Attr *element__attr( Element *el, unsigned char *attr_name, unsigned char *namespace_uri ){    xmlAttr *attr;    if ( namespace_uri )        attr = xmlHasNsProp( ( xmlNode* ) el, attr_name, namespace_uri ) ;    else        attr = xmlHasProp( ( xmlNode* ) el, attr_name ) ;    return ( Attr* ) attr ;}
开发者ID:joshsh,项目名称:archive,代码行数:12,


示例24: osync_assert

const char *osync_xmlfield_get_attr(OSyncXMLField *xmlfield, const char *attr){  xmlAttrPtr prop;  osync_assert(xmlfield);  osync_assert(attr);	  prop = xmlHasProp(xmlfield->node, BAD_CAST attr);  if(prop == NULL)    return NULL;  return (const char *)osync_xml_attr_get_content(prop);  //	return (const char *)prop->children->content;  //	return (const char *)xmlGetProp(xmlfield->node, BAD_CAST attr);}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:14,


示例25: assign_id_attributes

int assign_id_attributes(xmlDocPtr doc) {  // Assume the ID attribute is one of (ID | Id | id) and tell this to libxml  xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc);  if(xpathCtx == NULL) {	  xmlFreeDoc(doc); 	  rb_raise(rb_eRuntimeError,"Error: unable to create new XPath context/n");	  return(-1);  }  xmlChar* xpathExpr = "//*[@ID | @Id | @id]";        xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);  if(xpathObj == NULL) {	  xmlXPathFreeContext(xpathCtx); 	  xmlFreeDoc(doc); 	  rb_raise(rb_eRuntimeError,"Error: unable to evaluate xpath expression /"%s/"/n", xpathExpr);	  return(-1);  }  xmlNodeSetPtr nodes = xpathObj->nodesetval;  int size = (nodes) ? nodes->nodeNr : 0;  char* idNames[] = {"ID", "Id", "id"};  xmlAttrPtr attr, tmp;  int i,j;  for(i = 0; i < size; i++) {	  for(j=0; j<3;j++) {	  	tmp = xmlHasProp(nodes->nodeTab[i], idNames[j]);		if(tmp != NULL)			attr = tmp;	  }	  if(attr == NULL) {		xmlXPathFreeContext(xpathCtx); 		return(-1);  	 }	 xmlChar* name = xmlNodeListGetString(doc, attr->children, 1);	 if(name == NULL) {		xmlXPathFreeContext(xpathCtx); 		return(-1);	 }	 xmlAttrPtr tmp = xmlGetID(doc, name);	 if(tmp != NULL) {		 xmlFree(name);		 return 0;	 }	 xmlAddID(NULL, doc, name, attr);	 xmlFree(name);  }  xmlXPathFreeObject(xpathObj);  xmlXPathFreeContext(xpathCtx);}
开发者ID:pederbl,项目名称:xmlsec-ruby,代码行数:49,



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


C++ xmlHashLookup函数代码示例
C++ xmlGetProp函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。