Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields are not serialized to XML by default #19

Open
andreififiita opened this issue Apr 25, 2018 · 0 comments
Open

Fields are not serialized to XML by default #19

andreififiita opened this issue Apr 25, 2018 · 0 comments

Comments

@andreififiita
Copy link

I made a simple bean (class Phone) with just 2 fields (Strings) but the XML does not contain the fields and their set values, unless I explicitly annotate the fields (with @text or @Attribute for example).

Is there a way to serialize all the fields by default?

Code is:

    Persister serializer = new Persister();
    ByteArrayOutputStream b = new ByteArrayOutputStream();

    Phone p = new Phone();
    p.setType("typexxx");
    p.setValue("1234567");

    try {
        serializer.write(p, b);
        String string = b.toString();
        Log.i("MyTag", string);
        return string;
    } catch (Exception e) {
        Log.e("ERR", "Error", e);
        return null;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant