views:

10

answers:

0

Hi everyone,

I have successfully created an XML file using XStream and a custom converter. The custom converter marshalls an object so it is nicely readable by humans as follows:

<Header clip="16:01:02:22 -&gt; 16:01:52:00" match clock="961">
  <match filename="MatchName" name="Jets vs Giants" date="2009-11-29 16:00:00.0"/>
</Header>

However, when I try to demarshall the file, I get the error:

com.thoughtworks.xstream.io.StreamException:  : expected = after attribute name (position: START_DOCUMENT seen <Header clip="16:01:02:22 -&gt; 16:01:52:00" match c... @1:52) 
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:78)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:137)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:130)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:109)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:94)
at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:48)
at com.thoughtworks.xstream.io.xml.XppDriver.createReader(XppDriver.java:44)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:881)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:871)
at com.sony.eu.fmee.metadata.client.XMLDecode.decode(XMLDecode.java:53)
at com.sony.eu.fmee.metadata.client.XMLDecode.main(XMLDecode.java:18)
Caused by: org.xmlpull.v1.XmlPullParserException: expected = after attribute name (position: START_DOCUMENT seen <Header clip="16:01:02:22 -&gt; 16:01:52:00" match c... @1:52) 
at org.xmlpull.mxp1.MXParser.parseAttribute(MXParser.java:2004)
at org.xmlpull.mxp1.MXParser.parseStartTag(MXParser.java:1799)
at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1479)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:63)
... 10 more

Can anyone perhaps point me in the right direction? I know the string is being correctly parsed from the file and all I'm doing in the custom unmarshal method is created an instance of the object to return.

public Object unmarshal(HierarchicalStreamReader reader,
        UnmarshallingContext context) {
    HeaderInformation headerInformation = new HeaderInformation();
    reader.moveDown();   
    headerInformation.setClipName(reader.getAttribute("clip"));
    reader.moveUp();

    return headerInformation;

Thanks Chris