PDA

View Full Version : Parsing status.xml



jonheal
2006-03-21, 07:30
I'm trying to parse http://localhost:9000/xml/status.xml to grab values in order to build a page on our public web site that shows what's currently playing on our SqueezeBox.

I'm using VBScript and DOM.

The "file" -- and I guess it's not really a file but generated on the fly -- simply will not process because of one or both of these lines:

<!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
<status xmlns="http://www.slimdevices.com/slimserver/xml">

I have a feeling it's the DOCTYPE because of the relative path that my script can't resolve.

I can load the file, but attempting to get a value of a node fails. Anyone have any ideas on how I can get around this?

mherger
2006-03-21, 07:52
> <!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
> <status xmlns="http://www.slimdevices.com/slimserver/xml">
>
> I have a feeling it's the DOCTYPE because of the relative path that my
> script can't resolve.

You can easily change that line in HTML/xml/status_header.xml to be sure.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

jonheal
2006-03-21, 08:01
> <!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
> <status xmlns="http://www.slimdevices.com/slimserver/xml">
>
> I have a feeling it's the DOCTYPE because of the relative path that my
> script can't resolve.

You can easily change that line in HTML/xml/status_header.xml to be sure.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)
Thanks, Michael,

I removed them both the DOCTYPE reference and the namespace. Nice googles, by the way.

geoffb
2006-03-21, 08:11
On 3/21/06, jonheal wrote:
>
> I'm trying to parse http://localhost:9000/xml/status.xml to grab values
> in order to build a page on our public web site that shows what's
> currently playing on our SqueezeBox.
>
> I'm using VBScript and DOM.
>
> The "file" -- and I guess it's not really a file but generated on the
> fly -- simply will not process because of one or both of these lines:
>
> <!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
> <status xmlns="http://www.slimdevices.com/slimserver/xml">
>
> I have a feeling it's the DOCTYPE because of the relative path that my
> script can't resolve.
>
> I can load the file, but attempting to get a value of a node fails.
> Anyone have any ideas on how I can get around this?

Are you using MSXML? If so, which version of the DOM model are you using?
It looks like the the parser is trying to check the dtd and can't.
Have you tried turning off validation in the XML reader?
Something like the validateOnParse property might help do this, see
the IXMLDOMDocument entry here:
http://tinyurl.com/qnttp

Cheers
Geoff

jonheal
2006-03-21, 08:20
On 3/21/06, jonheal wrote:
>
> I'm trying to parse http://localhost:9000/xml/status.xml to grab values
> in order to build a page on our public web site that shows what's
> currently playing on our SqueezeBox.
>
> I'm using VBScript and DOM.
>
> The "file" -- and I guess it's not really a file but generated on the
> fly -- simply will not process because of one or both of these lines:
>
> <!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
> <status xmlns="http://www.slimdevices.com/slimserver/xml">
>
> I have a feeling it's the DOCTYPE because of the relative path that my
> script can't resolve.
>
> I can load the file, but attempting to get a value of a node fails.
> Anyone have any ideas on how I can get around this?

Are you using MSXML? If so, which version of the DOM model are you using?
It looks like the the parser is trying to check the dtd and can't.
Have you tried turning off validation in the XML reader?
Something like the validateOnParse property might help do this, see
the IXMLDOMDocument entry here:
http://tinyurl.com/qnttp

Cheers
Geoff
I put back the lines I had removed from HTML/xml/status_header.html and then added this line to my script:

objXMLDoc.validateOnParse = False

...but it still didn't work, so for the time being, I'll just continue to leave those two lines out of HTML/xml/status_header.html

I'm using MSXML2.DOMDocument.4.0

mherger
2006-03-21, 08:21
> I removed them both the DOCTYPE reference and the namespace.

And did it help?

> Nice googles, by the way.

Was a nice day, back then, I don't forget (hey, it was almost 20 years
back!). Backcountry skiing, powder, sun. And I left my boots at home. I
used a friend's leather army boots. But the goggles are mine :-).

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

jonheal
2006-03-21, 09:08
> I removed them both the DOCTYPE reference and the namespace.

And did it help?

> Nice googles, by the way.

