HMS

Home Media Server for Roku Players
git clone https://www.brianlane.com/git/HMS
Log | Files | Refs | README | LICENSE

commit d5cd5d3d8ee6b8e33001c078bf28788173abab78
parent d7b59e23a16e4589be64be632c4b479366ce0eab
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sat, 19 Nov 2022 10:58:12 -0800

Remove unused XML functions

Diffstat:
MHMS/source/generalUtils.brs | 193-------------------------------------------------------------------------------
1 file changed, 0 insertions(+), 193 deletions(-)

diff --git a/HMS/source/generalUtils.brs b/HMS/source/generalUtils.brs @@ -89,18 +89,6 @@ End Function '****************************************************** -'isxmlelement -' -'Determine if the given object supports the ifXMLElement interface -'****************************************************** -Function isxmlelement(obj as dynamic) As Boolean - if obj = invalid return false - if GetInterface(obj, "ifXMLElement") = invalid return false - return true -End Function - - -'****************************************************** 'islist ' 'Determine if the given object supports the ifList interface @@ -306,159 +294,6 @@ End Function '****************************************************** -'Get all XML subelements by name -' -'return list of 0 or more elements -'****************************************************** -Function GetXMLElementsByName(xml As Object, name As String) As Object - list = CreateObject("roArray", 100, true) - if islist(xml.GetBody()) = false return list - - for each e in xml.GetBody() - if e.GetName() = name then - list.Push(e) - endif - next - - return list -End Function - - -'****************************************************** -'Get all XML subelement's string bodies by name -' -'return list of 0 or more strings -'****************************************************** -Function GetXMLElementBodiesByName(xml As Object, name As String) As Object - list = CreateObject("roArray", 100, true) - if islist(xml.GetBody()) = false return list - - for each e in xml.GetBody() - if e.GetName() = name then - b = e.GetBody() - if type(b) = "roString" list.Push(b) - endif - next - - return list -End Function - - -'****************************************************** -'Get first XML subelement by name -' -'return invalid if not found, else the element -'****************************************************** -Function GetFirstXMLElementByName(xml As Object, name As String) As dynamic - if islist(xml.GetBody()) = false return invalid - - for each e in xml.GetBody() - if e.GetName() = name return e - next - - return invalid -End Function - - -'****************************************************** -'Get first XML subelement's string body by name -' -'return invalid if not found, else the subelement's body string -'****************************************************** -Function GetFirstXMLElementBodyStringByName(xml As Object, name As String) As dynamic - e = GetFirstXMLElementByName(xml, name) - if e = invalid return invalid - if type(e.GetBody()) <> "roString" return invalid - return e.GetBody() -End Function - - -'****************************************************** -'Get the xml element as an integer -' -'return invalid if body not a string, else the integer as converted by strtoi -'****************************************************** -Function GetXMLBodyAsInteger(xml As Object) As dynamic - if type(xml.GetBody()) <> "roString" return invalid - return strtoi(xml.GetBody()) -End Function - - -'****************************************************** -'Parse a string into a roXMLElement -' -'return invalid on error, else the xml object -'****************************************************** -Function ParseXML(str As String) As dynamic - if str = invalid return invalid - xml=CreateObject("roXMLElement") - if not xml.Parse(str) return invalid - return xml -End Function - - -'****************************************************** -'Get XML sub elements whose bodies are strings into an associative array. -'subelements that are themselves parents are skipped -'namespace :'s are replaced with _'s -' -'So an XML element like... -' -'<blah> -' <This>abcdefg</This> -' <Sucks>xyz</Sucks> -' <sub> -' <sub2> -' .... -' </sub2> -' </sub> -' <ns:doh>homer</ns:doh> -'</blah> -' -'returns an AA with: -' -'aa.This = "abcdefg" -'aa.Sucks = "xyz" -'aa.ns_doh = "homer" -' -'return an empty AA if nothing found -'****************************************************** -Sub GetXMLintoAA(xml As Object, aa As Object) - for each e in xml.GetBody() - body = e.GetBody() - if type(body) = "roString" then - name = e.GetName() - name = strReplace(name, ":", "_") - aa.AddReplace(name, body) - endif - next -End Sub - - -'****************************************************** -'Walk an AA and print it -'****************************************************** -Sub PrintAA(aa as Object) - print "---- AA ----" - if aa = invalid - print "invalid" - return - else - cnt = 0 - for each e in aa - x = aa[e] - PrintAny(0, e + ": ", aa[e]) - cnt = cnt + 1 - next - if cnt = 0 - PrintAny(0, "Nothing from for each. Looks like :", aa) - endif - endif - print "------------" -End Sub - - -'****************************************************** 'Walk a list and print it '****************************************************** Sub PrintList(list as Object) @@ -593,34 +428,6 @@ End Function '****************************************************** -'Walk an XML tree and print it -'****************************************************** -Sub PrintXML(element As Object, depth As Integer) - print tab(depth*3);"Name: [" + element.GetName() + "]" - if invalid <> element.GetAttributes() then - print tab(depth*3);"Attributes: "; - for each a in element.GetAttributes() - print a;"=";left(element.GetAttributes()[a], 4000); - if element.GetAttributes().IsNext() then print ", "; - next - print - endif - - if element.GetBody()=invalid then - ' print tab(depth*3);"No Body" - else if type(element.GetBody())="roString" then - print tab(depth*3);"Contains string: [" + left(element.GetBody(), 4000) + "]" - else - print tab(depth*3);"Contains list:" - for each e in element.GetBody() - PrintXML(e, depth+1) - next - endif - print -end sub - - -'****************************************************** 'Dump the bytes of a string '****************************************************** Sub DumpString(str As String)