I'm writing a program in Java that uses the prefuse library. The program generates graphs from information collected from twitter. I'm trying to make my program to save the generated graphs so later I can load them.
The prefuse class GraphMLWriter works fine and it generates a graphml encoded in UTF-8 and xml version: 1.0.
My problem appears when I want to load the generated graphml file. To do that I use the method readGraph(InputStream is) of the class GraphMLReader. This method return a Graph object and use a SaxParser to parse the graphml file with a handler object of the class GraphMLHandler. This object constructs the graph as de parser parse all the lines of the xml file. I'm getting a SAXParseException throwed by prefuse.data.io.DataIOException when the xml file has characters like 'á' or 'ñ' or emoticons. All the xml files generated contains Strings that represent tweets.
An example is:
<data key="info">Las extraño muchooooo a ambas! ��</data>
The error says:
Exception in thread "main" prefuse.data.io.DataIOException: >org.xml.sax.SAXParseException; lineNumber: 165; columnNumber: 67; The character reference "&#
and nothing else, it seems that the error message is cut.
These is the code that I use to save a graph object 'g' into and GraphML called "Saved graph":
(new GraphMLWriter()).writeGraph(graph, "Graph saved");
And these is the one which I use to load the graph into a graph 'g2' generated from a GraphML file called "Graph saved"
Graph g2 = (new GraphMLReader().readGraph("Graph saved"));
What can I do to resolve this problem?