Was a nice day, back then, I don't forget (hey, it was almost 20 years
back!). Backcountry skiing, powder, sun. And I left my boots at home. I
used a friend's leather army boots. But the goggles are mine :-).

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)
I guess I forgot to mention in my first reply that yes, that did the trick.

Those goggles will come in handy if someone gets you a Dufaux biplane for Christmas some year.

mherger
2006-03-21, 09:24
> I guess I forgot to mention in my first reply that yes, that did the
> trick.

would converting the link into an absolute path including server fix the
problem as well?

> Those goggles will come in handy if someone gets you a Dufaux biplane
> for Christmas some year.

I've been waiting for that day...

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

jonheal
2006-03-21, 09:34
> I guess I forgot to mention in my first reply that yes, that did the
> trick.

would converting the link into an absolute path including server fix the
problem as well?

> Those goggles will come in handy if someone gets you a Dufaux biplane
> for Christmas some year.

I've been waiting for that day...

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)
Nope, that didn't work. Also, removing the DOCTYPE, but leaving the namespace choked the script. I had to remove the namespace, as well.

jonheal
2006-03-21, 09:42
Now I'm having trouble getting Kevin's Execute Script plugin to run my file. I was hoping to have the plugin run the file on the Play event so I don't have to do something klugey like run a scheduled a task on my machine once a minute.

The script I'm trying to run is kind of naughty in that it both writes a file to the harddrive and also executes FTP, so maybe the Execute Script plugin doesn't like that sort of activity. I have the plugin working executing other scripts for other events, so it's working, in general.

kdf
2006-03-21, 10:03
On 21-Mar-06, at 8:42 AM, jonheal wrote:
>
> The script I'm trying to run is kind of naughty in that it both writes
> a file to the harddrive and also executes FTP, so maybe the Execute
> Script plugin doesn't like that sort of activity. I have the plugin
> working executing other scripts for other events, so it's working, in
> general.
>
the plugin makes no judgement. it simply makes a call to the system to
run the given filename.
If the system doesn't allow it, then it doesn't run, and the plugin
doesn't do any checks to make sure that it did run.
check permissions. check the log with d_plugins to watch what the
script is trying to do.
-k

geoffb
2006-03-21, 11:33
On 3/21/06, jonheal
<jonheal.250zvn1142954701 (AT) no-mx (DOT) forums.slimdevices.com> wrote:
>
> geoffb Wrote:
> > On 3/21/06, jonheal wrote:
> > >
> > > I'm trying to parse http://localhost:9000/xml/status.xml to grab
> > values
> > > in order to build a page on our public web site that shows what's
> > > currently playing on our SqueezeBox.
> > >
> > > I'm using VBScript and DOM.
> > >
> > > The "file" -- and I guess it's not really a file but generated on
> > the
> > > fly -- simply will not process because of one or both of these
> > lines:
> > >
> > > <!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
> > > <status xmlns="http://www.slimdevices.com/slimserver/xml">
> > >
> > > I have a feeling it's the DOCTYPE because of the relative path that
> > my
> > > script can't resolve.
> > >
> > > I can load the file, but attempting to get a value of a node fails.
> > > Anyone have any ideas on how I can get around this?
> >
> > Are you using MSXML? If so, which version of the DOM model are you
> > using?
> > It looks like the the parser is trying to check the dtd and can't.
> > Have you tried turning off validation in the XML reader?
> > Something like the validateOnParse property might help do this, see
> > the IXMLDOMDocument entry here:
> > http://tinyurl.com/qnttp
> >
> > Cheers
> > Geoff
>
> I put back the lines I had removed from HTML/xml/status_header.html and
> then added this line to my script:
>
> objXMLDoc.validateOnParse = False
>
> ...but it still didn't work, so for the time being, I'll just continue
> to leave those two lines out of HTML/xml/status_header.html
>
> I'm using MSXML2.DOMDocument.4.0
>

You might also want to try (in addition to the .validateOnParse):
objXMLDoc.resolveExternals = False

Cheers
Geoff

