I am trying to break up a massive XML into smaller more maintainable files by grouping relevant bits into a smaller XML. For example, here is my message with 100s of "message" elements.
<messages>
<message>...</message>
<message>...</message>
<message>...</message>
<message>...</message>
<message>...</message>
...
</messages>
So my plan was to do something like -
<messages>
<xi:include href="first_10_messages.xml" />
<xi:include href="next_10.xml" />
<xi:include href="another_10.xml" />
...
<!-- other messages as is below -->
<message>...</message>
<message>...</message>
...
</messages>
The XMLs in the xi:include, are not valid XML as they dont have a root element. Is this possible?
When I apply schema validation on this I get the following error - "the markup in the document following the root element must be well-formed".
As a test, if I have a single <message>
in the included file, it works fine as its valid XML.
I am parsing/validating the xml in Java using the DocumentBuilder api.
Yes, the target of the XInclude needs to be a well-formed XML document in its own right.