<ArrayOfMediaModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlueBridgeIntegration.Models">
<MediaModel>
<Archive_ID>6</Archive_ID>
<Archive_Title>Main</Archive_Title>
<Book>[a biblical book goes here]</Book>
<ChapterVerse>[chapter and verse go here]</ChapterVerse>
<Description>[description goes here]</Description>
<Image_Path>[link to image]</Image_Path>
<Large_Image_Path>[another link to image]</Large_Image_Path>
<MP3>[a true/false statement goes here]</MP3>
<MP4>[a true/false statement goes here]</MP4>
<Media_ID>9212</Media_ID>
<MessageDate>[date goes here]</MessageDate>
<Message_Number>20160622</Message_Number>
<Notes>[a long set of notes goes here]</Notes>
<PDF>[true/false statement]</PDF>
<RTMP_Path>/main/mp4</RTMP_Path>
<Series_ID>111</Series_ID>
<Series_Title>[a title goes here]</Series_Title>
<Spanish_Notes i:nil="true"/>
<Spanish_Title i:nil="true"/>
<Speaker>[a name goes here]</Speaker>
<SubTitle i:nil="true"/>
<Title>[a title goes here]</Title>
<audioFile i:nil="true"/>
<audioFileRTMP i:nil="true"/>
<videoFile i:nil="true"/>
<videoFileRTMP i:nil="true"/>
</MediaModel>
<MediaModel>...</MediaModel>
<MediaModel>...</MediaModel>
<MediaModel>...</MediaModel>
</ArrayOfMediaModel>
sub CreateRecentMenu()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
xml = CreateObject("roXMLElement")
xml_str = CreateObject("roString")
xml_str = GetXML("[url goes here]")
if xml.Parse(xml_str) then
For Each MediaModel in ArrayOfMediaModel
print "media" 'this is essentially a debugging statement. The Parse() function fails and "failure to parse" prints instead
end For
else
print "failure to parse"
end if
'I have more code beyond this point, but i have it all commented out for the sake of fixing the XML problem
end sub
Function GetXML(url as String) as string
link = CreateObject("roUrlTransfer")
link.setUrl(url)
link.SetCertificatesFile("common:/certs/ca-bundle.crt")
link.InitClientCertificates()
return link.GetToString()
end function
"belltown" wrote:
your code doesn't do any error-checking when you read the url, so there's no way to know what was actually read, if anything. At the very least, use the debugger or a Print statement to see what exact string is passed to the Parse() method.
Sub Main ()
xml = CreateObject ("roXmlElement")
data = ReadAsciiFile("pkg:/xml/data.xml")
Print data
result = xml.Parse(data)
Print result
Stop
End Sub
<ArrayOfMediaModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlueBridgeIntegration.Models">
<MediaModel>
<Archive_ID>6</Archive_ID>
<Archive_Title>Main</Archive_Title>
<Book>[a biblical book goes here]</Book>
<ChapterVerse>[chapter and verse go here]</ChapterVerse>
<Description>[description goes here]</Description>
<Image_Path>[link to image]</Image_Path>
<Large_Image_Path>[another link to image]</Large_Image_Path>
<MP3>[a true/false statement goes here]</MP3>
<MP4>[a true/false statement goes here]</MP4>
<Media_ID>9212</Media_ID>
<MessageDate>[date goes here]</MessageDate>
<Message_Number>20160622</Message_Number>
<Notes>[a long set of notes goes here]</Notes>
<PDF>[true/false statement]</PDF>
<RTMP_Path>/main/mp4</RTMP_Path>
<Series_ID>111</Series_ID>
<Series_Title>[a title goes here]</Series_Title>
<Spanish_Notes i:nil="true"/>
<Spanish_Title i:nil="true"/>
<Speaker>[a name goes here]</Speaker>
<SubTitle i:nil="true"/>
<Title>[a title goes here]</Title>
<audioFile i:nil="true"/>
<audioFileRTMP i:nil="true"/>
<videoFile i:nil="true"/>
<videoFileRTMP i:nil="true"/>
</MediaModel>
<MediaModel>
<Archive_ID>6</Archive_ID>
<Archive_Title>Main</Archive_Title>
<Book>[a biblical book goes here]</Book>
<ChapterVerse>[chapter and verse go here]</ChapterVerse>
<Description>[description goes here]</Description>
<Image_Path>[link to image]</Image_Path>
<Large_Image_Path>[another link to image]</Large_Image_Path>
<MP3>[a true/false statement goes here]</MP3>
<MP4>[a true/false statement goes here]</MP4>
<Media_ID>9212</Media_ID>
<MessageDate>[date goes here]</MessageDate>
<Message_Number>20160622</Message_Number>
<Notes>[a long set of notes goes here]</Notes>
<PDF>[true/false statement]</PDF>
<RTMP_Path>/main/mp4</RTMP_Path>
<Series_ID>111</Series_ID>
<Series_Title>[a title goes here]</Series_Title>
<Spanish_Notes i:nil="true"/>
<Spanish_Title i:nil="true"/>
<Speaker>[a name goes here]</Speaker>
<SubTitle i:nil="true"/>
<Title>[a title goes here]</Title>
<audioFile i:nil="true"/>
<audioFileRTMP i:nil="true"/>
<videoFile i:nil="true"/>
<videoFileRTMP i:nil="true"/>
</MediaModel>
</ArrayOfMediaModel>
------ Running dev 'Junk' main ------
<ArrayOfMediaModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlueBridgeIntegration.Models">
<MediaModel>
<Archive_ID>6</Archive_ID>
<Archive_Title>Main</Archive_Title>
<Book>[a biblical book goes here]</Book>
<ChapterVerse>[chapter and verse go here]</ChapterVerse>
<Description>[description goes here]</Description>
<Image_Path>[link to image]</Image_Path>
<Large_Image_Path>[another link to image]</Large_Image_Path>
<MP3>[a true/false statement goes here]</MP3>
<MP4>[a true/false statement goes here]</MP4>
<Media_ID>9212</Media_ID>
<MessageDate>[date goes here]</MessageDate>
<Message_Number>20160622</Message_Number>
<Notes>[a long set of notes goes here]</Notes>
<PDF>[true/false statement]</PDF>
<RTMP_Path>/main/mp4</RTMP_Path>
<Series_ID>111</Series_ID>
<Series_Title>[a title goes here]</Series_Title>
<Spanish_Notes i:nil="true"/>
<Spanish_Title i:nil="true"/>
<Speaker>[a name goes here]</Speaker>
<SubTitle i:nil="true"/>
<Title>[a title goes here]</Title>
<audioFile i:nil="true"/>
<audioFileRTMP i:nil="true"/>
<videoFile i:nil="true"/>
<videoFileRTMP i:nil="true"/>
</MediaModel>
<MediaModel>
<Archive_ID>6</Archive_ID>
<Archive_Title>Main</Archive_Title>
<Book>[a biblical book goes here]</Book>
<ChapterVerse>[chapter and verse go here]</ChapterVerse>
<Description>[description goes here]</Description>
<Image_Path>[link to image]</Image_Path>
<Large_Image_Path>[another link to image]</Large_Image_Path>
<MP3>[a true/false statement goes here]</MP3>
<MP4>[a true/false statement goes here]</MP4>
<Media_ID>9212</Media_ID>
<MessageDate>[date goes here]</MessageDate>
<Message_Number>20160622</Message_Number>
<Notes>[a long set of notes goes here]</Notes>
<PDF>[true/false statement]</PDF>
<RTMP_Path>/main/mp4</RTMP_Path>
<Series_ID>111</Series_ID>
<Series_Title>[a title goes here]</Series_Title>
<Spanish_Notes i:nil="true"/>
<Spanish_Title i:nil="true"/>
<Speaker>[a name goes here]</Speaker>
<SubTitle i:nil="true"/>
<Title>[a title goes here]</Title>
<audioFile i:nil="true"/>
<audioFileRTMP i:nil="true"/>
<videoFile i:nil="true"/>
<videoFileRTMP i:nil="true"/>
</MediaModel>
</ArrayOfMediaModel>
true
Current Function:
001: Sub Main ()
002: xml = CreateObject ("roXmlElement")
003: data = ReadAsciiFile("pkg:/xml/data.xml")
004: Print data
005: result = xml.Parse(data)
006: Print result
007:* Stop
008: End Sub
STOP (runtime error &hf7) in pkg:/source/Main.brs(7)
007: Stop
Backtrace:
#0 Function main() As Void
file/line: pkg:/source/Main.brs(8)
Local Variables:
global rotINTERFACE:ifGlobal
m roAssociativeArray refcnt=2 count:0
xml bsc:roXMLElement refcnt=1
data roString (2.1 was String) refcnt=1 val:"<ArrayOfMediaModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.d"...
result Boolean val:true
BrightScript Debugger>
"scaper12123" wrote:
is there any way you can share the zip application you made? The one that you said had the XML and was able to work on your Roku? It may be possible that my system is doing something weird to the XML when I try to compile the zip. I'd like to confirm or deny that possibility.
"belltown" wrote:
https://github.com/belltown/junk
"belltown" wrote:
It could be an encoding issue. Make sure the XML file is encoded in UTF-8 (or a subset thereof), with NO byte order mark.