jonheal
2006-03-21, 12:59
On 3/21/06, jonheal
<jonheal.250zvn1142954701 (AT) no-mx (DOT) forums.slimdevices.com> wrote:
>
> geoffb Wrote:
> > On 3/21/06, jonheal wrote:
> > >
> > > I'm trying to parse http://localhost:9000/xml/status.xml to grab
> > values
> > > in order to build a page on our public web site that shows what's
> > > currently playing on our SqueezeBox.
> > >
> > > I'm using VBScript and DOM.
> > >
> > > The "file" -- and I guess it's not really a file but generated on
> > the
> > > fly -- simply will not process because of one or both of these
> > lines:
> > >
> > > <!DOCTYPE status SYSTEM "html/slimserver_xml.dtd">
> > > <status xmlns="http://www.slimdevices.com/slimserver/xml">
> > >
> > > I have a feeling it's the DOCTYPE because of the relative path that
> > my
> > > script can't resolve.
> > >
> > > I can load the file, but attempting to get a value of a node fails.
> > > Anyone have any ideas on how I can get around this?
> >
> > Are you using MSXML? If so, which version of the DOM model are you
> > using?
> > It looks like the the parser is trying to check the dtd and can't.
> > Have you tried turning off validation in the XML reader?
> > Something like the validateOnParse property might help do this, see
> > the IXMLDOMDocument entry here:
> > http://tinyurl.com/qnttp
> >
> > Cheers
> > Geoff
>
> I put back the lines I had removed from HTML/xml/status_header.html and
> then added this line to my script:
>
> objXMLDoc.validateOnParse = False
>
> ...but it still didn't work, so for the time being, I'll just continue
> to leave those two lines out of HTML/xml/status_header.html
>
> I'm using MSXML2.DOMDocument.4.0
>

You might also want to try (in addition to the .validateOnParse):
objXMLDoc.resolveExternals = False

Cheers
Geoff
That didn't work either. Oh well, I don't mind deleting the few lines from the file that I did.

jonheal
2006-03-21, 13:03
On 21-Mar-06, at 8:42 AM, jonheal wrote:
>
> The script I'm trying to run is kind of naughty in that it both writes
> a file to the harddrive and also executes FTP, so maybe the Execute
> Script plugin doesn't like that sort of activity. I have the plugin
> working executing other scripts for other events, so it's working, in
> general.
>
the plugin makes no judgement. it simply makes a call to the system to
run the given filename.
If the system doesn't allow it, then it doesn't run, and the plugin
doesn't do any checks to make sure that it did run.
check permissions. check the log with d_plugins to watch what the
script is trying to do.
-k
I am at a bit of a loss. I'm sure it's a permissions issue somewhere. Double-clicking on the file works fine, but then I am an administrator on this machine. I tried callling the .vbs file from a .bat file because I thought they executed under SYSTEM's authority, but that didn't work either. (Double-clicking the .bat file works, too.)

I have given the EVERYONE user execute permission on the script and the scripts folder (which contains the scripts and the file that the script writes) has MODIFY permission for the EVERYONE user.

The log shows nothing too interesting:

2006-03-21 14:59:58.2131 Execute: loading scripts from C:/Program Files/SlimServer/server/scripts
2006-03-21 14:59:58.2150 Execute: found ADCOM_OFF.vbs
2006-03-21 14:59:58.2152 Execute: found ADCOM_ON.vbs
2006-03-21 14:59:58.2152 Execute: found FTPScript.txt
2006-03-21 14:59:58.2153 Execute: found FTP_COVER.bat
2006-03-21 14:59:58.2153 Execute: found FTP_COVER.vbs
2006-03-21 15:00:01.9771 Execute: path: C:/Program Files/SlimServer/server/scripts
2006-03-21 15:00:01.9772 Execute: file: C:\Program Files\SlimServer\server\scripts\FTP_COVER.bat
2006-03-21 15:00:01.9773 Execute: Executing: C:\Program Files\SlimServer\server\scripts\FTP_COVER.bat

kdf
2006-03-21, 14:15
Quoting jonheal <jonheal.251cub1142971501 (AT) no-mx (DOT) forums.slimdevices.com>:

