I have a XML like following
<Jobs>
<job>
....
</job>
<job>
....
</job>
....
</Jobs>
Now what is best way to write each job node in a separate file without bringing the whole file in to memory using xmlreader and xmlwriter or anyother options?
It's early days yet for XSLT 3.0 and streaming, but the following XSLT 3.0 stylesheet should do the job in Saxon-EE 9.4:
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:mode streamable="yes" on-no-match="shallow-copy">
<xsl:template match="job">
<xsl:result-document href="job{position()}.xml">
<xsl:next-match/>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With