jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • XStream
  • XSTR-486

Xstream throws com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$DuplicateFieldException if xml has more than one tag in xml

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: 1.3
  • Component/s: Core
  • Labels:
    None
  • JDK version and platform:
    1.5.0_04

Description

XML
=====
<Config>
<name>XXX</name>
<xslConfig>
<reportFormat>
<fileName>test.xsl</fileName>
<dir>H:\xml\data\xsl\</dir>
</reportFormat>
<reportFormat>
<fileName>pdf_cp.xsl</fileName>
<dir>H:\xml\data\xsl\</dir>
</reportFormat>
</xslConfig>
</Config>

Code
======

public class Config
{
private String name = null;
private XSLConfig xslConfig = null;

public class XSLConfig
{
ReportFormat reportFormat;
XSLConfig(ReportFormat reportFormat)

{ this.reportFormat= reportFormat; }

public ReportFormat getReportFormat()

{ return reportFormat; }

public void setReportFormat(ReportFormat reportFormat)

{ this.reportFormat= reportFormat; }

}
public class ReportFormat
{
String fileName = null;

String dir = null;

ReportFormat(String fileName, String dir)

{ this.dir = dir; this.fileName = fileName; }

public String getDir()

{ return dir; }

public String getFileName()

{ return fileName; }

public void setDir(String dir)

{ this.dir = dir; }

public void setFileName(String fileName)

{ this.fileName = fileName; }

}

public String getName()

{ return name; }

public void setName(String name)

{ this.name = name; }

public static void main(String[] arg)
{
BufferedReader reader = new BufferedReader(new FileReader(xmlFile));
String lineText;
while ((lineText = reader.readLine()) != null)

{ System.out.println(lineText); xmlString += lineText; }

reader.close();
XStream stream = new XStream(new DomDriver());
stream.setMode(XStream.NO_REFERENCES);
Config config = (Config) stream.fromXML(xmlString);
System.out.println(config);

}
}

I keep getting DuplicateFieldException . Could you pls advise. Thanks.

Activity

  • All
  • Comments
  • History
  • Activity
Hide
Permalink
Joerg Schaible added a comment - 03/Apr/08 1:44 AM

Please use the user's list to ask questions.

Show
Joerg Schaible added a comment - 03/Apr/08 1:44 AM Please use the user's list to ask questions.

People

  • Assignee:
    Joerg Schaible
    Reporter:
    Sanjeev Vaghel
Vote (0)
Watch (0)

Dates

  • Created:
    02/Apr/08 8:47 PM
    Updated:
    03/Apr/08 1:44 AM
    Resolved:
    03/Apr/08 1:44 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.