I am trying to parse an xml file. But i get this error:
org.w3c.dom.DOMException: Only one root element allowed
at the line:
Document doc = dBuilder.parse(getAssets().open("myfile.xml"));
Please help me solve this.
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You must have only one root, it means you must have only once a tag that surround every all tags. For example you can surround all your tags by
<root></root>Also, try to validate your xml file with an xml validator in order to see if your xml is malformed.