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

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

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

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

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

示例1: processDoc

static int processDoc(xmlDoc *doc, lpc2xml_context *ctx) {	int ret = 0;	xmlNs *xsi_ns;	xmlNs *lpc_ns;	xmlAttr *schemaLocation;	xmlNode *root_node = xmlNewNode(NULL, (const xmlChar *)"config");	if(root_node == NULL) {		lpc2xml_log(ctx, LPC2XML_ERROR, "Can't create /"config/" element");		return -1;	}	lpc_ns = xmlNewNs(root_node, (const xmlChar *)"http://www.linphone.org/xsds/lpconfig.xsd", NULL);	if(lpc_ns == NULL) {		lpc2xml_log(ctx, LPC2XML_WARNING, "Can't create lpc namespace");	} else {		xmlSetNs(root_node, lpc_ns);	}	xsi_ns = xmlNewNs(root_node, (const xmlChar *)"http://www.w3.org/2001/XMLSchema-instance", (const xmlChar *)"xsi");	if(lpc_ns == NULL) {		lpc2xml_log(ctx, LPC2XML_WARNING, "Can't create xsi namespace");	}	schemaLocation = xmlNewNsProp(root_node, xsi_ns, (const xmlChar *)"schemaLocation", (const xmlChar *)"http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd");	if(schemaLocation == NULL) {		lpc2xml_log(ctx, LPC2XML_WARNING, "Can't create schemaLocation");	}	ret = processConfig(root_node, ctx);	xmlDocSetRootElement(doc, root_node);	return ret;}
开发者ID:Accontech,项目名称:ace-ios,代码行数:28,


示例2: get_xmlNode

static xmlNode*get_xmlNode(LassoNode *node, gboolean lasso_dump){    xmlNode *xmlnode, *t;    xmlnode = parent_class->get_xmlNode(node, lasso_dump);    if (LASSO_SAMLP_RESPONSE(node)->Status &&            has_lib_status(LASSO_SAMLP_RESPONSE(node)->Status->StatusCode)) {        /* liberty QName, add liberty namespace */        xmlNewNs(xmlnode, (xmlChar*)LASSO_LIB_HREF, (xmlChar*)LASSO_LIB_PREFIX);    }    for (t = xmlnode->children; t && strcmp((char*)t->name, "Assertion"); t = t->next) ;    if (t && strcmp((char*)t->ns->href, LASSO_LIB_HREF) == 0) {        /* liberty nodes are not allowed in samlp nodes */        xmlSetNs(t, xmlNewNs(xmlnode, (xmlChar*)LASSO_SAML_ASSERTION_HREF,                             (xmlChar*)LASSO_SAML_ASSERTION_PREFIX));        if (xmlHasNsProp(t, (xmlChar*)"type", (xmlChar*)LASSO_XSI_HREF) == NULL)            xmlNewNsProp(t, xmlNewNs(xmlnode,                                     (xmlChar*)LASSO_XSI_HREF,                                     (xmlChar*)LASSO_XSI_PREFIX),                         (xmlChar*)"type", (xmlChar*)"lib:AssertionType");    }    return xmlnode;}
开发者ID:pombredanne,项目名称:lasso,代码行数:29,


示例3: slaxSetNs

/* * Find or construct a (possibly temporary) namespace node * for the "func" exslt library and put the given node into * that namespace.  We also have to add this as an "extension" * namespace. */static xmlNsPtrslaxSetNs (slax_data_t *sdp, xmlNodePtr nodep,	   const char *prefix, const xmlChar *uri, int local){    xmlNsPtr nsp;    xmlNodePtr root = xmlDocGetRootElement(sdp->sd_docp);    nsp = xmlSearchNs(sdp->sd_docp, root, (const xmlChar *) prefix);    if (nsp == NULL) {	nsp = xmlNewNs(root, uri, (const xmlChar *) prefix);	if (nsp == NULL) {	    xmlParserError(sdp->sd_ctxt, "%s:%d: out of memory",			   sdp->sd_filename, sdp->sd_line);	    return NULL;	}	/*	 * Since we added this namespace, we need to add it to the	 * list of extension prefixes.	 */	slaxNodeAttribExtend(sdp, root,			     ATT_EXTENSION_ELEMENT_PREFIXES, prefix, NULL);    }    if (nodep) {	/* Add a distinct namespace to the current node */	nsp = xmlNewNs(nodep, uri, (const xmlChar *) prefix);	if (local)	    nodep->ns = nsp;    }    return nsp;}
开发者ID:aruns16,项目名称:libslax,代码行数:39,


示例4: xsltCopyNamespace

