Note that there are some explanatory texts on larger screens.

plurals
  1. POEfficient merging of multiple, large xml files into one
    primarykey
    data
    text
    <p>I searched the web and I searched stackoverflow up and down. No solution. Although I found solutions how to do this within pure xslt <a href="https://stackoverflow.com/questions/102531/xslt-multiple-file-inputs">here</a>.</p> <p>But the problem is that the resulting xml will be several hundred MB large. So I must do this with SAX in Java. (please no xslt solution, although I tagged it with xslt ;-))</p> <p>Let me explain with more detail. I have several multiple xml files (preferable InputSteam's) which should be parsed. The files or InputStream's looks like</p> <p><strong>inputstream1</strong></p> <pre><code>&lt;root&gt; &lt;doc&gt; &lt;tag&gt;test1&lt;/tag&gt; &lt;/doc&gt; &lt;doc&gt; &lt;tag&gt;test2&lt;/tag&gt; &lt;/doc&gt; ... &lt;/root&gt; </code></pre> <p><strong>inputstream2</strong></p> <pre><code>&lt;root&gt; &lt;doc&gt; &lt;tag&gt;test3&lt;/tag&gt; &lt;/doc&gt; &lt;doc&gt; &lt;tag&gt;test4&lt;/tag&gt; &lt;/doc&gt; ... &lt;/root&gt; </code></pre> <p>inputstream1+inputstream2+...+inputstreamN = <strong>resulting xml</strong>. It will look like</p> <pre><code>&lt;root&gt; &lt;doc&gt; &lt;tag&gt;test1&lt;/tag&gt; &lt;/doc&gt; &lt;doc&gt; &lt;tag&gt;test2&lt;/tag&gt; &lt;/doc&gt; ... &lt;doc&gt; &lt;tag&gt;test3&lt;/tag&gt; &lt;/doc&gt; &lt;doc&gt; &lt;tag&gt;test4&lt;/tag&gt; &lt;/doc&gt; ... &lt;/root&gt; </code></pre> <p>Do someone has a solution or a link for this? Is this possible via implementing a custom InputSource or should I use a custom ContentHandler? Or is this possible with <a href="http://joost.sourceforge.net/" rel="nofollow noreferrer">joost/stx</a>?</p> <p>The nice thing if I could use a ContentHandler would be that I could apply some minor transformations (I already implemented this). But then the problem is that I don't know a way to pass multiple files or InputStream's as InputSource:</p> <pre><code>XMLReader xmlReader = XMLReaderFactory.createXMLReader(); xmlReader.setContentHandler(customHandler); xmlReader.parse(getInputSource()); // only one InputStream possible </code></pre> <p>or should I parse the InputStreams directly within my ContentHandler?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload