Hi ~there!!
I need to write XML with PHP based on a particular schema. Actually it should based on GraphML schema.
My xml file is my friends list including "name","uid","pic",etc. How to write and create a new xml??
My xml :
Code:<?xml version="1.0"?> <friends> <friend> <uid>9876543210</uid> <name>friend's name</name> <sex>male</sex> <pic>http: //xxxxxx.jpg</pic> </friend>
I need to output like this:
PS: friendB and friendC are mutual friend of me and friend A, friendA is mutual friend of me and friend D.Code:<?xml version="1.0" encoding="UTF-8"?> <graphml xmlns=" http: //graphml.graphdrawing.org/xmlns"xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http: //graphml.graphdrawing.org/xmlns hxxp //graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> <key id="sex" for="node" attr.name="sex" attr.type="string"/> <key id="pic" for="node" attr.name="pic" attr.type="string"/> <graph id="G" edgedefault="undirected"> <node id="friend's name"> <data key="sex">male</data> <data key="pic">http: //xxxxxxx.jpg</data></node> ...... <edge source="friendA" target="friendB"></edge> <edge source="friendA" target="friendC"></edge> <edge source="friendD" target="friendA"></edge> ...... </graph> </graphml>
Thanks !
Pherson


Reply With Quote
Bookmarks