I have dirty .out file which I'm converting t开发者_JS百科o xml. I am cleaning it using php and then converting. I have this problem. All URLs are encoded and i need it to be in normal decoded format.
<article type="video" enterID="33">
<addedDate>2010-12-02 16:40:26</addedDate>
<thumbnail>http://eyops.com/sdfgsefgefsoio81f8b35.jpg</thumbnail>
<asset href="http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBu927_ul_X0" addedDate="2010-12-02 16:40:23">
<duration>1500</duration>
</asset>
</article>
how do i get the href from tag, decode it and then write the output to the xml file?
Parse your xml with dom, getAttribute('href') for specific nodes, create the new link decoding the current link, and set the attribute with the new link.
After that, save your edits.
http://www.w3schools.com/dom/met_element_getattribute.asp
http://www.w3schools.com/Dom/met_element_setattribute.asp
Use urldecode: http://php.net/manual/en/function.urldecode.php to convert. How you go about extracting and replacing in the output depends on what tools your are using for that.
精彩评论