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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:53:34+00:00 2026-05-17T22:53:34+00:00

This is XML <?xml version=1.0 encoding=UTF-8?> <person> <fullname>Guilherme</fullname> <age>10</age> <address>address,address,address,address,</address> </person> <person> <fullname>Guilherme</fullname> <age>10</age>

  • 0

This is XML

<?xml version="1.0" encoding="UTF-8"?>
<person>  
  <fullname>Guilherme</fullname>
  <age>10</age>
  <address>address,address,address,address,</address>
</person>

<person>  
  <fullname>Guilherme</fullname>
  <age>10</age>
  <address>address,address,address,address,</address>
</person>  

This is POJO,

public class Person {

    private String name;
    private int age;
    private String address;

    public Person(String name) {
        this.name = name;
    }

    public Person(String name, int age, String address) {
        this.name = name;
        this.age = age;
        this.address = address;
    }

    public Person() {
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

This is unmarshaller logic:

@Override
    public Object unmarshal(HierarchicalStreamReader reader,
            UnmarshallingContext context) {
        List<Person> persons = new ArrayList<Person>();
        while (reader.hasMoreChildren()) {

            Person person = new Person();
            reader.moveDown();
            System.out.println("+" + reader.getValue());
            person.setName(reader.getValue());
            reader.moveUp();
            reader.moveDown();
            System.out.println("+" + reader.getValue());
            person.setAge(Integer.parseInt(reader.getValue()));
            reader.moveUp();
            reader.moveDown();
            System.out.println("+" + reader.getValue());
            person.setAddress(reader.getValue());
            reader.moveUp();
            persons.add(person);
        }
        return persons;
    }  

I am getting following exception :

[Fatal Error] :8:2: The markup in the document following the root element must be well-formed.
Exception in thread "main" com.thoughtworks.xstream.io.StreamException:  : The markup in the document following the root element must be well-formed.
        at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:86)
        at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:70)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
        at com.mycompany.xstreamconvertersample.App.main(App.java:34)
Caused by: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
        at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:79)
        ... 3 more
------------------------------------------------------------------------
[ERROR]BUILD ERROR
  • 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-17T22:53:35+00:00Added an answer on May 17, 2026 at 10:53 pm

    The XML file is not well-formed. It cannot have two separate root elements, in your case <person>. There must be a single top-level element, such as <persons>, around both person elements.

    EDIT:
    In order to be well-formed, it would need to look like this

    <persons>
      <person>
        .
        .
      </person>
      <person>
        .
        .
      </person>
    <persons>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my xhtml code : <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC -//W3C//DTD
I have an XML file like this : <?xml version=1.0 encoding=UTF-8?> <!ELEMENT family (person)+>
I have an getting an xml response on this format <?xml version=\1.0\ encoding=\utf-8\?>\r\n <PlatformResponse
I have this XML at http://localhost/file.xml : <?xml version=1.0 encoding=utf-8?> <val:Root xmlns:val=http://www.hw-group.com/XMLSchema/ste/values.xsd> <Agent> <Version>2.0.3</Version>
Given this XML: <?xml version=1.0 encoding=utf-8?> <content dataType=XML> <item type=Promotion name=Sample Promotion expires=04/01/2009> <![CDATA[
Having this XML view: <?xml version=1.0 encoding=utf-8?> <LinearLayout android:id=@+id/myScrollLayout android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical xmlns:android=http://schemas.android.com/apk/res/android> <ScrollView
I am working on this from xslt cookbook type my.xml <?xml version=1.0 encoding=UTF-8?> <people>
I have an SOAP response that looks similar to this: <?xml version=1.0 encoding=UTF-8?> <soapenv:Envelope
I have an object which I serialize nicely into this: <?xml version=1.0 encoding=utf-8 ?>
I'm having trouble parsing this xml file using jquery: <?xml version=1.0 encoding=utf-8?> <?mso-infoPathSolution name=urn:schemas-microsoft-com:office:infopath:BOT-Memos:-myXSD-2011-07-13T14-29-57

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.