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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:52:07+00:00 2026-06-01T13:52:07+00:00

I have the following invalid XML file: <?xml version=1.0 encoding=utf-8 ?> <Page num=1 crop_box=0,

  • 0

I have the following invalid XML file:

<?xml version="1.0" encoding="utf-8" ?>
<Page num="1" crop_box="0, 0, 595, 842" media_box="0, 0, 595, 842" rotate="0">
    <Flow id="1">
        <Para id="1">
            <Line box="90, 754.639, 120.038, 12">
                <Word box="90, 754.639, 22.6704, 12">This</Word>
            </Line>
        </Para>
    </Flow>
</Page>
<?xml version="1.0" encoding="utf-8" ?>
<Page num="1" crop_box="0, 0, 595, 842" media_box="0, 0, 595, 842" rotate="0">
    <Flow id="1">
        <Para id="1">
            <Line box="90, 754.639, 120.038, 12">
                <Word box="90, 754.639, 22.6704, 12">This</Word>
            </Line>
        </Para>
    </Flow>
</Page>

While it is structurally invalid (it has two root elements and the XML prologue shows up twice), it can still be correctly parsed (ie. the tags are correct and content is also correct).

So, the question is, is there a StAX (or any other streaming based) XML parser in Java that would allow me to do that? I have checked all options in XMLInputFactory but none of them seem to allow the parser to accept this kind of malformed XML.

  • 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-01T13:52:09+00:00Added an answer on June 1, 2026 at 1:52 pm

    i seriously doubt you will be able to get any standard java tool to parse the documents as is. however, you could find the boundaries yourself and parse the individual documents. just look for occurrences of "<?xml".

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

Sidebar

Related Questions

I have xml file whose structure is defined with following xsd: <?xml version=1.0 encoding=utf-8?>
I have an xml document: <?xml version=1.0 encoding=utf-8?> <Root> <Child name=MyType compareMode=EQ></Child> </Root> And
I have the following xml file <Layout xmlns=http://tempuri.org/Layout/> <Numeric Id=temperature Caption=Temperature> <validation:IsValidWhen xmlns:validation=http://tempuri.org/Validation/> </validation:IsValidWhen>
I have the following code snippet in my feature.xml <Feature Id=0c272f81-49c0-440a-a544-677d51a8ffe4 ReceiverAssembly=FeaturedMasterPage, Version 1.0.0.0,
I have the following xml file <xml> <network id=5> <nodelist> <IP>10.10.0.135::3111</IP> <IP>10.10.0.130::3111</IP> <IP>10.10.0.129::3111</IP> <IP>10.10.0.129::3111</IP>
I have looked at many examples for validating an XML file against a DTD,
I have a PHP script which reads from an xml file to generate a
Hi all i have my XML file as follows Name of XML XMLFile2.xml <?xml
I have a string that says the following characters are invalid: ! @ #
I have transformed an XML file See this question for a complete description What

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.