How to save new created xml?
Need some help here.I am stuck :Oh crap
I have a XML file test.xml : Code:
<?xml version="1.0" encoding="UTF-8"?> Code:
<?php Quote:
|
Bump for you. Maybe somebody will know better than me.
I don't program much, but this might work. Or put you on the right track. Maybe just declare the output file $test-sorted = 'test-sorted.xml'; and instead of using echo use file_put_contents file_put_contents ($test-sorted,$item->username . "<br/>" . $item->person->age . "<br/><br/>", FILE_APPEND | LOCK_EX); |
Why not sort the output? Have you by the assorted xml a performance advantage?
I do not understand what you are doing but this code should work: PHP Code:
|
Thank you for the code,it is working great with test.xml but the original file has more elements than the test example:
Code:
<?xml version="1.0" encoding="utf-8"?> Code:
<?xml version="1.0" encoding="utf-8"?> Quote:
|
Hardcoded the "root" and "element" tags in there, so it is working from the structure of your test file in that regard,
Code:
<?php |
Hey Sarettah,
It works but the & in the url are copied as & and the new xml is not accessible neither with the script or browser. Code:
http://domain.com/?aff=0000&prg=rev&profile=username Code:
http://domain.com/?aff=0000&prg=rev&profile=username Thank you! |
Quote:
Is that url in the xml file? Or ?? & is the html special character for &. I am not sure where you are seeing that. . |
I just tested against my chaturbate xml feed url and it did NOT change urls in the file on me.
The iframes in the chaturbate feed all have the & in them in the original. They have them in there before the sort and after the sort. The chat room urls do not have & in the original, they just have &. They appear the same way in the sort as in the original. Iframe from the original: Code:
<iframe src='https://chaturbate.com/affiliates/in/?tour=XXXX&campaign=XXXXX&track=embed&room=killer__tits&bgcolor=white' height=528 width=850 style='border: none;'></iframe> Code:
<iframe src='https://chaturbate.com/affiliates/in/?tour=XXXX&campaign=XXXXX&track=embed&room=killer__tits&bgcolor=white' height=528 width=850 style='border: none;'></iframe> Code:
<chat_room_url> Code:
<chat_room_url> However, if you are looking at things in a browser then the & could show as & because that is what an html entity does. You might need to look at the source to see the actual data properly. Anyway, let me know where you are seeing what you are seeing. . |
I have checked all sorts of stuff and even re-written the sort to hanlde everything as xml object rather than an array but no luck. The test stuff you sent me still comes out wrong.
Here is a fix, it is not elegant at all. It addresses the issue you have explicitly and hopefully will work until we figure out wtf is happening: Replace the hd_iterate_xml function with this: Code:
private function hd_iterate_xml($inrec, $outrec='') |
Quote:
But to use for chaturbate xml-feed you must set in the element_name "iframe" the "height" and "width" values in single quotes: str_replase " height=528 width=850 " with " height='528' width='850' " |
Quote:
|
All times are GMT -7. The time now is 11:49 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc