Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
scaper12123
Visitor

how to debug xml?

I'm having an issue where I don't know how to debug xml files. I know there's formatting websites you can use but they don't tell me when the code itself is what's crashing. In the console, I get a message telling me that there was an error in the xml component and to see another port (specifically 8089) for details. I have no clue how to do this. Can anybody help me?
I AM THE ARCHMAGE... who is also rather new to Brightscript so forgive me for seeming inept at times.
0 Kudos
7 REPLIES 7
squirreltown
Roku Guru

Re: how to debug xml?

You say "in the console" so you must have logged in to some terminal program with "telnet (your Roku IP) 8085" to see the console output.
Just do that with "telnet (your Roku IP) 8089" instead in a new terminal window, then run your channel.
Kinetics Screensavers
0 Kudos
scaper12123
Visitor

Re: how to debug xml?

"squirreltown" wrote:
You say "in the console" so you must have logged in to some terminal program with "telnet (your Roku IP) 8085" to see the console output.
Just do that with 8089 instead in a new terminal window, then run your channel.


I've tried that before and it didn't work, but I'll give it a go

EDIT: That seemed to work. Thank you
I AM THE ARCHMAGE... who is also rather new to Brightscript so forgive me for seeming inept at times.
0 Kudos
squirreltown
Roku Guru

Re: how to debug xml?

"scaper12123" wrote:
"squirreltown" wrote:
You say "in the console" so you must have logged in to some terminal program with "telnet (your Roku IP) 8085" to see the console output.
Just do that with 8089 instead in a new terminal window, then run your channel.


I've tried that before and it didn't work, but I'll give it a go


Works here, but i don't have scenegraph stuff so i don't see output. It connects fine though.
Kinetics Screensavers
0 Kudos
belltown
Roku Guru

Re: how to debug xml?

"scaper12123" wrote:
I'm having an issue where I don't know how to debug xml files. I know there's formatting websites you can use but they don't tell me when the code itself is what's crashing. In the console, I get a message telling me that there was an error in the xml component and to see another port (specifically 8089) for details. I have no clue how to do this. Can anybody help me?

Are you using the Scene Graph API because you want a customized user interface rather than the standard user interface, or are you using it because you couldn't figure out how to do something using the standard Roku components? If the former, then be prepared for a very steep learning curve. If the latter, then you'd be better off trying to solve your original problem.
0 Kudos
scaper12123
Visitor

Re: how to debug xml?

"belltown" wrote:
"scaper12123" wrote:
I'm having an issue where I don't know how to debug xml files. I know there's formatting websites you can use but they don't tell me when the code itself is what's crashing. In the console, I get a message telling me that there was an error in the xml component and to see another port (specifically 8089) for details. I have no clue how to do this. Can anybody help me?

Are you using the Scene Graph API because you want a customized user interface rather than the standard user interface, or are you using it because you couldn't figure out how to do something using the standard Roku components? If the former, then be prepared for a very steep learning curve. If the latter, then you'd be better off trying to solve your original problem.


I'm using the XML stuff because I wanted a display to show a timer counting down to the next event the app is expected to show but, unfortunately, I found that I couldn't make nodes of any kind within my program. The console just kept telling me it could not create the node, without any explanation as to why. If I could get any sort of indicator as to why this is happening, that would help tremendously. I've been avoiding xml up until now because of the troubles i've been having with it.

For example, I'm getting a message in the console telling me that there is an unknown failure when I call the CreateScene function for the xml component I made. I'm not sure where this problem is coming from
I AM THE ARCHMAGE... who is also rather new to Brightscript so forgive me for seeming inept at times.
0 Kudos
belltown
Roku Guru

Re: how to debug xml?

That didn't really answer my question. I assume by "XML stuff" you mean the Scene Graph API. XML is nothing more that a structured way of representing data. XML is used by the Scene Graph API to represent the structure of a user-interface, but is also used in traditional Roku BrightScript programming to represent any structured data to be handled by a channel, e.g. an RSS feed. XML itself has nothing to do with creating timers.

If you choose to use the Scene Graph API then you have a lot of work ahead of you trying to figure out how to use it. If your only reason for using it is because you think it will allow you to display a countdown timer, then I'd recommend that you first attempt to develop your channel, including the countdown screen, using the standard components. If the channel doesn't look snazzy enough, then by all means redesign it to use the Scene Graph API.

Here's a simple example of a countdown screen using standard BrightScript components:


Sub Main ()
' GMT time when next event is to happen (e.g. 65 seconds from now)
dtNext = CreateObject ("roDateTime")
dtNext.FromSeconds (dtNext.AsSeconds () + 65)

' Display countdown screen
If displayCountdownScreen (dtNext)
' If countdown expired, display the video screen
displayVideoScreen ()
End If
End Sub

Function displayCountdownScreen (dtNext As Object) As Boolean
' Get the current GMT time
dtNow = CreateObject ("roDateTime")

' Don't display the countdown screen if time has already expired
secondsLeft = dtNext.AsSeconds () - dtNow.AsSeconds ()
If secondsLeft > 0
' Use an roImageCanvas to display a countdown timer
port = CreateObject ("roMessagePort")
ui = CreateObject ("roImageCanvas")
ui.SetMessagePort (port)
ui.SetLayer (0, {Color: "#303030"})
updateMessage (ui, secondsLeft)
prevUpdate = secondsLeft
ui.Show ()
' Loop until time expires or user presses a key
While True
' Check the timer every 500ms
msg = Wait (500, port)
' Invalid means that Wait timed out
If msg = Invalid
' Update the current time
dtNow.Mark ()
' Calculate how much time left
secondsLeft = dtNext.AsSeconds () - dtNow.AsSeconds ()
' Check if the countdown time has expired
If secondsLeft > 0
' Only update the screen if countdown timer has changed
If secondsLeft <> prevUpdate
updateMessage (ui, secondsLeft)
prevUpdate = secondsLeft
End If
Else
ui.Close ()
End If
Else If Type (msg) = "roImageCanvasEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsRemoteKeyPressed ()
ui.Close ()
End If
End If
End While
End If
' Return True if countdown timer has expired
Return secondsLeft <= 0
End Function

Function updateMessage (ui As Object, secondsLeft As Integer) As Void
LF = Chr (10)
uiMsg = "Your video will play in:" + LF + LF + secsToHMS (secondsLeft)
ui.SetLayer (1, {Text: uiMsg, TextAttrs: {Color: "#EBEBEB", Font: "Large"}})
End Function

Function secsToHMS (seconds As Integer) As String
h% = seconds / 3600
m% = (seconds - h% * 3600) / 60
s% = seconds Mod 60
Return h%.ToStr () + ":" + Right ("0" + m%.ToStr (), 2) + ":" + Right ("0" + s%.ToStr (), 2)
End Function

Function displayVideoScreen () As Void
Stop
End Function
0 Kudos
EnTerr
Roku Guru

Re: how to debug xml?

Worth mention, RTFM has bungled together both "classic" ("ro", SDK1.0) and "scenography" ("sg" and un-prefixed, SDK2.0) in such a way that it causes confusion. It might be intentional, because SG is the new imperial attire (but see also, Hanlon's razor).

Unless you are "senior engineer" level or better, i really really really advise against using SG - or chances are you will hate and abandon Roku platform promptly.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.