0

Long story short, I want to mask my XML file as a PNG in order to hack the import.

I'm rolling an XML file in R for import into a third party software. Although the XML is readable in that software via private classes, I cannot get the XML file to be read when imported through the image classes that're public. So far I've tried accessing those other classes to no avail.

Here's the very simplistic code I'm using to create the basic XML object:

namLegendOne <- paste0("Legend_1_", "SG_RUNID", ".xml")
fLOneName <- paste0(outFolder,namLegendOne)

write.table("<StyledText>", file = fLOneName, append = F, quote = F, row.names = F, col.names = F )
write.table("<Content>Consensus Clustering Confusion Marix of Cells vs Cells", file = fLOneName, append = T, quote = F, row.names = F, col.names = F )
write.table("Color Mapped by Similarity Score: ", file = fLOneName, append = T, quote = F, row.names = F, col.names = F )
write.table("0 (blue) = Non-Overlapping Asignments; 1 (red) = Unanimous Asignment to Cluster</Content>", file = fLOneName, append = T, quote = F, row.names = F, col.names = F )
write.table("</StyledText>", file = fLOneName, append = T, quote = F, row.names = F, col.names = F )

I have run this to generate the XML, and the file imports correctly when manually added to third party software. However I am unable to import the file using natively available API.

How can I hack the code above generate something that looks like a PNG.

taylori
  • 1
  • 1
  • 1
    How is this related to Java. If you say it should look like a png: to whom should it look like a png? How can an XML text file look like an image? – cmoetzing May 12 '19 at 23:42
  • Why are you even trying to use image classes to load text data? Read the XML directly, e.g. see [How to parse XML to R data frame](https://stackoverflow.com/q/17198658/5221149) – Andreas May 12 '19 at 23:46
  • Thanks for these feedbacks! - The reason I'm trying to read in an image is because that's the only area of the API that looks like it would allow me to import from my R outputs, (so admittedly this is a hack solution I'm trying). – taylori May 13 '19 at 19:32
  • This is related to Java because the API I'm trying to use for importing the StyledText XML file to is part of a Java based application. It is the imageURL importing method that I'm trying to co-opt for an alternative purpose. (adding the XML file) – taylori May 13 '19 at 19:34

0 Answers0