Premise HELP: Not all ampersands being converted by SYS within an XML tag?!?

Motorola Premise

etc6849

Senior Member
Please examine the XML code snippet below.  There appears to be non-converted ampersands within the XML tag?  I thought this was not allowed, and that SYS always substitiuted &'s for & (within an XML tag).
 
I have verified that the improperly formatted XML tags crash my server by taking the badload file and manually stripping out the xml tags without encoded &'s.
 
It seems SYS will not properly convert the image property (see: sys://Schema/System/Documents/Image).  This presents a huge problem as I'm writing a module for KODI that so far heavily relies on the Image property to display coverart in the Automation Browser.  The Image property is used a lot by the automation browser too.
 
How I've been setting the image property is like this by just setting image equal to a string.  Maybe this is the wrong way to use image?!?

oContentItem.Image = sFrontCoverPath

 
Any suggestions?  Please I hope someone has an easy fix.  I'm kind of stumped...
 

<Object ID="{E988BC29-D46B-489A-BF4D-6C511A0A3860}" Name="The Da Vinci Code / Angels &amp; Demons" Class="sys://Schema/Modules/KODI/Classes/VideoFolder" Title="The Da Vinci Code / Angels &amp; Demons" FolderID="5" CoverArt="\\HTPC\Movies\Angels & Demons\folder.jpg" Image="\\HTPC\Movies\Angels & Demons\folder.jpg" Fanart="\\HTPC\Movies\Angels & Demons\fanart.jpg" Rating="0" >

 
 
 
No suggestions?   sys://Schema/Modules/AutomationBrowser/ObjectGrid/GlobalScripts/RenderObjectsInGrid is the global script the AB is using to generate the grid of images under a media zone, specifically this part:

set imgProp = obj.FindClassProperty("Image")
if not imgProp is nothing then
img = obj.Image
if img <> "" then
Output = Output & "<IMG "
if CBool(objectGrid.Shadow) = true then
Output = Output & "style=""filter:progid:DXImageTransform.Microsoft.Shadow(direction=130, strength="
Output = Output & objectGrid.ShadowStrength
Output = Output & ");"" "
end if
Output = Output & sWidth & sHeight & " SRC=""" & obj.objectID & "!Image"">"

 
The Help file says this about FindClassProperty:

set imgProp = obj.FindClassProperty("Image") if not imgProp is nothing then img = obj.Image if img <> "" then Output = Output & "
 
The help file says this about FindClassProperty:
 
Code:
FindClassProperty Method Premise Scripting Reference Locate the property on a class or inheritance chain.object.FindClassProperty(Name) Argumentsobject (required)Any PremiseObject.Name (required)String with name of property.Returned ValuesPremiseObjectThe property object from the schema.ExampleDim obj 'output the property type of the PowerState propertySet obj = this.FindClassProperty("PowerState")DebugOut "the PowerState property is a " & obj.Class.Name & " property."Set obj = Nothing
 
My only thought is I could create my own new class property named Image, then create my own KODI file providers, folders and media content classes that use the new image property.  That way everything is compatible with the AB still, and hopefully if I define my class property called image as just a string property, SYS should be smart enough to convert the ampersands like normal.   Any thoughts on this approach?
 
This is confirmed bug in Premise. It is listed in School of Hard Knocks. There's no easy workaround other than avoiding the characters that Premise flubs. Writing your own code sounds like a solution though probably not an easy one.
 
The original confirmation came in 2005 from Steve Short of Motorola. Here's his post from the old PremiseSystems forum:
 
 
Malformed XDO if Image property links to a file name that contains & or '
 
Bug Report
 
Malformed XDO if Image property links to a file name that contains & or '
 
sshort 11-22-2005, 11:03 AM
 
There is a bug that was discovered that could cause a server xdo file to fail to load. The bug occurred when a user attempted to point the Image property for a TV Channel object to a file name that had an ampersand(&) in its name. In this case, the server allowed the file name and continued to work until the server was backed up and restarted. When restarted, the server will not be able to load and will generate a file in the Backups directory named "badload_slserver.xdo.xml". The server will then try to load the most recent backup it finds until it is able to load one. If it can't find any, it will start with an empty xdo.
 
The root of the bug is that the software isn't converting the ampersand to the proper XML format. Ampersands are one of the special characters in XML and instead of using "&", each instance of an ampersand must use "&amp;". This issue is also likely to occur if the file name contains the other special characters for XML(apostrophe, ampersand, greater than, less than, quotation marks, although Windows will not allow the last three in file names).
 
To prevent the issue from occurring, the file name will have to be changed. Otherwise, every time the server is backed up, it will occur again.
 
To recover from this issue, the user will want to take the following steps.
 
1. Open the badload_slserver.xdo.xml file with Internet Explorer. This may take several minutes depending on the file size.
 
2. After the file is finished loading scroll to the bottom of IE. A message similar to the following will appear:
Whitespace is not allowed at this location. Error processing resource badload_slserver.xdo.xml
<Object ID="{1C6472EF-3920-4F0A-BC7A-58D390023499}"
 
3. Copy the Object ID at the bottom of IE and open your latest server file that failed with a text editor such as notepad(with word wrap off). It should be named something like "backup002.bad".
 
4. Search for the Object ID, this will take you to the line that is causing the error.
 
5. You will now need to change the offending character in the image file path. You can do this one of two ways. Either by removing the ampersand or apostrophe from the Image file path or change the characters to their acceptable XML forms. If it is an ampersand you need to change it to "&amp;" without the quotes. If it is an apostrophe you will need to change it to "&apos;" without the quotes. For example: Image="%SYSROOT%icons\myIcons\TV\home & gardens.bmp" would be changed to Image="%SYSROOT%icons\myIcons\TV\home &amp; gardens.bmp"
 
6. Save the file in a location that you will remember and change its extension from .bad to .xdo
 
7. Connect a Builder to the server and Restore from Client with the xdo that you saved in step 6
 
8. Next, you will need to change the file name of the image and Image property of the object that caused the problem. If you don't, the same issue will reoccur the next time the server is backed up and restarted. For example, I would browse to my Program Files\SYS\icons\myIcons\TV folder and change the file named "home & gardens.bmp" to "home and gardens.bmp". I would then use the Builder and go to the Media section and look for my offending TV Channel and change its image property to match the changed file name.
 
Steve Short
 
Doh! I forgto to check there!

I've written auto library imports for KODI that include Channels, Movies, Music and TV Shows.

Since I'm auto importing, I have no control over the file path or image name. Automatic processes such as PVR recording ensure that at any point an ampersand may show up.

I tried making my own image class, but the AB still doesn't work, even if the naming is the same. I suspect this has something to do with this mysterious syntax (found under sys://Schema/Modules/AutomationBrowser/ObjectGrid/GlobalScripts/RenderObjectsInGrid):

Output = Output &amp; "SRC=""/sys/" &amp; Image.objectID &amp; "!Image""&gt;"
What is the "!Image" part doing? Does it tell the SYS connector to look for a property named "Image" or property with a class "Image?" I've tried both with no joy.

I think the easiest approach is to simply make new string properties name ImagePath and CoverArtPath for each media content object. Then I plan to modify sys://Schema/Modules/AutomationBrowser/ObjectGrid/GlobalScripts/RenderObjectsInGrid so as to display the images using an HTML image tag.

Then there's this mysterious property under sys://Schema/System/Documents/Image called ExtendedUI that has a default value of "{01F925CA-04F0-43F5-90A1-D4EB4BA9F50E}." I searched all the xdo files under my premise install directory looking for an object with that GUID, but found nothing.


123 said:
123, on 01 Sept 2015 - 18:34, said:
This is confirmed bug in Premise. It is listed in School of Hard Knocks. There's no easy workaround other than avoiding the characters that Premise flubs. Writing your own code sounds like a solution though probably not an easy one.
 
RenderObjectsInGrid generates HTML code for displaying Premise objects. The code fragment below creates an HTML IMG tag.
 
The image's source is an address in SYS's data repository "/sys/GUID!Image" where GUID is the image's identifier.
 
I'm no web expert but I think the syntax may be unique to SYS's web server. "!Image" may be a hint, for the SYS web server, indicating how to deliver the content identified by the GUID.       
       
       Output = Output & "<IMG "
       if CBool(objectGrid.Shadow) = true then
        Output = Output & "style=""filter:progid:DXImageTransform.Microsoft.Shadow(direction=130, strength="
        Output = Output & objectGrid.ShadowStrength
        Output = Output & ");"" "
       end if
       Output = Output & "ALIGN=MIDDLE SRC=""/sys/" & Image.objectID & "!Image"">"

       
       ​
 
Thanks for your help 123.  Too bad the AB isn't documented more.  Using word searches on the AB xdo file, it is clear that the only time !Image pops up is after an image GUID is referenced.
 
Using HTML image tags pointed to an ImagePath text property seems to work well, and avoids the ampersand issue altogether.  Hopefully I can get around to finishing the module and post it here for others.  I don't think there are too many modules like it given it's auto library import functions and full compatibility with mSense.  
 
Eventually I'll have KODI in several rooms, probably running on nVidia Shield boxes since they offer 4k support.  I don't have any 4k TV's now though...
 
Back
Top