logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
burie  
#1 Posted : Sunday, June 16, 2019 1:28:58 AM(UTC)
burie

Rank: Advanced Member

Groups: Registered
Joined: 2/18/2019(UTC)
Posts: 54
Germany

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).
doggy  
#2 Posted : Sunday, June 16, 2019 1:53:11 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,081
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
Create from what ?

how to both xml files look compared ?

why create an xml file from a xml file that works ?
burie  
#3 Posted : Sunday, June 16, 2019 2:53:53 AM(UTC)
burie

Rank: Advanced Member

Groups: Registered
Joined: 2/18/2019(UTC)
Posts: 54
Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: doggy Go to Quoted Post
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
doggy  
#4 Posted : Sunday, June 16, 2019 3:19:13 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,081
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
Sorry but I am not following
How can they be even after all the editing/filtering you did to them?
burie  
#5 Posted : Sunday, June 16, 2019 3:46:44 AM(UTC)
burie

Rank: Advanced Member

Groups: Registered
Joined: 2/18/2019(UTC)
Posts: 54
Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: doggy Go to Quoted Post
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>
doggy  
#6 Posted : Sunday, June 16, 2019 4:07:28 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,081
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 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) ?
burie  
#7 Posted : Sunday, June 16, 2019 4:18:27 AM(UTC)
burie

Rank: Advanced Member

Groups: Registered
Joined: 2/18/2019(UTC)
Posts: 54
Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: doggy Go to Quoted Post
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.
doggy  
#8 Posted : Sunday, June 16, 2019 4:55:30 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,081
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 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
doggy  
#9 Posted : Sunday, June 16, 2019 5:10:03 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,081
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
hmm, if one googles "php return as xml" you might find your answer

echo
burie  
#10 Posted : Sunday, June 16, 2019 6:32:42 AM(UTC)
burie

Rank: Advanced Member

Groups: Registered
Joined: 2/18/2019(UTC)
Posts: 54
Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: doggy Go to Quoted Post
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 Go to Quoted Post
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

thanks 1 user thanked burie for this useful post.
Ario on 3/10/2020(UTC)
doggy  
#11 Posted : Sunday, June 16, 2019 6:42:35 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,081
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
glad it's solved

why sorry for your English? Isn't my first language either. Some posters don't even bother trying
thanks 1 user thanked doggy for this useful post.
burie on 6/16/2019(UTC)
Users browsing this topic
Guest
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.