/** * xsltCopyNamespace: * @ctxt:  a transformation context * @node:  the target node * @cur:  the namespace node * * Do a copy of an namespace node. If @node is non-NULL the * new namespaces are added automatically. This handles namespaces * aliases * * Returns: a new xmlNsPtr, or NULL in case of error. */xmlNsPtrxsltCopyNamespace(xsltTransformContextPtr ctxt, xmlNodePtr node,	          xmlNsPtr cur) {    xmlNsPtr ret = NULL;    const xmlChar *URI;    if (cur == NULL)	return(NULL);    if (cur->type != XML_NAMESPACE_DECL)	return(NULL);    /*     * One can add namespaces only on element nodes     */    if ((node != NULL) && (node->type != XML_ELEMENT_NODE))	node = NULL;    if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) {	URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases,					      cur->href);	if (URI != NULL) {	    ret = xmlNewNs(node, URI, cur->prefix);	} else {	    ret = xmlNewNs(node, cur->href, cur->prefix);	}    }    return(ret);}
开发者ID:gitpan,项目名称:AxKit-Needs,代码行数:40,


示例5: msWFSException11

int msWFSException11(mapObj *map, const char *locator,                     const char *exceptionCode, const char *version){  int size = 0;  char *errorString     = NULL;  char *errorMessage    = NULL;  char *schemasLocation = NULL;  const char *encoding;  xmlDocPtr  psDoc      = NULL;  xmlNodePtr psRootNode = NULL;  xmlNsPtr   psNsOws    = NULL;  xmlChar *buffer       = NULL;  if (version == NULL)    version = "1.1.0";  psNsOws = xmlNewNs(NULL, BAD_CAST "http://www.opengis.net/ows", BAD_CAST "ows");  encoding = msOWSLookupMetadata(&(map->web.metadata), "FO", "encoding");  errorString = msGetErrorString("/n");  errorMessage = msEncodeHTMLEntities(errorString);  schemasLocation = msEncodeHTMLEntities(msOWSGetSchemasLocation(map));  psDoc = xmlNewDoc(BAD_CAST "1.0");  psRootNode = msOWSCommonExceptionReport(psNsOws, OWS_1_0_0, schemasLocation, version, msOWSGetLanguage(map, "exception"), exceptionCode, locator, errorMessage);  xmlDocSetRootElement(psDoc, psRootNode);  xmlNewNs(psRootNode, BAD_CAST "http://www.opengis.net/ows", BAD_CAST "ows");  if (encoding)    msIO_setHeader("Content-Type","text/xml; charset=%s", encoding);  else    msIO_setHeader("Content-Type","text/xml");  msIO_sendHeaders();  xmlDocDumpFormatMemoryEnc(psDoc, &buffer, &size, (encoding ? encoding : "ISO-8859-1"), 1);  msIO_printf("%s", buffer);  /*free buffer and the document */  free(errorString);  free(errorMessage);  free(schemasLocation);  xmlFree(buffer);  xmlFreeDoc(psDoc);  xmlFreeNs(psNsOws);  /* clear error since we have already reported it */  msResetErrorList();  return MS_FAILURE;}
开发者ID:lydonchandra,项目名称:MapServer-SpeedUp,代码行数:56,


示例6: soup_soap_message_persist

voidsoup_soap_message_persist (SoupSoapMessage *msg){	g_return_if_fail (SOUP_SOAP_IS_MESSAGE (msg));	xmlChar *buffer;	const gchar *contents;	SoupSoapMessagePrivate *priv = msg->priv;	xmlDocPtr doc = xmlNewDoc (BAD_CAST "1.0");	xmlNodePtr envelope_node = xmlNewNode (NULL, BAD_CAST "Envelope");	xmlSetNs (envelope_node,	          xmlNewNs (envelope_node,	                    BAD_CAST SOAP_ENV_NAMESPACE,	                    BAD_CAST "SOAP-ENV"));	xmlNewNs (envelope_node,	          BAD_CAST XSD_NAMESPACE,	          BAD_CAST "xsd");	xmlNewNs (envelope_node,	          BAD_CAST XSI_NAMESPACE,	          BAD_CAST "xsi");	xmlNewNs (envelope_node,	          BAD_CAST SOAP_ENC_NAMESPACE,	          BAD_CAST "SOAP-ENC");	xmlSetProp (envelope_node,	            BAD_CAST "SOAP-ENV:encodingStyle",	            BAD_CAST SOAP_ENCODING_STYLE);	xmlDocSetRootElement (doc, envelope_node);	create_param_node (doc, SOUP_SOAP_PARAM (priv->header), envelope_node);	xmlNodePtr body_node = xmlNewChild (envelope_node, NULL, BAD_CAST "Body", NULL);	create_param_node (doc, SOUP_SOAP_PARAM (priv->body), body_node);	xmlDocDumpFormatMemoryEnc (doc, &buffer, NULL, "UTF-8", 0);	contents = (gchar *) buffer;	soup_message_body_truncate (priv->message_body);	soup_message_body_append (priv->message_body, SOUP_MEMORY_COPY,	                          contents, strlen (contents));	soup_message_body_complete (priv->message_body);	xmlFree (buffer);	xmlFreeDoc (doc);	soup_message_headers_set_content_type (priv->message_headers,	                                       "text/xml", NULL);}
开发者ID:kyoushuu,项目名称:libsoup-soap,代码行数:55,


示例7: xmpp_ball_start_rolling

