vMix Forums
»
General
»
General Discussion
»
Root Element does not exist
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2019(UTC) Posts: 54 Thanks: 5 times Was thanked: 2 time(s) in 2 post(s)
|
Hi! I have another problem with a datasource, build by a PHP script. The script is these: Code:$source = "http://localhost/SampleData.xml";
// Create Data
...
// Output XML
file_put_contents("race.xml", $xml);
return $xml;
If I create a XML Datasource with the created race.xmxl local file, anything ok, I get the data i want. But if I create the XML datasource with the PHP-File, I get the message "Root Element does not exist". What do I wrong? What is the right way? return $xml; obviously isn't. datasource.jpg (12kb) downloaded 0 time(s). datasource_fail.jpg (12kb) downloaded 0 time(s).
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,290 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
Create from what ?
how to both xml files look compared ?
why create an xml file from a xml file that works ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2019(UTC) Posts: 54 Thanks: 5 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: doggy Create from what ? from a given and every second refreshing XML Source (REST) Quote:how to both xml files look compared ? output xml file and returned xml are even Quote:why create an xml file from a xml file that works ? Edit the data, deleting leading zero's, extracting important parts of a long string, joining seperat fields for firstname and lastname to name... things like these... things you cannot do in vmix datasource manager
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,290 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
Sorry but I am not following How can they be even after all the editing/filtering you did to them?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2019(UTC) Posts: 54 Thanks: 5 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: doggy Sorry but I am not following How can they be even after all the editing/filtering you did to them? ok... this is the source file from the REST: <?xml version="1.0" encoding="UTF-16"?> <EVENT TIMESTAMP="14784946" KEY="1400717498163859" VERSION="1.0"> <CONFIG> <MODE>LapAndTime</MODE> <NROFBESTLAPS>0</NROFBESTLAPS> </CONFIG> <METADATA> <NAME>Test-Race</NAME> <SECTION>VG8</SECTION> <GROUP>Final A - Final run 1 ]</GROUP> <RACETIME>00:30:00</RACETIME> <CURRENTTIME>00:00:00</CURRENTTIME> <REMAININGTIME>00:30:00</REMAININGTIME> <COUNTDOWN>00:00:00</COUNTDOWN> <DIVERGENCE>00:00:00</DIVERGENCE> </METADATA> </EVENT> and this is the xml output from the PHP Script <?xml version="1.0" encoding="UTF-8"?> <DATA> <RACE> A</RACE> <RUN> 1</RUN> <REMTIME>30:00</REMTIME> </DATA>
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,290 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
they both work IF UTF-16 is changed to UTF-8 (copied and saved with UTF-8 encoding)
are you sure there are no blank lines and such in the file (especially the first line) ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2019(UTC) Posts: 54 Thanks: 5 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: doggy they both work IF UTF-16 is changed to UTF-8 (copied and saved with UTF-8 encoding)
are you sure there are no blank lines and such in the file (especially the first line) ? Look the Screenshots i've added in the first post. The Problem is, why the local XML FILE is working and why the PHP Return does NOT. Both with UTF-8. The REST-Source XML does work, no problem, but bad data.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,290 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
sorry , totally lost and confused
you say both utf-8 but one of the examples said UTF-16 also in the picture you are refering to a php file and not an xml file created by the PHP script(on the local server), why not just write to a file and read that ?? you also say REST-Source XML does work, no problem, but bad data. ??
for what its worth , we dont even know how the data towards xml structure is even processed in your code so no way to know it its not simple an error there
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,290 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
hmm, if one googles "php return as xml" you might find your answer
echo
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2019(UTC) Posts: 54 Thanks: 5 times Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: doggy you say both utf-8 but one of the examples said UTF-16 also in the picture you are refering to a php file and not an xml file created by the PHP script(on the local server), why not just write to a file and read that ?? you also say REST-Source XML does work, no problem, but bad data. ??
for what its worth , we dont even know how the data towards xml structure is even processed in your code so no way to know it its not simple an error there 1. The source-XML comes from a REST-Port and is UTF-16. 2. if i use this as datasource in Vmix... iit works, but looks not very nice formated. 3. Thatswhy I try to edit the source with PHP, extract only the things I need, and formate it well. 4. The Problem was the output of the php script. The output as file i can use as datasource (with utf8), the other version... output with return... does not work (with UTF8). But THIS is the output i need because the script must run each second. Originally Posted by: doggy hmm, if one googles "php return as xml" you might find your answer
echo this is not serious..... I EVER thought that "echo" is a output for the browserwindow... if I write a PHP function i have to use return to get a result. And NEVER EVER I had the idea to try "ECHO". But here in this case this is the solution. THANK YOU !!! And sorry for my english... and thx for your time
|
1 user thanked burie for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,290 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
glad it's solved
why sorry for your English? Isn't my first language either. Some posters don't even bother trying
|
1 user thanked doggy for this useful post.
|
|
|
vMix Forums
»
General
»
General Discussion
»
Root Element does not exist
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close