doerr@usgs.gov

convert file to XMLPersistedObject

Discussion created by doerr@usgs.gov on Apr 21, 2014
Ok, so I have a Mosaic Dataset that has an Attribute Table Function added to it (the attribute table is a dbf that contains Category names along with Red, Green, Blue values).  I exported the function as a template (rft.xml) file with the intention of using it when programmatically creating other Mosaic Datasets and using it in the arcpy.EditRasterFunction_management call.  I thought it'd be as simple as changing the dbf file name within the template to the correct dbf before making the arcpy.EditRasterFunction_management call.  Turns out it's not that simple.  The dbf file name is nowhere to be found in the template.  Instead I see this:

<Value xsi:type='typens:XMLPersistedObject'>
<Bytes>sT14Bu7l0RGwogAA+HgIIAAAAAABACgAAAB0AGUAcwB0AEwAQQBOAEQARgBJAFIARQAuADEAMgAw
AEUAVgBIAAAAAgAAAAAAGAAAAGQAQgBBAFMARQAgAFQAYQBiAGwAZQAAABEANVpx49ERqoIAwE+j
OhUBAAAAAQA8AAAARAA6AFwAaQBzAF8AcwBlAHIAdgBlAHIAXwBjAG8AbgBmAGkAZwBcAGUAeABw
AG8AcgB0AFwATQBEAAAAAgAAAAAAHgAAAFMAaABhAHAAZQBmAGkAbABlACAARABhAHQAYQAAABFa
jlib0NERqnwAwE+jOhUCAAAAAQABAAAAEgAAAEQAQQBUAEEAQgBBAFMARQAAAAgAPAAAAEQAOgBc
AGkAcwBfAHMAZQByAHYAZQByAF8AYwBvAG4AZgBpAGcAXABlAHgAcABvAHIAdABcAE0ARAAAAAGW
22qgXNnREaqBAMBPozoVAAAAAA==
</Bytes>
</Value>

I've determined that the above value does contain the dbf file name and that it's a serialized file object of some type.
I don't know how to get from a file name such as "D:\dbfs\test.dbf" to that XMLPersistedObject data above, though.
Would somebody provide me some C# code or Python code for doing that?

On a side note I exported the template for the Colormap Function and it stores the clr file name as a regular old text string like this:
<Value xsi:type='xs:string'>D:\services_mosaicdatasets\dbfs\Image.clr</Value>

Which is what I expected of the Attribute Table Function template.

Anyway, I appreciate any help you might provide.
Thank you.

Outcomes