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 6663933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:33:14+00:00 2026-05-26T02:33:14+00:00

Simple library is great and i already parsed many different XML from soap servers

  • 0

Simple library is great and i already parsed many
different XML from soap servers since last 3 days, but i encountered
boolean attributes with “0” or “1” :

<list mybool1="0" mybool2="1" attr1="attr" attr2="attr">
    <page mybool3="1">
        ...
    </page>
    <page mybool3="0">
        ...
    </page>
    ...
</list>

I tried to create this class :

public class Boolean01Converter implements Converter<Boolean>
{
    @Override
    public Boolean read(InputNode node) throws Exception {
        return new Boolean(node.getValue().equals("1"));
    }
    @Override
    public void write(OutputNode node, Boolean value) throws Exception {
        node.setValue(value.booleanValue()?"1":"0");
    }
}

and implemented it on my object definition :

@Root(name="list")
public class ListFcts
{
    @Attribute
    @Convert(Boolean01Converter.class)
    private Boolean mybool1;

    @Attribute
    @Convert(Boolean01Converter.class)
    private Boolean mybool2;

    @Attribute
    private int ...

    @ElementList(name="page", inline=true)
    private List<Page> pages;

    public Boolean getMybool1() {
        return mybool1;
    }
}

But i still get false for every boolean.

[edit]
In fact, when i do this :

@Override
public Boolean read(InputNode node) throws Exception {
    return true;
}

i still get false for :

Serializer serial = new Persister();
ListFcts listFct = serial.read(ListFcts.class, soapResult);
if(listFct.getMybool1())
{
    //this never happens
}else{
    //this is always the case
}

so my Converter has no impact…

Also : how can I attach the converter to the Persister instead of
declaring it on @Attributes hundred times ?

Many thanks in advance !!

[edit2]

i give up with Converter, this is my own solution :

@Root(name="list")
public class ListFcts
{
    @Attribute
    private int mybool1;

    @Attribute
    private int mybool2;

    public int getMybool1() {
        return mybool1;
    }

    public Boolean isMybool1() {
        return (mybool1==1)?true:false;
    }

    ...
}
  • 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-05-26T02:33:15+00:00Added an answer on May 26, 2026 at 2:33 am

    i gave up with Converter, I heard about Transform but didn’t find how to use it so this is my own basic solution :

    @Root(name="list")
    public class ListFcts
    {
        @Attribute
        private int mybool1;
    
        @Attribute
        private int mybool2;
    
        public int getMybool1() {
            return mybool1;
        }
    
        public Boolean isMybool1() {
            return (mybool1==1)?true:false;
        }
    
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a simple Graph library for my uni project and since this is
I'm familiar with ftplib and it works great for simple interface but I need
I have been using the Graphview library, and its working great for my simple
I'm using the Netty library (version 4 from GitHub). It works great in Scala,
Currently I'm trying to use John Resigs Simple Javascript Inheritence library, this works great
I have developed a simple library in Ruby and need to use this in
Is there a simple library to benchmark the time it takes to execute a
I am developing a simple library in C, for my own + some friends
I am just setting up a simple library application, basically a collection of Members
I've been trying to use SWIG to wrap around a simple library that uses

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.