void xmpp_ball_start_rolling(struct xmpp_server *xs){	/* Fuck it */	xmpp_printf(xs,"<stream:stream xmlns:stream=/"http://etherx.jabber.org/streams/" xmlns=/"jabber:client/" to=/"%s/" version=/"1.0/">/n", xs->label);#ifdef CLOWNS	xmlDocPtr  doc       = NULL;/* document pointer */	xmlNodePtr root_node = NULL;	xmlNodePtr node      = NULL;	xmlNodePtr node1     = NULL;/* node pointers */	xmlNsPtr   ns_stream = NULL;	xmlNsPtr   ns_jabber = NULL;	/* Well commented because libxml2 is a mindfuck */	/* Starts the document with xml 1.0 */	doc = xmlNewDoc(BAD_CAST "1.0");	/* Create the root node */	root_node = xmlNewNode(NULL, BAD_CAST "stream");	/* Create the stream namespace */	ns_stream = xmlNewNs(root_node,			/* Hardcode OK */			BAD_CAST "http://etherx.jabber.org/streams",			/* Hardcode OK */			BAD_CAST "stream");	/* Create the jabber namespace */	ns_jabber = xmlNewNs(root_node,			/* Hardcode OK */			BAD_CAST "jabber:client",			NULL);	/* Make the node I just created the first node in the document */	xmlDocSetRootElement(doc, root_node);	/* Name of the server, should probably go off sslserver or server tag in conf */	xmlNewProp(root_node, BAD_CAST "to", BAD_CAST xs->label);	/* I need to meet the requirements of RFC 3920 for this */	xmlNewProp(root_node, BAD_CAST "version", BAD_CAST "1.0");	/* Sends XML Packet */	xmpp_xml_send(xs, doc);	/* We don't need it anymore */	xmlFreeDoc(doc);	return;#endif /* CLOWNS */}
开发者ID:Estella,项目名称:trollbot,代码行数:51,


示例8: xsltCopyNamespace

/** * xsltCopyNamespace: * @ctxt:  a transformation context * @elem:  the target element node * @ns:  the namespace node * * Copies a namespace node (declaration). If @elem is not NULL, * then the new namespace will be declared on @elem. * * Returns: a new xmlNsPtr, or NULL in case of an error. */xmlNsPtrxsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,		  xmlNodePtr elem, xmlNsPtr ns){    if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))	return(NULL);    /*     * One can add namespaces only on element nodes     */    if ((elem != NULL) && (elem->type != XML_ELEMENT_NODE))	return(xmlNewNs(NULL, ns->href, ns->prefix));    else	return(xmlNewNs(elem, ns->href, ns->prefix));}
开发者ID:GYGit,项目名称:reactos,代码行数:25,


示例9: add_album_art

static void add_album_art(xmlNodePtr node, int64_t cover_id, query_t * q)  {  bg_db_object_t * cover;  bg_db_object_t * cover_thumb;   char * tmp_string;  xmlNodePtr child;  cover = bg_db_object_query(q->db, cover_id);  cover_thumb = bg_db_get_thumbnail(q->db, cover_id, 160, 160, "image/jpeg");  /* Cover thumbnail */  if(cover_thumb)    {    tmp_string = bg_sprintf("%smedia/%"PRId64, q->dev->url_base, bg_db_object_get_id(cover_thumb));    child = bg_didl_add_element_string(q->didl, node, "upnp:albumArtURI", tmp_string, NULL);    free(tmp_string);    if(child)      {      xmlNsPtr dlna_ns;      dlna_ns = xmlNewNs(child,                         (xmlChar*)"urn:schemas-dlna-org:metadata-1-0/",                         (xmlChar*)"dlna");      xmlSetNsProp(child, dlna_ns, (const xmlChar*)"profileID", (const xmlChar*)"JPEG_TN");      }    bg_db_object_unref(cover_thumb);    }  /* Original size */  tmp_string = bg_sprintf("%smedia/%"PRId64, q->dev->url_base, cover_id);   child = bg_didl_add_element_string(q->didl, node, "upnp:albumArtURI", tmp_string, NULL);  free(tmp_string);    if(child)    {    const char * dlna_id;    xmlNsPtr dlna_ns;    dlna_id = get_dlna_image_profile(cover);           if(dlna_id)      {      dlna_ns = xmlNewNs(child,                         (xmlChar*)"urn:schemas-dlna-org:metadata-1-0/",                         (xmlChar*)"dlna");      xmlSetNsProp(child, dlna_ns, (const xmlChar*)"profileID", (const xmlChar*)dlna_id);      }    }  bg_db_object_unref(cover);  }
开发者ID:Jheengut,项目名称:gmerlin,代码行数:48,