> 2006-03-21 15:00:01.9772 Execute: file: C:\Program
> Files\SlimServer\server\scripts\FTP_COVER.bat
> 2006-03-21 15:00:01.9773 Execute: Executing: C:\Program
> Files\SlimServer\server\scripts\FTP_COVER.bat
>
assuming that what you are trying to have executed is FTP_COVER.bat,
then this would indicate that all is well as far as the plugin is
concerned. After that debug message, the plugin displays a message on
the player, and makes the call. One thing is that the path has a space
in it. I'd recommend trying a script path that has no spaces, but
since your other scripts work I expect this isn't a problem.

-k

jonheal
2006-03-21, 19:19
Quoting jonheal <jonheal.251cub1142971501 (AT) no-mx (DOT) forums.slimdevices.com>:

> 2006-03-21 15:00:01.9772 Execute: file: C:\Program
> Files\SlimServer\server\scripts\FTP_COVER.bat
> 2006-03-21 15:00:01.9773 Execute: Executing: C:\Program
> Files\SlimServer\server\scripts\FTP_COVER.bat
>
assuming that what you are trying to have executed is FTP_COVER.bat,
then this would indicate that all is well as far as the plugin is
concerned. After that debug message, the plugin displays a message on
the player, and makes the call. One thing is that the path has a space
in it. I'd recommend trying a script path that has no spaces, but
since your other scripts work I expect this isn't a problem.

-k
I couldn't get the script to execute on the Play event at all. It did appear to execute on the Open File event, as in, I saw the script path on the SB for a few moments after hitting the Play button for a song. But the script did not execute, at least not entirely.

The first thing the script does is parse the status xml. Next it creates a file to be passed to Windows FTP.exe. That file is not being created. I went so far as to give EVERYONE Full Control of the scripts folder and everything in it.

Could it be that Execute.pm needs more permissions, and perhaps something else as well? Under which user authority does it operate in Windows?

As I said earlier, double-clicking on the script to launch it works fine.

Thanks for your help.

kdf
2006-03-21, 20:36
On 21-Mar-06, at 6:19 PM, jonheal wrote:
>
>
> Could it be that Execute.pm needs more permissions? Under which user
> authority does it operate in Windows?
>
I would assume that it would simply be the same user that runs
slimserver. if it is running as a service, the script might have
problems accessing networking resources, perhaps. i really can't say
for sure; I don't run the server on windows and don't test my plugins
on windows.

When testing under linux, I run command-line and add debugs to the
script. I can't suggest much more, since it hasn't really been that
problematic when it comes to testing. Make sure you have the right
version downloaded for the right version of the server as well. The
command API changed for 6.5

-kdf

jonheal
2006-03-22, 11:19
> I guess I forgot to mention in my first reply that yes, that did the
> trick.

would converting the link into an absolute path including server fix the
problem as well?

> Those goggles will come in handy if someone gets you a Dufaux biplane
> for Christmas some year.

I've been waiting for that day...

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)
Michael,

How do you update the SqueezeBox status on your web site? I've had to resort to scheduling a once-a-minute task.

snarlydwarf
2006-03-22, 11:34
I'm not Michael, but I use the old 'WebLogger' plugin.

It required a couple minor changes to be happy with 6.5b1, but works fine.

http://www.regoroad.com/blog/_archives/2004/9/12/138828.html

jonheal
2006-03-22, 12:08
I'm not Michael, but I use the old 'WebLogger' plugin.

It required a couple minor changes to be happy with 6.5b1, but works fine.

http://www.regoroad.com/blog/_archives/2004/9/12/138828.html
Thanks for the tip. Unfortunately, I suffer from a severe case of "Not invented here" syndrome, and since I've already put a fair amount of effort into my attempt to do the same thing, I'm going to press on. :-)

mherger
2006-03-23, 00:50
> I'm not Michael, but I use the old 'WebLogger' plugin.

I am Michael, and I'm using the same plugin.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

jonheal
2006-03-25, 10:18
I've almost got my status page working. But I'm hung up on one last issue. My script times out attempting to open the status.xml.

Here's the offending code:

objXMLDoc.SetProperty "ServerHTTPRequest", True
objXMLDoc.Async = False
objXMLDoc.Load ("http://localhost:9000/xml/status.xml")
objXMLDoc.setProperty "SelectionLanguage", "XPath"

If I double-click on the script, the XML loads almost immediately and the script completes processing. When I execute the script from Kevin's Execute Script Plugin, it hangs until it times out.