Re: [xml] attribute and value element

2006/11/17, Tallapragada, Sridevi <Sridevi Tallapragada netapp com>:
Hi David

Check if this helps:

hchild2 = xmlNewChild(hchild1,NULL,(const xmlChar*)"elementname","also a
value here");
xmlSetProp(hchild2, (const xmlChar*)"attr1", (const xmlChar*)"hello");

Small suggestion; there's a BAD_CAST macro you can use for the cast, e.g:

BAD_CAST "elementname"


-----Original Message-----
From: "David" [mailto:lordkain tlen pl]
Sent: Friday, November 17, 2006 1:20 PM
To: xml @ gnome. org
Subject: [xml] attribute and value element


I want to use the xmlwriter module from libxml2 and want to code that
resuls in the following xml.

<elementname attr1="hello">also a value here</elementname>

I can produce the following xml, but i want to use value and attribute
with one xml-tag.

<elementname attr1="hello">
 <value>also a value here</value>

I hope someone can help me.

Cheerz, David
xml mailing list, project page xml gnome org
xml mailing list, project page
xml gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]