这篇教程C++ xmlSetNs函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xmlSetNs函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlSetNs函数的具体用法?C++ xmlSetNs怎么用?C++ xmlSetNs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xmlSetNs函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: get_xmlNodestatic 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,
示例2: recursively_remove_namespaces_from_nodestatic void recursively_remove_namespaces_from_node(xmlNodePtr node){ xmlNodePtr child ; xmlAttrPtr property ; xmlSetNs(node, NULL); for (child = node->children ; child ; child = child->next) recursively_remove_namespaces_from_node(child); if (((node->type == XML_ELEMENT_NODE) || (node->type == XML_XINCLUDE_START) || (node->type == XML_XINCLUDE_END)) && node->nsDef) { xmlFreeNsList(node->nsDef); node->nsDef = NULL; } if (node->type == XML_ELEMENT_NODE && node->properties != NULL) { property = node->properties ; while (property != NULL) { if (property->ns) property->ns = NULL ; property = property->next ; } }}
开发者ID:tomhughes,项目名称:nokogiri,代码行数:26,
示例3: node_add_childstatic 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,
示例4: processDocstatic 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,
示例5: add_projectstatic 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,
示例6: wi_p7_message_init_with_namewi_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,
示例7: jal_create_base64_elementenum 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,
示例8: 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,
示例9: get_xmlNodestatic 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,
示例10: insure_namespacestatic 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,
示例11: R_getAncestorDefaultNSDefSEXPR_getAncestorDefaultNSDef(SEXP r_node, SEXP r_recursive){ xmlNodePtr cur, node; xmlNs *ans = NULL; cur = (xmlNodePtr) R_ExternalPtrAddr(r_node); node = cur->parent; while(node && (node->type != XML_DOCUMENT_NODE && node->type != XML_HTML_DOCUMENT_NODE)) { /* Need to check for HTML_DOC or XML_DOC ?*/ ans = findNSByPrefix(node, NULL); if(ans) break; node = node->parent; } if(ans) { xmlSetNs(cur, ans); if(LOGICAL(r_recursive)[0]) { setDefaultNs(cur, ans, 1); } return(ScalarLogical(1)); // R_createXMLNsRef(ans)); } return(R_NilValue);}
开发者ID:omegahat,项目名称:XML,代码行数:27,
示例12: jal_create_audit_transforms_elemenum 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,
示例13: 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,
示例14: write_xml_schematic// Create an XML subtree of doc equivalent to the given Schematic.static xmlNodePtrwrite_xml_schematic (parseXmlContext *ctxt, Schematic *sm, GError **error){ xmlNodePtr cur; xmlNodePtr grid; xmlNsPtr ogo; gchar *str; cur = xmlNewDocNode (ctxt->doc, ctxt->ns, BAD_CAST "schematic", NULL); if (cur == NULL) { printf ("%s:%d NULL that shall be not NULL!/n", __FILE__, __LINE__); return NULL; } if (ctxt->ns == NULL) { ogo = xmlNewNs (cur, BAD_CAST "http://www.dtek.chalmers.se/~d4hult/oregano/v1", BAD_CAST "ogo"); xmlSetNs (cur,ogo); ctxt->ns = ogo; } // General information about the Schematic. str = g_strdup_printf ("%s", schematic_get_author (sm)); xmlNewChild (cur, ctxt->ns, BAD_CAST "author", xmlEncodeEntitiesReentrant (ctxt->doc, BAD_CAST str)); g_free (str); str = g_strdup_printf ("%s", schematic_get_title (sm)); xmlNewChild (cur, ctxt->ns, BAD_CAST "title", xmlEncodeEntitiesReentrant (ctxt->doc, BAD_CAST str)); g_free (str); str = g_strdup_printf ("%s", schematic_get_comments (sm)); xmlNewChild (cur, ctxt->ns, BAD_CAST "comments", xmlEncodeEntitiesReentrant (ctxt->doc, BAD_CAST str)); g_free (str); // Grid. grid = xmlNewChild (cur, ctxt->ns, BAD_CAST "grid", NULL); xmlNewChild (grid, ctxt->ns, BAD_CAST "visible", BAD_CAST "true"); xmlNewChild (grid, ctxt->ns, BAD_CAST "snap", BAD_CAST "true"); // Simulation settings. write_xml_sim_settings (cur, ctxt, sm); // Parts. ctxt->node_parts = xmlNewChild (cur, ctxt->ns, BAD_CAST "parts", NULL); schematic_parts_foreach (sm, (gpointer) write_xml_part, ctxt); // Wires. ctxt->node_wires = xmlNewChild (cur, ctxt->ns, BAD_CAST "wires", NULL); schematic_wires_foreach (sm, (gpointer) write_xml_wire, ctxt); // Text boxes. ctxt->node_textboxes = xmlNewChild (cur, ctxt->ns, BAD_CAST "textboxes", NULL); schematic_items_foreach (sm, (gpointer) write_xml_textbox, ctxt); return cur;}
开发者ID:rodolforg,项目名称:oregano,代码行数:59,
示例15: recursively_remove_namespaces_from_nodestatic void recursively_remove_namespaces_from_node(xmlNodePtr node){ xmlNodePtr child ; xmlSetNs(node, NULL); for (child = node->children ; child ; child = child->next) recursively_remove_namespaces_from_node(child);}
开发者ID:AndreasKrueger,项目名称:nokogiri,代码行数:9,
示例16: uwsgi_webdav_add_a_propstatic void uwsgi_webdav_add_a_prop(xmlNode *node, char *opt, xmlNode *req_prop, int type, char *force_name) { char *first_space = strchr(opt, ' '); if (!first_space) return; *first_space = 0; char *second_space = strchr(first_space + 1, ' '); xmlNode *new_node = NULL; char *ns = opt; if (!force_name) force_name = first_space + 1; else { ns = "DAV:"; } if (second_space) { *second_space = 0; if (!uwsgi_webdav_prop_requested(req_prop, ns, force_name)) { *first_space = ' '; *second_space = ' '; return; } // href if (type == 1) { new_node = xmlNewChild(node, NULL, BAD_CAST first_space + 1, NULL); xmlNewTextChild(new_node, NULL, BAD_CAST "href", BAD_CAST second_space + 1); } // comp else if (type == 2) { new_node = xmlNewChild(node, NULL, BAD_CAST first_space + 1, NULL); char *comps = uwsgi_str(second_space + 1); char *p = strtok(comps, ","); while(p) { xmlNode *comp = xmlNewChild(new_node, NULL, BAD_CAST "comp", NULL); xmlNewProp(comp, BAD_CAST "name", BAD_CAST p); p = strtok(NULL, ","); } free(comps); } else { if (!uwsgi_webdav_prop_requested(req_prop, ns, first_space + 1)) { *first_space = ' '; *second_space = ' '; return; } new_node = xmlNewTextChild(node, NULL, BAD_CAST first_space + 1, BAD_CAST second_space + 1); } *second_space = ' '; } else { if (!uwsgi_webdav_prop_requested(req_prop, ns, force_name)) { *first_space = ' '; return; } new_node = xmlNewChild(node, NULL, BAD_CAST first_space + 1, NULL); } xmlNsPtr x_ns = xmlNewNs(new_node, BAD_CAST opt, NULL); xmlSetNs(new_node, x_ns); *first_space = ' ';}
开发者ID:JuanS,项目名称:uwsgi,代码行数:56,
示例17: WidthKmlRenderer::KmlRenderer(int width, int height, outputFormatObj *format, colorObj* color/*=NULL*/) : Width(width), Height(height), MapCellsize(1.0), XmlDoc(NULL), LayerNode(NULL), GroundOverlayNode(NULL), PlacemarkNode(NULL), GeomNode(NULL), Items(NULL), NumItems(0), FirstLayer(MS_TRUE), map(NULL), currentLayer(NULL), mElevationFromAttribute( false ), mElevationAttributeIndex( -1 ), mCurrentElevationValue(0.0){ /*private variables*/ pszLayerDescMetadata = NULL; papszLayerIncludeItems = NULL; nIncludeItems=0; papszLayerExcludeItems = NULL; nExcludeItems=0; pszLayerNameAttributeMetadata = NULL; /*metadata to use for a name for each feature*/ LineStyle = NULL; numLineStyle = 0; xmlNodePtr styleNode; xmlNodePtr listStyleNode; /* Create document.*/ XmlDoc = xmlNewDoc(BAD_CAST "1.0"); xmlNodePtr rootNode = xmlNewNode(NULL, BAD_CAST "kml"); /* Name spaces*/ xmlSetNs(rootNode, xmlNewNs(rootNode, BAD_CAST "http://www.opengis.net/kml/2.2", NULL)); xmlDocSetRootElement(XmlDoc, rootNode); DocNode = xmlNewChild(rootNode, NULL, BAD_CAST "Document", NULL); styleNode = xmlNewChild(DocNode, NULL, BAD_CAST "Style", NULL); xmlNewProp(styleNode, BAD_CAST "id", BAD_CAST "LayerFolder_check"); listStyleNode = xmlNewChild(styleNode, NULL, BAD_CAST "ListStyle", NULL); xmlNewChild(listStyleNode, NULL, BAD_CAST "listItemType", BAD_CAST "check"); styleNode = xmlNewChild(DocNode, NULL, BAD_CAST "Style", NULL); xmlNewProp(styleNode, BAD_CAST "id", BAD_CAST "LayerFolder_checkHideChildren"); listStyleNode = xmlNewChild(styleNode, NULL, BAD_CAST "ListStyle", NULL); xmlNewChild(listStyleNode, NULL, BAD_CAST "listItemType", BAD_CAST "checkHideChildren"); styleNode = xmlNewChild(DocNode, NULL, BAD_CAST "Style", NULL); xmlNewProp(styleNode, BAD_CAST "id", BAD_CAST "LayerFolder_checkOffOnly"); listStyleNode = xmlNewChild(styleNode, NULL, BAD_CAST "ListStyle", NULL); xmlNewChild(listStyleNode, NULL, BAD_CAST "listItemType", BAD_CAST "checkOffOnly"); styleNode = xmlNewChild(DocNode, NULL, BAD_CAST "Style", NULL); xmlNewProp(styleNode, BAD_CAST "id", BAD_CAST "LayerFolder_radioFolder"); listStyleNode = xmlNewChild(styleNode, NULL, BAD_CAST "ListStyle", NULL); xmlNewChild(listStyleNode, NULL, BAD_CAST "listItemType", BAD_CAST "radioFolder"); StyleHashTable = msCreateHashTable();}
开发者ID:dmorissette,项目名称:mapserver,代码行数:56,
示例18: soup_soap_message_persistvoidsoup_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,
示例19: doc_to_xml/*--------------------------------------------------------------------------*/static xmlDocPtrdoc_to_xml (gbDoc *doc, gbDocXMLStatus *status){ xmlDocPtr xmldoc; xmlNsPtr ns; xmlNodePtr xml_bond; GList *p; gbDocBond *p_bond; gchar *title, *idate, *denom; gb_debug (DEBUG_XML, "START"); LIBXML_TEST_VERSION; xmldoc = xmlNewDoc ((xmlChar *)"1.0"); xmldoc->xmlRootNode = xmlNewDocNode (xmldoc, NULL, (xmlChar *)"Bond-Inventory", NULL); ns = xmlNewNs (xmldoc->xmlRootNode, (xmlChar *)NAME_SPACE, (xmlChar *)"gbonds"); xmlSetNs (xmldoc->xmlRootNode, ns); title = gb_doc_get_title (doc); if ( title != NULL ) { xmlNewChild( xmldoc->xmlRootNode, NULL, (xmlChar *)"Title", (xmlChar *)title ); g_free (title); } for ( p=doc->list; p!=NULL; p=p->next ) { p_bond = (gbDocBond *)p->data; idate = gb_date_fmt( p_bond->idate ); denom = g_strdup_printf( "%.0f", p_bond->denom ); xml_bond = xmlNewChild( xmldoc->xmlRootNode, NULL, (xmlChar *)"Bond", NULL ); xmlSetProp( xml_bond, (xmlChar *)"series", (xmlChar *)gb_series_fmt( p_bond->series ) ); xmlSetProp( xml_bond, (xmlChar *)"idate", (xmlChar *)idate ); xmlSetProp( xml_bond, (xmlChar *)"denom", (xmlChar *)denom ); if ( p_bond->sn != NULL ) { /* Imported SBW inventories may not have SNs */ xmlSetProp( xml_bond, (xmlChar *)"sn", (xmlChar *)p_bond->sn ); } g_free( idate ); idate = NULL; g_free( denom ); denom = NULL; } gb_debug (DEBUG_XML, "END"); *status = GB_DOC_XML_OK; return xmldoc;}
开发者ID:rlaager,项目名称:gbonds-pkg,代码行数:54,
示例20: xmlNewNsvoid XMLElement::setNodeNameSpace(const XMLNs & ns) const{ xmlNs *n = ns.getRealNs(); if (n) { if (!n->prefix || !xmlSearchNs(doc.getRealDocument(), node, n->prefix)) { n = xmlNewNs(node, (const xmlChar *)ns.getHref(), (const xmlChar *)ns.getPrefix()); } xmlSetNs(node, n); }}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:12,
示例21: insure_namespacestatic voidinsure_namespace(xmlNode *xmlnode, xmlNs *ns){ xmlNode *t = xmlnode->children; xmlSetNs(xmlnode, ns); while (t) { if (t->type == XML_ELEMENT_NODE && t->ns == NULL) insure_namespace(t, ns); t = t->next; }}
开发者ID:cascadeo,项目名称:lasso,代码行数:12,
示例22: xml_node_create_text_nsxml_node_t * xml_node_create_text_ns(struct xml_node_ctx *ctx, xml_node_t *parent, const char *ns_uri, const char *name, const char *value){ xmlNodePtr node; xmlNsPtr ns; node = xmlNewTextChild((xmlNodePtr) parent, NULL, (const xmlChar *) name, (const xmlChar *) value); ns = xmlNewNs(node, (const xmlChar *) ns_uri, NULL); xmlSetNs(node, ns); return (xml_node_t *) node;}
开发者ID:2asoft,项目名称:freebsd,代码行数:13,
示例23: setDefaultNsvoidsetDefaultNs(xmlNodePtr node, xmlNsPtr ns, int recursive){ if(!node->ns) xmlSetNs(node, ns); if(recursive) { xmlNodePtr cur = node->children; while(cur) { setDefaultNs(cur, ns, 1); cur = cur->next; } }}
开发者ID:omegahat,项目名称:XML,代码行数:13,
示例24: element__newElement *element__new( Document *doc, unsigned char *name, Namespc *ns ){ /* NOTE: apparently libxml2 makes its own copy of the element name. */ xmlNode* el = xmlNewNode( 0, name ); /* Avoid "unused parameter" warning. */ doc = 0; if ( ns ) xmlSetNs( el, ( xmlNs* ) ns ); return ( Element* ) el ;}
开发者ID:joshsh,项目名称:archive,代码行数:14,
示例25: relink_namespace/* :nodoc: */static void relink_namespace(xmlNodePtr reparented){ xmlNodePtr child; /* Avoid segv when relinking against unlinked nodes. */ if(!reparented->parent) return; /* Make sure that our reparented node has the correct namespaces */ if(!reparented->ns && reparented->doc != (xmlDocPtr)reparented->parent) xmlSetNs(reparented, reparented->parent->ns); /* Search our parents for an existing definition */ if(reparented->nsDef) { xmlNsPtr curr = reparented->nsDef; xmlNsPtr prev = NULL; while(curr) { xmlNsPtr ns = xmlSearchNsByHref( reparented->doc, reparented->parent, curr->href ); /* If we find the namespace is already declared, remove it from this * definition list. */ if(ns && ns != curr) { if (prev) { prev->next = curr->next; } else { reparented->nsDef = curr->next; } nokogiri_root_nsdef(curr, reparented->doc); } else { prev = curr; } curr = curr->next; } } /* Only walk all children if there actually is a namespace we need to */ /* reparent. */ if(NULL == reparented->ns) return; /* When a node gets reparented, walk it's children to make sure that */ /* their namespaces are reparented as well. */ child = reparented->children; while(NULL != child) { relink_namespace(child); child = child->next; }}
开发者ID:2GenRepo,项目名称:ecosynthetix,代码行数:51,
示例26: xmlSecSoap12CreateEnvelope/** * xmlSecSoap12CreateEnvelope: * @doc: the parent doc (might be NULL). * * Creates a new SOAP 1.2 Envelope node. Caller is responsible for * adding the returned node to the XML document. * * XML Schema (http://www.w3.org/2003/05/soap-envelope): * * <xs:element name="Envelope" type="tns:Envelope"/> * <xs:complexType name="Envelope"> * <xs:sequence> * <xs:element ref="tns:Header" minOccurs="0"/> * <xs:element ref="tns:Body" minOccurs="1"/> * </xs:sequence> * <xs:anyAttribute namespace="##other" processContents="lax"/> * </xs:complexType> * * Returns pointer to newly created <soap:Envelope> node or NULL * if an error occurs. */EXPORT_CxmlNodePtr xmlSecSoap12CreateEnvelope(xmlDocPtr doc) { xmlNodePtr envNode; xmlNodePtr bodyNode; xmlNsPtr ns; /* create Envelope node */ envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL); if(envNode == NULL) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlNewDocNode", XMLSEC_ERRORS_R_XML_FAILED, "node=%s", xmlSecErrorsSafeString(xmlSecNodeEnvelope)); return(NULL); } ns = xmlNewNs(envNode, xmlSecSoap12Ns, NULL) ; if(ns == NULL) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlNewNs", XMLSEC_ERRORS_R_XML_FAILED, "ns=%s", xmlSecErrorsSafeString(xmlSecSoap12Ns)); xmlFreeNode(envNode); return(NULL); } xmlSetNs(envNode, ns); /* add required Body node */ bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap12Ns); if(bodyNode == NULL) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlSecAddChild", XMLSEC_ERRORS_R_XMLSEC_FAILED, "node=%s", xmlSecErrorsSafeString(xmlSecNodeBody)); xmlFreeNode(envNode); return(NULL); } return(envNode);}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:68,
注:本文中的xmlSetNs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xmlSetProp函数代码示例 C++ xmlSetGenericErrorFunc函数代码示例 |