version 1.11, 1998/10/26 06:42:10
|
version 1.12, 1998/10/26 09:50:19
|
Line 342 void rdfSetValue(rdfDescription desc, co
|
Line 342 void rdfSetValue(rdfDescription desc, co
|
} |
} |
if (list->content != NULL) free(list->content); |
if (list->content != NULL) free(list->content); |
if (list->childs != NULL) xmlFreeNodeList(list->childs); |
if (list->childs != NULL) xmlFreeNodeList(list->childs); |
list->childs = xmlStringGetNodeList(desc->doc, value); |
list->childs = xmlStringGetNodeList(desc->doc, |
|
xmlEncodeEntities(desc->doc, value)); |
return; |
return; |
} |
} |
list = list->next; |
list = list->next; |
Line 351 void rdfSetValue(rdfDescription desc, co
|
Line 352 void rdfSetValue(rdfDescription desc, co
|
/* |
/* |
* Create a new property. |
* Create a new property. |
*/ |
*/ |
xmlNewChild(desc, ns, property, (char *) value); |
xmlNewChild(desc, ns, property, xmlEncodeEntities(desc->doc, value)); |
} |
} |
|
|
/* |
/* |
Line 443 int rdfElemGetType(rdfElement elem) {
|
Line 444 int rdfElemGetType(rdfElement elem) {
|
} |
} |
|
|
char *rdfElemGetValue(rdfElement elem) { |
char *rdfElemGetValue(rdfElement elem) { |
return(elem->content); |
if (elem->content != NULL) |
|
return(strdup(elem->content)); |
|
else |
|
return(xmlNodeListGetString(elem->doc, elem->childs, 1)); |
} |
} |
const char *rdfElemGetPropertyName(rdfElement elem) { |
const char *rdfElemGetPropertyName(rdfElement elem) { |
return(elem->name); |
return(elem->name); |
Line 457 void rdfElemSetValue(rdfElement elem, co
|
Line 461 void rdfElemSetValue(rdfElement elem, co
|
return; |
return; |
} |
} |
if (elem->content != NULL) free(elem->content); |
if (elem->content != NULL) free(elem->content); |
elem->content = strdup(value); |
if (elem->childs != NULL) xmlFreeNodeList(elem->childs); |
|
elem->childs = xmlStringGetNodeList(elem->doc, |
|
xmlEncodeEntities(elem->doc, value)); |
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
Line 482 int main(void) {
|
Line 488 int main(void) {
|
rpm = rdfNewNamespace(rdf, "http://www.rpm.org/", "RPM"); |
rpm = rdfNewNamespace(rdf, "http://www.rpm.org/", "RPM"); |
desc = rdfAddDescription(rdf, NULL, |
desc = rdfAddDescription(rdf, NULL, |
"ftp://ftp.redhat.com/pub/contrib/i386/rpm2html-0.90-1.i386.rpm"); |
"ftp://ftp.redhat.com/pub/contrib/i386/rpm2html-0.90-1.i386.rpm"); |
|
rdfSetValue(desc, "Description", rpm, "<shade/stick & close/destroy>"); |
rdfSetValue(desc, "Name", rpm, "rpm2html"); |
rdfSetValue(desc, "Name", rpm, "rpm2html"); |
rdfSetValue(desc, "Version", rpm, "0.90"); |
rdfSetValue(desc, "Version", rpm, "0.90"); |
rdfSetValue(desc, "Release", rpm, "1"); |
rdfSetValue(desc, "Release", rpm, "1"); |
Line 512 int main(void) {
|
Line 519 int main(void) {
|
desc = rdfFirstDescription(rdf); |
desc = rdfFirstDescription(rdf); |
rdfGetValue(desc, "Name", rpm, &value, NULL); |
rdfGetValue(desc, "Name", rpm, &value, NULL); |
printf("Name : %s\n", value); |
printf("Name : %s\n", value); |
|
free(value); |
rdfGetValue(desc, "Name", NULL, &value, NULL); |
rdfGetValue(desc, "Name", NULL, &value, NULL); |
printf("Name : %s\n", value); |
printf("Name : %s\n", value); |
|
free(value); |
printf("\n---\n"); |
printf("\n---\n"); |
xmlDocDump(stdout, rdf); |
xmlDocDump(stdout, rdf); |
|
|