Sha256: 5fa754c067d92c7cce814a1ff9a96d0f14754b51ccd8a608dded4e63eef352df

Contents?: true

Size: 1.11 KB

Versions: 153

Compression:

Stored size: 1.11 KB

Contents

<![CDATA[
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>


xmlDocPtr
parseDoc(char *docname, char *uri) {

	xmlDocPtr doc;
	xmlNodePtr cur;
	xmlNodePtr newnode;
	xmlAttrPtr newattr;

	doc = xmlParseFile(docname);
	
	if (doc == NULL ) {
		fprintf(stderr,"Document not parsed successfully. \n");
		return (NULL);
	}
	
	cur = xmlDocGetRootElement(doc);
	
	if (cur == NULL) {
		fprintf(stderr,"empty document\n");
		xmlFreeDoc(doc);
		return (NULL);
	}
	
	if (xmlStrcmp(cur->name, (const xmlChar *) "story")) {
		fprintf(stderr,"document of the wrong type, root node != story");
		xmlFreeDoc(doc);
		return (NULL);
	}
	
	newnode = xmlNewTextChild (cur, NULL, "reference", NULL);
	newattr = xmlNewProp (newnode, "uri", uri);
	return(doc);
}

int
main(int argc, char **argv) {

	char *docname;
	char *uri;
	xmlDocPtr doc;

	if (argc <= 2) {
		printf("Usage: %s docname, uri\n", argv[0]);
		return(0);
	}

	docname = argv[1];
	uri = argv[2];
	doc = parseDoc (docname, uri);
	if (doc != NULL) {
		xmlSaveFormatFile (docname, doc, 1);
		xmlFreeDoc(doc);
	}
	return (1);
}
]]>

Version data entries

153 entries across 135 versions & 5 rubygems

Version Path
cairo-1.16.1-x86-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/tutorial/includeaddattribute.c
cairo-1.16.1-x64-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/tutorial/includeaddattribute.c
cairo-1.16.0-x86-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/tutorial/includeaddattribute.c
cairo-1.16.0-x64-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/tutorial/includeaddattribute.c
cairo-1.15.14-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.14-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.13-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.13-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.12-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.12-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.11-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.11-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/tutorial/includeaddattribute.c
cairo-1.15.10-x86-mingw32 vendor/local/share/doc/libxml2-2.9.6/html/tutorial/includeaddattribute.c
cairo-1.15.10-x64-mingw32 vendor/local/share/doc/libxml2-2.9.6/html/tutorial/includeaddattribute.c
cairo-1.15.9-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/tutorial/includeaddattribute.c
cairo-1.15.9-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/tutorial/includeaddattribute.c
cairo-1.15.8-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/tutorial/includeaddattribute.c
cairo-1.15.8-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/tutorial/includeaddattribute.c
cairo-1.15.7-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/tutorial/includeaddattribute.c
cairo-1.15.7-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/tutorial/includeaddattribute.c