本文整理汇总了C++中xmlNodeSetContent函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlNodeSetContent函数的具体用法?C++ xmlNodeSetContent怎么用?C++ xmlNodeSetContent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlNodeSetContent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findNode
/*
* Class: org_xmlsoft_Node
* Method: setTextImpl
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_xmlsoft_Node_setTextImpl
(JNIEnv *env, jobject obj, jstring jstr) {
xmlNode *node = findNode(env, obj);
const xmlChar *str = (const xmlChar*)(*env)->GetStringUTFChars(env, jstr, NULL);
xmlNodeSetContent(node, str);
(*env)->ReleaseStringUTFChars(env, jstr, (const char*)str);
}
示例2: ermXmlSetString
/* only change the menory */
int ermXmlSetString(erManifest *pCtx, const char *express, const char *pData)
{
xmlXPathObjectPtr xpathObj = LocateTo(express, pCtx);
if (NULL == xpathObj)
return RET_ERR;
xmlNodeSetPtr nodes = xpathObj->nodesetval;
/* MvdW: we need to encode special chars in the input */
xmlChar *xmlString = xmlEncodeSpecialChars(pCtx->pDoc, (xmlChar *) pData);
if (nodes && nodes->nodeTab[0])
{
xmlNodeSetContent(nodes->nodeTab[0], xmlString);
xmlFree(xmlString);
/* See http://www.xmlsoft.org/examples/xpath2.c for detail */
if (nodes->nodeTab[0]->type != XML_NAMESPACE_DECL)
nodes->nodeTab[0] = NULL;
xmlXPathFreeObject(xpathObj);
return RET_OK;
}
xmlXPathFreeObject(xpathObj);
return RET_ERR;
}
示例3: LogMsg
void XMLFile::Set( const string& path, const string& value ) {
LogMsg(INFO,"Overriding Option['%s'] from '%s' to '%s'",path.c_str(),Get(path).c_str(),value.c_str());
xmlNodePtr p = FindNode(path,true);
xmlNodeSetContent(p, BAD_CAST value.c_str() );
LogMsg(INFO,"Done Overriding Option['%s'] to '%s'",path.c_str(),Get(path).c_str());
assert( value == Get(path));
}
示例4: xmlAddStringNode
xmlNodePtr xmlAddStringNode( xmlNodePtr root, const char * name, const char * val )
{
xmlNodePtr node = xmlNewChild( root, NULL, (const xmlChar *)name, NULL );
xmlNodeSetContent(node, (const xmlChar *)val);
return node;
}
示例5: xmlSetCoordinates
// Set coodinates for a node, carried as the content of a child.
void xmlSetCoordinates (xmlNodePtr node, const char *name, double x1, double y1, double x2,
double y2)
{
xmlNodePtr child;
gchar *str;
xmlChar *ret;
str = g_strdup_printf ("(%g %g)(%g %g)", x1, y1, x2, y2);
ret = xmlGetProp (node, BAD_CAST name);
if (ret != NULL) {
xmlSetProp (node, BAD_CAST name, BAD_CAST str);
g_free (str);
return;
}
child = node->childs;
while (child != NULL) {
if (!xmlStrcmp (child->name, BAD_CAST name)) {
xmlNodeSetContent (child, BAD_CAST str);
return;
}
child = child->next;
}
xmlSetProp (node, BAD_CAST name, BAD_CAST str);
g_free (str);
}
示例6: impl_save_contents_to_xml
static void
impl_save_contents_to_xml (RBPlaylistSource *source,
xmlNodePtr node)
{
RBStaticPlaylistSourcePrivate *priv = RB_STATIC_PLAYLIST_SOURCE_GET_PRIVATE (source);
GtkTreeIter iter;
xmlSetProp (node, RB_PLAYLIST_TYPE, RB_PLAYLIST_STATIC);
if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->base_model), &iter))
return;
do {
xmlNodePtr child_node = xmlNewChild (node, NULL, RB_PLAYLIST_LOCATION, NULL);
RhythmDBEntry *entry;
xmlChar *encoded;
const char *location;
gtk_tree_model_get (GTK_TREE_MODEL (priv->base_model), &iter, 0, &entry, -1);
location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
encoded = xmlEncodeEntitiesReentrant (NULL, BAD_CAST location);
xmlNodeSetContent (child_node, encoded);
g_free (encoded);
rhythmdb_entry_unref (entry);
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->base_model), &iter));
}
示例7: while
BOOL CLibXmlXmlParser::SetElementValue( LPCTSTR strElementName, LPCTSTR strValue )
{
BOOL bResult = FALSE;
if( this->m_pXMLRootNode )
{
xmlNodePtr pChild = this->m_pXMLRootNode->children;
while( pChild )
{
if( xmlStrcmp( pChild->name , BAD_CAST(strElementName) ) == 0 )
{
break;
}
pChild = pChild->next;
}
if( !pChild )
{
// pChild = xmlNewNode(NULL , BAD_CAST ( strEleName ));
pChild = xmlNewChild( this->m_pXMLRootNode, NULL, BAD_CAST(strElementName), BAD_CAST(strValue) );
}
if( pChild )
{
xmlNodeSetContent( pChild, BAD_CAST( strValue ) );
//pChild->content = BAD_CAST( strValue );
}
bResult = ( NULL != pChild );
}
// 写完保存。
bResult &= this->SaveXML();
return bResult;
}
示例8: FPrintf
// all output ends up through here
void FPrintf (int flag, char *buf)
{
xmlNodePtr node;
static qboolean bGotXML = false;
char level[2];
printf(buf);
// the following part is XML stuff only.. but maybe we don't want that message to go down the XML pipe?
if (flag == SYS_NOXML)
return;
// ouput an XML file of the run
// use the DOM interface to build a tree
/*
<message level='flag'>
message string
.. various nodes to describe corresponding geometry ..
</message>
*/
if (!bGotXML)
{
// initialize
doc = xmlNewDoc("1.0");
doc->children = xmlNewDocRawNode(doc, NULL, "q3map_feedback", NULL);
bGotXML = true;
}
node = xmlNewNode (NULL, "message");
xmlNodeSetContent (node, buf);
level[0] = (int)'0' + flag;
level[1] = 0;
xmlSetProp (node, "level", (char *)&level );
xml_SendNode (node);
}
示例9: init_uuid
static void init_uuid (void)
{
xmlNode *uuid_node;
char *udn;
uuid = gupnp_get_uuid ();
uuid_node = xml_util_get_element ((xmlNode *) doc->doc,
"root",
"device",
"UDN",
NULL);
if (uuid_node == NULL) {
g_critical ("Failed to find UDN element"
"in device description");
return;
}
udn = g_strdup_printf ("uuid:%s", uuid);
xmlNodeSetContent (uuid_node, (unsigned char *) udn);
g_free (udn);
}
示例10: createPlacemarkNode
void KmlRenderer::renderGlyphs(imageObj *img, pointObj *labelpnt, char *text, double angle, colorObj *clr, colorObj *olcolor, int olwidth)
{
xmlNodePtr node;
if (PlacemarkNode == NULL)
PlacemarkNode = createPlacemarkNode(LayerNode, NULL);
if (!PlacemarkNode)
return;
memcpy(&LabelColor, clr, sizeof(colorObj));
SymbologyFlag[Label] = 1;
/*there is alaws a default name (layer.shapeid). Replace it*/
for (node = PlacemarkNode->children; node; node = node->next) {
if (node->type != XML_ELEMENT_NODE)
continue;
if (strcmp((char *)node->name, "name") == 0) {
xmlNodeSetContent(node, BAD_CAST text);
break;
}
}
/*xmlNewChild(PlacemarkNode, NULL, BAD_CAST "name", BAD_CAST text);*/
xmlNodePtr geomNode = getGeomParentNode("Point");
addAddRenderingSpecifications(geomNode);
pointObj pt;
pt.x = labelpnt->x;
pt.y = labelpnt->y;
addCoordsNode(geomNode, &pt, 1);
}
示例11: xmlNodeSetContent
int SXmlNode::SetContent(std::string value)
{
if (!_node)
return -1;
xmlNodeSetContent(_node, BAD_CAST value.c_str());
return 0;
}
示例12: dom_node_text_content_write
int dom_node_text_content_write(dom_object *obj, zval *newval)
{
xmlNode *nodep = dom_object_get_node(obj);
zend_string *str;
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, 0);
return FAILURE;
}
if (nodep->type == XML_ELEMENT_NODE || nodep->type == XML_ATTRIBUTE_NODE) {
if (nodep->children) {
node_list_unlink(nodep->children);
php_libxml_node_free_list((xmlNodePtr) nodep->children);
nodep->children = NULL;
}
}
str = zval_get_string(newval);
/* we have to use xmlNodeAddContent() to get the same behavior as with xmlNewText() */
xmlNodeSetContent(nodep, (xmlChar *) "");
xmlNodeAddContent(nodep, (xmlChar *) ZSTR_VAL(str));
zend_string_release_ex(str, 0);
return SUCCESS;
}
示例13: osync_xmlfield_set_key_value
osync_bool osync_xmlfield_set_key_value(OSyncXMLField *xmlfield, const char *key, const char *value, OSyncError **error)
{
xmlNodePtr cur = NULL;
osync_assert(xmlfield);
osync_assert(key);
// If value is null we don't add it to a xmlfield
if (!value)
return TRUE;
cur = xmlfield->node->children;
for(; cur != NULL; cur = cur->next) {
if(!xmlStrcmp(cur->name, BAD_CAST key)) {
xmlNodeSetContent(xmlfield->node, BAD_CAST value);
break;
}
}
/* TODO: error handling */
if(cur == NULL)
cur = xmlNewTextChild(xmlfield->node, NULL, BAD_CAST key, BAD_CAST value);
if (!osync_xmlfield_new_xmlfield(xmlfield, cur, error))
goto error;
xmlfield->sorted = FALSE;
return TRUE;
error:
return FALSE;
}
示例14: set_content
/*
* call-seq:
* content=
*
* Set the content for this Node
*/
static VALUE set_content(VALUE self, VALUE content)
{
xmlNodePtr node;
Data_Get_Struct(self, xmlNode, node);
xmlNodeSetContent(node, (xmlChar *)StringValuePtr(content));
return content;
}
示例15: vshMakeCloneXML
static xmlChar *
vshMakeCloneXML(const char *origxml, const char *newname)
{
xmlDocPtr doc = NULL;
xmlXPathContextPtr ctxt = NULL;
xmlXPathObjectPtr obj = NULL;
xmlChar *newxml = NULL;
int size;
doc = virXMLParseStringCtxt(origxml, _("(volume_definition)"), &ctxt);
if (!doc)
goto cleanup;
obj = xmlXPathEval(BAD_CAST "/volume/name", ctxt);
if (obj == NULL || obj->nodesetval == NULL ||
obj->nodesetval->nodeTab == NULL)
goto cleanup;
xmlNodeSetContent(obj->nodesetval->nodeTab[0], (const xmlChar *)newname);
xmlDocDumpMemory(doc, &newxml, &size);
cleanup:
xmlXPathFreeObject(obj);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(doc);
return newxml;
}