Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:45:29+00:00 2026-06-13T16:45:29+00:00

I am saving my configration details in an xml file its structure is somewat

  • 0

I am saving my configration details in an xml file its structure is somewat like this

<A>
    <b>
        <name>xxxxx</name>
        <age>xxxxx</age>
        <c>
          <someFeilds>yyyy</someFeilds>
        </c>
        <c>
          <someFeilds>yyyy</someFeilds>
        </c>
        <c>
          <someFeilds>yyyy</someFeilds>
        </c>
    </b>
    <b>
        <name>xxxxx</name>
        <age>xxxxx</age>
        <c>
            <someFeilds>yyyy</someFeilds>
        </c>
    </b>
</A>

I am able to marshal it to my DTO A whoes structure is

class A {
    public ArrayList<B> bdtoInst;
}
class B {
    public String name;
    public String age;
    public ArrayList<C> cdtoInst;
}
class C {
    public String someFeilds;
}

Xstream declartion is

    XStream xStream = new XStream();
    xStream.alias("A", A.class);
    xStream.addImplicitCollection(A.class, "bdtoInst");
    xStream.alias("b", B.class);
    xStream.addImplicitCollection(B.class, "cdtoInst");
    xStream.alias("c", C.class);

I am able to marshal it to my DTO, but when i unmarshal it, i am not getting the correct format, it is coming like this:

<A>
    <b>
        <name>xxxxx</name>
        <age>xxxxx</age>
        <c>
            <someFeilds>yyyy</someFeilds>
        </c>
        <c>
            <someFeilds>yyyy</someFeilds>
        </c>
        <c>
            <someFeilds>yyyy</someFeilds>
        </c>
        <c>
            <someFeilds>yyyy</someFeilds>
        </c>
    </b>
    <b>
        <name>xxxxx</name>
        <age>xxxxx</age>
        <c reference="../../b/c"/>
    </b>
</A>

I am using xstream-1.4.3.jar.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:45:30+00:00Added an answer on June 13, 2026 at 4:45 pm

    because of XPATH_RELATIVE_REFERENCES used in the xstream link:xstream.codehaus.org/graphs.html
    in the xstream declaration we have to add

      xstream.setMode(XStream.NO_REFERENCES);
    

    than instead of marking the refrence value will be placed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

between saving a key name like this for(var key in this.data) { var key_name
my desired app.config would be like this: <configSections> <sectionGroup name=QA_Environment> <section name=databases type=System.Configuration.NameValueSectionHandler/> <section
Problem When saving an image in the server using an absolute file name (eg.
Saving a Word 2003 document to XML and then back results in a reduced
I'm saving a struct into a .dat file. Lets suppose I have to edit
I have uploaded some images using uploadify and saving the original file in uploads
I'm trying to do file uploads with ruby 1.8 and it seems like there
My Code: // Read in Xml-file XmlDocument doc = new XmlDocument(); doc.Load(C:/Web.config); XmlNode d
When saving a form I deactivate the save button to avoid double submission. Save
After saving a String value into memcached using the Danga client, I attempted to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.