示例10: xmlNewDocNode

 xmlNode* child_node_list::create_element_(const std::string& qname, const std::string& uri) {     // Split QName into prefix and local name.     std::pair<std::string, std::string> name_pair = detail::split_qname(qname);     const std::string& prefix = name_pair.first;     const std::string& name = name_pair.second;     // Create element without namespace.     xmlNode* px = xmlNewDocNode( raw_->doc,                                  0,                                  detail::to_xml_chars(name.c_str()),                                  0 );     if (px == 0)     {         std::string what = "fail to create libxml2 element node for " + name;         throw internal_dom_error(what);     }     // Declare XML namespace on the element, and put the element under it.     xmlNs* ns = xmlNewNs( px,                           detail::to_xml_chars(uri.c_str()),                           prefix.empty() ? 0 : detail::to_xml_chars(prefix.c_str()) );     if (ns == 0)     {         // TODO: delete the node.         std::string what = "fail to create libxml2 namespace for " + prefix + "=" + uri;         throw internal_dom_error(what);     }     xmlSetNs(px, ns);     // Return the new element.     return px; }
开发者ID:zhengzhong,项目名称:xtree,代码行数:30,


示例11: insure_namespace

static voidinsure_namespace(xmlNode *xmlnode, xmlNs *ns){	/* insure children are kept in saml namespace */	xmlNode *t;	xmlNs *xsi_ns;	t = xmlnode->children;	while (t) {		if (t->type != XML_ELEMENT_NODE) {			t = t->next;			continue;		}		if (xmlnode->ns && strcmp((char*)xmlnode->ns->href, LASSO_LIB_HREF) == 0) {			char *typename, *gtypename;			GType gtype;			typename = g_strdup_printf("lib:%sType", xmlnode->name);			gtypename = g_strdup_printf("LassoSaml%s", xmlnode->name);			gtype = g_type_from_name(gtypename);			if (gtype) {				xmlSetNs(xmlnode, ns);				if (xmlHasNsProp(t, (xmlChar*)"type",							(xmlChar*)LASSO_XSI_HREF) == NULL) {					xsi_ns = xmlNewNs(xmlnode, (xmlChar*)LASSO_XSI_HREF,							(xmlChar*)LASSO_XSI_PREFIX);					xmlNewNsProp(xmlnode, xsi_ns, (xmlChar*)"type",							(xmlChar*)typename);				}			}			lasso_release(gtypename);			lasso_release(typename);		}
开发者ID:cascadeo,项目名称:lasso,代码行数:35,


示例12: gss_config_append_config_file

static voidgss_config_append_config_file (GString * s){  GList *g;  xmlNsPtr ns;  xmlDocPtr doc;  doc = xmlNewDoc ((xmlChar *) "1.0");  doc->xmlRootNode = xmlNewDocNode (doc, NULL, (xmlChar *) "oberon", NULL);  ns = xmlNewNs (doc->xmlRootNode,      (xmlChar *) "http://entropywave.com/oberon/1.0/", (xmlChar *) "ew");  for (g = config_list; g; g = g_list_next (g)) {    GObject *object = g->data;    gss_config_dump_object (object, ns, doc->xmlRootNode);  }  {    xmlChar *str;    int len;    xmlDocDumpFormatMemory (doc, &str, &len, 1);    g_string_append (s, (char *) str);    xmlFree (str);  }  xmlFreeDoc (doc);}
开发者ID:SuchangKo,项目名称:gst-stream-server,代码行数:29,


示例13: new_xml_doc

/* * Create new document and edit document handlers */static int new_xml_doc(lua_State *L) {	const char *name = lua_tostring(L, 1);	const char *ns_href = lua_tostring(L, 2);	xmlNsPtr ns = NULL;	if (name == NULL) return luaL_error(L, "new_xml_doc needs name of root node.");	/**	 * http://www.acooke.org/cute/Usinglibxm0.html was very helpful with this issue	 */	xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); //create document	xmlNodePtr root_node = xmlNewNode(NULL, BAD_CAST name); //create root node	if (doc == NULL || root_node == NULL) return luaL_error(L, "New document allocation error.");	if (ns_href != NULL) { //if NS is requested		ns = xmlNewNs(root_node, BAD_CAST ns_href, NULL);		if (ns == NULL) return luaL_error(L, "Namespace allocation error.");		xmlSetNs(root_node, ns);	}	struct xmlwrap_object *xml2 = lua_newuserdata(L, sizeof(*xml2));	luaL_setmetatable(L, WRAP_XMLDOC);	xml2->doc = doc;	xmlDocSetRootElement(xml2->doc, root_node);	return 1;}
开发者ID:CZ-NIC,项目名称:nuci,代码行数:32,


示例14: node_add_child

static int node_add_child(lua_State *L) {	xmlNodePtr node = lua_touserdata(L, 1);	const char *name = lua_tostring(L, 2);	const char *ns_href = lua_tostring(L, 3);	xmlNsPtr ns = NULL;	if (node == NULL) return luaL_error(L, "add_child: Invalid parent node");	if (node->type != XML_ELEMENT_NODE) return luaL_error(L, "add_child: Invalid parent node type  (not element node)");	if (name == NULL) return luaL_error(L, "I can't create node without its name");	xmlNodePtr child;	if (ns_href != NULL) { //add namespace requested		ns = xmlSearchNsByHref(node->doc, node, BAD_CAST ns_href); //try to find ns	}	if (ns_href != NULL && ns == NULL) { //ns requested and not found		child = xmlNewChild(node, ns, BAD_CAST name, NULL); //crete node w/o ns		ns = xmlNewNs(child, BAD_CAST ns_href, NULL); //create namespace and define it in child		if (ns == NULL) return luaL_error(L, "Namespace allocation error.");		xmlSetNs(child, ns); //set new ns to child	} else {		child = xmlNewChild(node, ns, BAD_CAST name, NULL); //ns nor requested ir was found... use it	}	lua_pushlightuserdata(L, child);	luaL_setmetatable(L, WRAP_XMLNODE);	return 1;}
开发者ID:CZ-NIC,项目名称:nuci,代码行数:30,


示例15: msOWSCommonOperationsMetadataOperation

xmlNodePtr msOWSCommonOperationsMetadataOperation(xmlNsPtr psNsOws, xmlNsPtr psXLinkNs, char *name, int method, char *url){  xmlNodePtr psRootNode      = NULL;  xmlNodePtr psNode          = NULL;  xmlNodePtr psSubNode       = NULL;  xmlNodePtr psSubSubNode    = NULL;  if (_validateNamespace(psNsOws) == MS_FAILURE)    psNsOws = xmlNewNs(psRootNode, BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_URI, BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_PREFIX);  psRootNode = xmlNewNode(psNsOws, BAD_CAST "Operation");  xmlNewProp(psRootNode, BAD_CAST "name", BAD_CAST name);  psNode = xmlNewChild(psRootNode, psNsOws, BAD_CAST "DCP", NULL);  psSubNode = xmlNewChild(psNode, psNsOws, BAD_CAST "HTTP", NULL);  if (method  == OWS_METHOD_GET || method == OWS_METHOD_GETPOST ) {    psSubSubNode = xmlNewChild(psSubNode, psNsOws, BAD_CAST "Get", NULL);    xmlNewNsProp(psSubSubNode, psXLinkNs, BAD_CAST "type", BAD_CAST "simple");    xmlNewNsProp(psSubSubNode, psXLinkNs, BAD_CAST "href", BAD_CAST url);  }  if (method == OWS_METHOD_POST || method == OWS_METHOD_GETPOST ) {    psSubSubNode = xmlNewChild(psSubNode, psNsOws, BAD_CAST "Post", NULL);    xmlNewNsProp(psSubSubNode, psXLinkNs, BAD_CAST "type", BAD_CAST "simple");    xmlNewNsProp(psSubSubNode, psXLinkNs, BAD_CAST "href", BAD_CAST url);  }  return psRootNode;}
开发者ID:AdRiley,项目名称:mapserver,代码行数:33,


示例16: get_xmlNode

static xmlNode*get_xmlNode(LassoNode *node, G_GNUC_UNUSED gboolean lasso_dump){	xmlNode *xmlnode;	LassoIdentity *identity = LASSO_IDENTITY(node);#ifdef LASSO_WSF_ENABLED	xmlNode *t;#endif	xmlnode = xmlNewNode(NULL, (xmlChar*)"Identity");	xmlSetNs(xmlnode, xmlNewNs(xmlnode, (xmlChar*)LASSO_LASSO_HREF, NULL));	xmlSetProp(xmlnode, (xmlChar*)"Version", (xmlChar*)"2");	/* Federations */	if (g_hash_table_size(identity->federations))		g_hash_table_foreach(identity->federations,				(GHFunc)add_childnode_from_hashtable, xmlnode);#ifdef LASSO_WSF_ENABLED	/* Resource Offerings */	g_hash_table_foreach(identity->private_data->resource_offerings_map,			(GHFunc)add_childnode_from_hashtable, xmlnode);	/* Service Metadatas IDs (svcMDID) */	if (identity->private_data->svcMDID != NULL) {		t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"SvcMDIDs", NULL);		g_list_foreach(identity->private_data->svcMDID,				(GFunc)add_text_childnode_from_list, t);	}#endif	return xmlnode;}
开发者ID:adieu,项目名称:lasso,代码行数:32,


示例17: msOWSCommonWGS84BoundingBox

xmlNodePtr msOWSCommonWGS84BoundingBox(xmlNsPtr psNsOws, int dimensions, double minx, double miny, double maxx, double maxy){  char LowerCorner[100];  char UpperCorner[100];  char dim_string[100];  xmlNodePtr psRootNode = NULL;  if (_validateNamespace(psNsOws) == MS_FAILURE)    psNsOws = xmlNewNs(psRootNode, BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_URI, BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_PREFIX);  /* create element name */  psRootNode = xmlNewNode(psNsOws, BAD_CAST "WGS84BoundingBox");  snprintf( dim_string, sizeof(dim_string), "%d", dimensions );  xmlNewProp(psRootNode, BAD_CAST "dimensions", BAD_CAST dim_string);  snprintf(LowerCorner, sizeof(LowerCorner), "%.15g %.15g", minx, miny);  snprintf(UpperCorner, sizeof(UpperCorner), "%.15g %.15g", maxx, maxy);  /* add child elements */  xmlNewChild(psRootNode, psNsOws,BAD_CAST "LowerCorner",BAD_CAST LowerCorner);  xmlNewChild(psRootNode, psNsOws,BAD_CAST "UpperCorner",BAD_CAST UpperCorner);  return psRootNode;}
开发者ID:AdRiley,项目名称:mapserver,代码行数:26,


示例18: add_project

static xmlNodePtradd_project (GPInstructProject *project){	GPInstructCategory *curr_category;	GList *categories, *curr_categories;	xmlNodePtr node = xmlNewNode (NULL, BAD_CAST "project");	xmlSetProp (node, BAD_CAST "title",	            BAD_CAST gpinstruct_project_get_title (project));	xmlSetNs (node, xmlNewNs (node,	                          BAD_CAST PACKAGE_URL,	                          BAD_CAST PACKAGE_TARNAME));	categories = gpinstruct_project_get_categories (project);	curr_categories = categories;	while (curr_categories)	{		curr_category = GPINSTRUCT_CATEGORY (curr_categories->data);		add_category (curr_category, node);		curr_categories = curr_categories->next;	}	g_list_free (categories);	return node;}
开发者ID:kyoushuu,项目名称:gpinstruct,代码行数:30,


示例19: convertNodeSetToR

//.........这里部分代码省略.........	  PROTECT(ref = mkString((el->children && el->children->content) ? XMLCHAR_TO_CHAR(el->children->content) : ""));	  SET_NAMES(ref, mkString(el->name));#else	  PROTECT(ref = ScalarString(mkCharCE((el->children && el->children->content) ? XMLCHAR_TO_CHAR(el->children->content) : "", encoding)));	  SET_NAMES(ref, ScalarString(mkCharCE(el->name, encoding)));#endif	  SET_CLASS(ref, mkString("XMLAttributeValue"));	  UNPROTECT(1);      } else if(el->type == XML_NAMESPACE_DECL)	  ref = R_createXMLNsRef((xmlNsPtr) el);      else        ref = R_createXMLNodeRef(el, manageMemory);    if(expr) {      PROTECT(ref);      SETCAR(arg, ref);      PROTECT(ref = Rf_eval(expr, R_GlobalEnv)); /*XXX do we want to catch errors here? Maybe to release the namespaces. */      SET_VECTOR_ELT(ans, i, ref);      UNPROTECT(2);    } else      SET_VECTOR_ELT(ans, i, ref);  }  if(expr) {    if(TYPEOF(fun) == CLOSXP || TYPEOF(fun) == BUILTINSXP)      UNPROTECT(1);  } else    SET_CLASS(ans, mkString("XMLNodeSet"));  UNPROTECT(1);  return(ans);}SEXPconvertXPathObjectToR(xmlXPathObjectPtr obj, SEXP fun, int encoding, SEXP manageMemory){  SEXP ans = NULL_USER_OBJECT;  switch(obj->type) {    case XPATH_NODESET:        ans = convertNodeSetToR(obj->nodesetval, fun, encoding, manageMemory);	break;    case XPATH_BOOLEAN:	ans = ScalarLogical(obj->boolval);	break;    case XPATH_NUMBER:	ans = ScalarReal(obj->floatval);	if(xmlXPathIsInf(obj->floatval))	    REAL(ans)[0] = xmlXPathIsInf(obj->floatval) < 0 ? R_NegInf : R_PosInf;        else if(xmlXPathIsNaN(obj->floatval))	    REAL(ans)[0] = NA_REAL;	break;    case XPATH_STRING:        ans = mkString(XMLCHAR_TO_CHAR(obj->stringval)); //XXX encoding 	break;    case XPATH_POINT:    case XPATH_RANGE:    case XPATH_LOCATIONSET:    case XPATH_USERS:	PROBLEM "currently unsupported xmlXPathObject type %d in convertXPathObjectToR. Please send mail to maintainer.", obj->type        WARN    default:	ans = R_NilValue;  }  return(ans);}#include <libxml/xpathInternals.h> /* For xmlXPathRegisterNs() */xmlNsPtr *R_namespaceArray(SEXP namespaces, xmlXPathContextPtr ctxt){ int i, n; SEXP names = GET_NAMES(namespaces); xmlNsPtr *els; n = GET_LENGTH(namespaces); els = xmlMallocAtomic(sizeof(xmlNsPtr) * n);   if(!els) {   PROBLEM  "Failed to allocated space for namespaces"   ERROR; } for(i = 0; i < n; i++) {/*XXX who owns these strings. */   const xmlChar *prefix, *href;   href = CHAR_TO_XMLCHAR(strdup(CHAR_DEREF(STRING_ELT(namespaces, i))));   prefix = names == NULL_USER_OBJECT ?  CHAR_TO_XMLCHAR("") /* NULL */                                       :  CHAR_TO_XMLCHAR(strdup(CHAR_DEREF(STRING_ELT(names, i))));   els[i] = xmlNewNs(NULL, href, prefix);   if(ctxt)        xmlXPathRegisterNs(ctxt, prefix, href); } return(els);}
开发者ID:jetaber,项目名称:XML,代码行数:101,


示例20: xsltGetSpecialNamespace

/** * xsltGetSpecialNamespace: * @ctxt:  a transformation context * @cur:  the input node * @URI:  the namespace URI * @prefix:  the suggested prefix * @out:  the output node (or its parent) * * Find the right namespace value for this URI, if needed create * and add a new namespace decalaration on the node * * Returns the namespace node to use or NULL */xmlNsPtrxsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur,		const xmlChar *URI, const xmlChar *prefix, xmlNodePtr out) {    xmlNsPtr ret;    static int prefixno = 1;    char nprefix[10];    if ((ctxt == NULL) || (cur == NULL) || (out == NULL) || (URI == NULL))	return(NULL);    if ((out->parent != NULL) &&	(out->parent->type == XML_ELEMENT_NODE) &&	(out->parent->ns != NULL) &&	(xmlStrEqual(out->parent->ns->href, URI)))	ret = out->parent->ns;    else	ret = xmlSearchNsByHref(out->doc, out, URI);    if (ret == NULL) {	if (prefix == NULL) {	    do {		sprintf(nprefix, "ns%d", prefixno++);		ret = xmlSearchNs(out->doc, out, (xmlChar *)nprefix);	    } while (ret != NULL);	    prefix = (const xmlChar *) &nprefix[0];	}	if (out->type == XML_ELEMENT_NODE)	    ret = xmlNewNs(out, URI, prefix);    }    return(ret);}
开发者ID:gitpan,项目名称:AxKit-Needs,代码行数:44,


示例21: xmlNewNs

EPUB3_XML_BEGIN_NAMESPACENamespace::Namespace(Document * doc, const string &prefix, const string &uri){    xmlDocPtr d = doc->xml();    _xml = xmlNewNs(reinterpret_cast<xmlNodePtr>(d), uri.utf8(), prefix.utf8());}
开发者ID:becka11y,项目名称:readium-sdk,代码行数:7,


示例22: g_assert

gchar *midgard_core_object_to_xml(GObject *object){	g_assert(object);		xmlDocPtr doc = NULL; 	xmlNodePtr root_node = NULL;			LIBXML_TEST_VERSION;			doc = xmlNewDoc(BAD_CAST "1.0");	root_node = xmlNewNode(NULL, 			BAD_CAST "midgard_object");	xmlNewNs(root_node,			BAD_CAST MIDGARD_OBJECT_HREF,			NULL);	xmlNodePtr object_node = 		xmlNewNode(NULL, BAD_CAST G_OBJECT_TYPE_NAME(G_OBJECT(object)));	/* Add purged info */	/* We could add this attribute in _write_nodes function 	 * but this could corrupt xsd compatibility for midgard_metadata nodes.	 * So it's added here and for every multilingual content */	xmlNewProp(object_node, BAD_CAST "purge", BAD_CAST "no");	xmlAddChild(root_node, object_node);	xmlDocSetRootElement(doc, root_node);	_write_nodes(G_OBJECT(object), object_node);	xmlChar *buf;	gint size;	xmlDocDumpFormatMemoryEnc(doc, &buf, &size, "UTF-8", 1);		xmlFreeDoc(doc);	xmlCleanupParser();	return (gchar*) buf;}
开发者ID:William-Wai,项目名称:midgard-core,代码行数:35,


示例23: ds_sds_compose_component_add_script_content

static inline int ds_sds_compose_component_add_script_content(xmlNode *component, const char *filepath){	FILE* f = fopen(filepath, "r");	if (!f) {		oscap_seterr(OSCAP_EFAMILY_GLIBC, "Can't read plain text from file '%s'.", filepath);		return -1;	}	fseek(f, 0, SEEK_END);	long int length = ftell(f);	fseek(f, 0, SEEK_SET);	if (length >= 0) {		char* buffer = oscap_alloc((length + 1) * sizeof(char));		if (fread(buffer, length, 1, f) != 1) {			oscap_seterr(OSCAP_EFAMILY_GLIBC, "Error while reading from file '%s'.", filepath);			fclose(f);			oscap_free(buffer);			return -1;		}		fclose(f);		buffer[length] = '/0';		xmlNsPtr local_ns = xmlNewNs(component, BAD_CAST sce_xccdf_ns_uri, BAD_CAST "oscap-sce-xccdf-stream");		xmlNewTextChild(component, local_ns, BAD_CAST "script", BAD_CAST buffer);		oscap_free(buffer);		return 0;	} else {		oscap_seterr(OSCAP_EFAMILY_GLIBC, "No data read from file '%s'.", filepath);		fclose(f);		return -1;	}}
开发者ID:radzy,项目名称:openscap,代码行数:31,


示例24: xmlNewChild

xmlNode *oscap_reference_to_dom(struct oscap_reference *ref, xmlNode *parent, xmlDoc *doc, const char *elname){    if (!ref) return NULL;    xmlNode *ref_node = xmlNewChild(parent, NULL, BAD_CAST elname, NULL);    if (ref->href != NULL)        xmlNewProp(ref_node, BAD_CAST "href", BAD_CAST ref->href);    if (!ref->is_dublincore) {        xmlNodeAddContent(ref_node, BAD_CAST ref->title);        return ref_node;    }        xmlNs *ns_dc = xmlSearchNsByHref(doc, parent, NS_DUBLINCORE);    if (ns_dc == NULL) // the namespace hasn't been defined in ancestor elements        ns_dc = xmlNewNs(ref_node, NS_DUBLINCORE, BAD_CAST "dc");    DC_ITEM_TO_DOM(title);    DC_ITEM_TO_DOM(creator);    DC_ITEM_TO_DOM(subject);    DC_ITEM_TO_DOM(description);    DC_ITEM_TO_DOM(publisher);    DC_ITEM_TO_DOM(contributor);    DC_ITEM_TO_DOM(date);    DC_ITEM_TO_DOM(type);    DC_ITEM_TO_DOM(format);    DC_ITEM_TO_DOM(identifier);    DC_ITEM_TO_DOM(source);    DC_ITEM_TO_DOM(language);    DC_ITEM_TO_DOM(relation);    DC_ITEM_TO_DOM(coverage);    DC_ITEM_TO_DOM(rights);    return ref_node;}
开发者ID:GautamSatish,项目名称:openscap,代码行数:35,


示例25: jal_create_audit_transforms_elem

enum jal_status jal_create_audit_transforms_elem(    xmlDocPtr doc,    xmlNodePtr *new_elem){    if (!new_elem || *new_elem || !doc) {        return JAL_E_XML_CONVERSION;    }    xmlChar *namespace_uri = (xmlChar *)JAL_XMLDSIG_URI;    xmlNodePtr out_elem = xmlNewDocNode(doc, NULL, (xmlChar *) JAL_XML_TRANSFORMS, NULL);    xmlNsPtr ns = xmlNewNs(out_elem, namespace_uri, NULL);    xmlSetNs(out_elem, ns);    xmlNodePtr transform_elem = xmlNewChild(                                    out_elem, NULL,                                    (xmlChar *) JAL_XML_TRANSFORM,                                    NULL);    xmlSetProp(transform_elem,               (xmlChar *) JAL_XML_ALGORITHM, (xmlChar *) JAL_XML_WITH_COMMENTS);    *new_elem = out_elem;    return JAL_OK;}
开发者ID:jalop-tresys,项目名称:JALoP,代码行数:26,


示例26: wi_p7_message_init_with_name

wi_p7_message_t * wi_p7_message_init_with_name(wi_p7_message_t *p7_message, wi_string_t *message_name, wi_p7_socket_t *p7_socket) {	p7_message = wi_p7_message_init(p7_message, p7_socket);	if(p7_message->serialization == WI_P7_BINARY) {		p7_message->binary_capacity	= _WI_P7_MESSAGE_BINARY_BUFFER_INITIAL_SIZE;		p7_message->binary_buffer	= wi_malloc(p7_message->binary_capacity);		p7_message->binary_size		= _WI_P7_MESSAGE_BINARY_HEADER_SIZE;	} else {		p7_message->xml_doc			= xmlNewDoc((xmlChar *) "1.0");		p7_message->xml_root_node	= xmlNewNode(NULL, (xmlChar *) "message");		xmlDocSetRootElement(p7_message->xml_doc, p7_message->xml_root_node);					p7_message->xml_ns = xmlNewNs(p7_message->xml_root_node, (xmlChar *) "http://www.zankasoftware.com/P7/Message", (xmlChar *) "p7");		xmlSetNs(p7_message->xml_root_node, p7_message->xml_ns);	}	if(!wi_p7_message_set_name(p7_message, message_name)) {		wi_release(p7_message);				return NULL;	}		return p7_message;}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:25,


示例27: jal_create_base64_element

enum jal_status jal_create_base64_element(    xmlDocPtr doc,    const uint8_t *buffer,    const size_t buf_len,    const xmlChar *namespace_uri,    const xmlChar *elm_name,    xmlNodePtr *new_elem){    if (!doc || !buffer || (buf_len == 0) || !namespace_uri ||            !elm_name || !new_elem || *new_elem) {        return JAL_E_INVAL;    }    char *base64_val = NULL;    xmlChar *xml_base64_val = NULL;    base64_val = jal_base64_enc(buffer, buf_len);    if (!base64_val) {        // this should never actually happen since the input is        // non-zero in length.        return JAL_E_INVAL;    }    xml_base64_val = (xmlChar *)base64_val;    xmlNodePtr elm = xmlNewDocNode(doc, NULL, elm_name, NULL);    xmlNsPtr ns = xmlNewNs(elm, namespace_uri, NULL);    xmlSetNs(elm, ns);    xmlNodeAddContent(elm, xml_base64_val);    free(base64_val);    *new_elem = elm;    return JAL_OK;}
开发者ID:jalop-tresys,项目名称:JALoP,代码行数:33,



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


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