Hello,
I am new to the forum and am not sure whether the issue I have is related to my XML or to the brightscript XML parsing routine, so I was hoping someone might point me in the right direction.
The code I am using is:
conn = CreateObject("roAssociativeArray")
conn.UrlCategoryFeed = sXMLREsp ' see XML text in post below
xml=CreateObject("roXmlElement")
if not xml.Parse(conn.UrlCategoryFeed) then
print "Can't parse feed - error loan_category_feed 128"
return invalid
endif
The result of running this code is that it always prints the error message in the brightscript debugger.
conn.UrlCategoryFeed is an associative array element, which I believe is also a string (am I misunderstanding this?). The XML in the element/string that I am attempting to parse is (validated by "print conn.UrlCategoryFeed" returning this same string):
<?xml version="1.0" encoding="utf-16"?><TestResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Success>true</Success><ErrorText>OK</ErrorText><BaseDirectory>G:\Video</BaseDirectory><Directories /><Files><FoundItem><IsDirectory>false</IsDirectory><Name>Air Mater (Pixar Short).jpeg</Name><Size>11230</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Air Mater (Pixar Short).mp4</Name><Size>90090791</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Boundin' (Pixar Short).jpeg</Name><Size>9293</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Boundin' (Pixar Short).mp4</Name><Size>84214597</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Burn-E (Pixar Short).jpeg</Name><Size>6394</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Burn-E (Pixar Short).mp4</Name><Size>86745997</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Day & Night (Pixar Short).jpeg</Name><Size>7344</Size><Duration>0</Duration><Items>0</Items></FoundItem><FoundItem><IsDirectory>false</IsDirectory><Name>Day & Night (Pixar Short).mp4</Name><Size>72547816</Size><Duration>0</Duration><Items>0</Items></FoundItem></Files></TestResult>
Can anyone please help me understand why the XML parse is failing? I tried to validate the XML through various web tools, and they all indicate that it is valid. Would the special characters in the XML (e.g., & = & and ') be causing any issues. Any insight would be greatly appreciated!
Thank you!