0

I am trying to parse a XML file with multiple XML declarations.

<?xml version="1.0"?>
<Details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.example.com/KDD/ID/1">

and I'm getting the following exception

the processing target matching  "[xX][mM][lL]" is not allowed

My parser works perfectly if there is a single xml declaration. The XML file is very large and I cannot possibly go and remove all the tags. Is there any way to do this

2
  • 1
    Where are the multiple XML declarations? Commented Mar 12, 2014 at 22:06
  • One xml declaration followed by several lines of tags and then again a xml declaration .. This repeats Commented Mar 13, 2014 at 12:38

1 Answer 1

1

A well-formed XML Document may have only one XML Declaration and one Root Element.

A well-formed XML External Parsed Entity may have more than one root note, but still may have only one XML Declaration.

If you want this to parse, you're going to have to preprocess your input -- break it up into separate documents, or remove the extra XML Declaration -- or fix whatever's generating the document in the first place so it produces correct XML, which is in the long run the better answer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.