I need to pass parameters to my xml nodes like
<NewsService FormalName="Feed" link-url="http://www.tv.com/">http://www.tv.com/img/UTv.jpg</NewsService>
here newsservice is my node and FormalName and link-url are my parameters.
Below specified is my code .There i have read a rss feed and converted that data to xml besides i have added some information from my database to these xml file.My prblem is ,i need to add some parametr values to my xml nodes.
$homepage = file_get_contents('http://www.horas.com/feed/');
$homepage = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $homepage);
$xml = simplexml_load_string($homepage,'SimpleXMLElement', LIBXML_NOCDATA);
$details=$xml->channel;
$doc = new DOMDocument('1.0','UTF-8');
$doc->formatOutput = true;
$r = $doc->createElement( "channel" );
$doc->appendChild( $r );
$b = $doc->createElement( "info" );
$title1= $doc->createElement( "title" );
$title1->appendChild($doc->createTextNode($details->title));
$b->appendChild( $title1);
$comments1 = $doc->createElement( "description" );
$comments1 ->appendChild($doc->createTextNode($details->description));
$b->appendChild( $comments1 );
$lastBuildDate = $doc->createElement( "lastBuildDate" );
$lastBuildDate->appendChild($doc->createTextNode($details->lastBuildDate));
$b->appendChild( $lastBuildDate);
$language = $doc->createElement( "language" );
$language->appendChild($doc->createTextNode($details->lastBuildDate));
$b->appendChild( $language);
$syupdatePeriod1 = $doc->createElement("syupdatePeriod");
$syupdatePeriod1->appendChild($doc->createTextNode($details->syupdatePeriod));
$b->appendChild( $syupdatePeriod1);
$generator = $doc->createElement( "generator" );
$generator->appendChild($doc->createTextNode($details->generator));
$b->appendChild( $generator);
$details1=(array) $opt->category;
$category = $doc->createElement( "category" );
$category->appendChild($doc->createTextNode( $details1[0] ));
$b->appendChild( $category);
$contentencoded = $doc->createElement( "contentencoded" );
$contentencoded->appendChild($doc->createTextNode( $opt->contentencoded ));
$b->appendChild( $contentencoded);
$wfwcommentRss = $doc->createElement( "wfwcommentRss" );
$wfwcommentRss ->appendChild($doc->createTextNode( $opt->wfwcommentRss ));
$b->appendChild( $wfwcommentRss);
$slashcomments= $doc->createElement( "slashcomments" );
$slashcomments->appendChild($doc->createTextNode( $opt->slashcomments ));
$b->appendChild( $slashcomments);
$r->appendChild( $b );
}
$doc->save("horasxml.xml")
but with title i need to pass the parametr category="book" author="ramk"
ie <title category="book" author="ramk">
how will i do it please help me