Esempio n. 1
0
int main( int argc, char **argv )
{
	FILE *fp = 0;
	if( argc < 2 )
	{
		fprintf( stderr, "Usage : %s filename.\n", argv[0] );
		exit( -1 );
	}
	fp = fopen( argv[1], "r" );
	if( fp == 0 )
	{
		fprintf( stderr, "Unable to open %s.\n", argv[1] );
		exit( -1 );
	}

	{
		struct xmlDocument *doc = xmldoc_new( fp );
		xml_seterrorfn( error_log );
		xml_parse( doc );
		dump_node( doc->root );
		xmldoc_free( doc );
	}
	fclose( fp );

	return 0;
}
Esempio n. 2
0
static struct xmldoc *generate_desc(struct upnp_device_descriptor *device_def)
{
	struct xmldoc *doc;
	struct xmlelement *root;
	struct xmlelement *child;
	struct xmlelement *parent;

	doc = xmldoc_new();

	root=xmldoc_new_topelement(doc, "root", "urn:schemas-upnp-org:device-1-0");
	child=gen_specversion(doc,1,0);
	xmlelement_add_element(doc, root, child);
	parent=xmlelement_new(doc, "device");
	xmlelement_add_element(doc, root, parent);
	add_value_element(doc,parent,"deviceType", device_def->device_type);
	add_value_element(doc,parent,"presentationURL", device_def->presentation_url);
	add_value_element(doc,parent,"friendlyName", device_def->friendly_name);
	add_value_element(doc,parent,"manufacturer", device_def->manufacturer);
	add_value_element(doc,parent,"manufacturerURL", device_def->manufacturer_url);
	add_value_element(doc,parent,"modelDescription", device_def->model_description);
	add_value_element(doc,parent,"modelName", device_def->model_name);
	add_value_element(doc,parent,"modelNumber", device_def->model_number);
	add_value_element(doc,parent,"modelURL", device_def->model_url);
	add_value_element(doc,parent,"UDN", device_def->udn);
	//add_value_element(doc,parent,"serialNumber", device_def->serial_number);
	//add_value_element(doc,parent,"UPC", device_def->upc);
	if (device_def->icons) {
		child=gen_desc_iconlist(doc,device_def->icons);
		xmlelement_add_element(doc,parent,child);
	}
	child=gen_desc_servicelist(device_def, doc);
	xmlelement_add_element(doc, parent, child);

	return doc;
}