node-xmlsplit
node-xmlsplit copied to clipboard
Splitting adds wrong closing tag
It seems that splitting the following file actually issues splitted XML document that are invalid as they end with an unexpected tag:
Get the xml to parse:
wget "http://sdw-wsrest.ecb.europa.eu/service/data/QSA/all/all?dimensionAtObservation=TIME_PERIOD&detail=nodata" --header="Accept:application/vnd.sdmx.structurespecificdata+xml;version=2.1" -O test.xml
Split with mistake:
<?xml version="1.0" encoding="UTF-8"?><message:StructureSpecificData xmlns:message="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message" xmlns:common="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:data="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/structurespecific" xmlns:na_sec="urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ESTAT:NA_SEC(1.5):ObsLevelDim:TIME_PERIOD" xsi:schemaLocation="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message http://t-sdw-pub-wsrest.zonelog.unix.tadnet.net:80/vocabulary/sdmx/2_1/SDMXMessage.xsd http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common http://t-sdw-pub-wsrest.zonelog.unix.tadnet.net:80/vocabulary/sdmx/2_1/SDMXCommon.xsd urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ESTAT:NA_SEC(1.5):ObsLevelDim:TIME_PERIOD http://t-sdw-pub-wsrest.zonelog.unix.tadnet.net:80/service/schema/datastructure/ESTAT/NA_SEC/1.5">
<message:Header>
<message:ID>d3a95668-9340-49b2-be1b-aec3d1e22b9b</message:ID>
<message:Test>false</message:Test>
<message:Prepared>2017-02-20T14:20:38.214+01:00</message:Prepared>
<message:Sender id="ECB"/>
<message:Structure structureID="NA_SEC" dimensionAtObservation="TIME_PERIOD" namespace="urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ESTAT:NA_SEC(1.5):ObsLevelDim:TIME_PERIOD">
<common:Structure>
<URN>urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ESTAT:NA_SEC(1.5)</URN>
</common:Structure>
</message:Structure>
</message:Header>
<message:DataSet data:action="Replace" data:validFromDate="2017-02-20T14:20:38.214+01:00" data:structureRef="NA_SEC" data:dataScope="DataStructure" xsi:type="na_sec:DataSetType">
<Series FREQ="A" ADJUSTMENT="N" REF_AREA="AT" COUNTERPART_AREA="_Z" REF_SECTOR="S1314" COUNTERPART_SECTOR="_Z" CONSOLIDATION="N" ACCOUNTING_ENTRY="C" STO="D29C" INSTR_ASSET="_Z" MATURITY="_Z" EXPENDITURE="_Z" UNIT_MEASURE="XDC" CURRENCY_DENOM="_Z" VALUATION="S" PRICES="V" TRANSFORMATION="N" CUST_BREAKDOWN="_T" UNIT_MULT="6" TIME_PER_COLLECT="S" TITLE=" Social security funds revenue from total wage bill and payroll taxes" COMPILING_ORG="4D0" COMMENT_TS="Austria - Total wage bill and payroll taxes - Credit (Resources) - Non-consolidated, Current prices - Domestic currency (incl. conversion to current currency made using a fix parity), Standard valuation based on SNA/ESA, Neither seasonally adjusted nor calendar adjusted data - Taxes and social contribution" DECIMALS="0">
</Series></URN>
where </URN>
should actually be </message:StructureSpecificData>
@Tzaphkiel thank you for the bug report.
I will take a look at that. Currently I'm quite busy with other tasks, so it could take a couple of weeks, though.
Alternatively I will review/accept PR.
Still Facing Same issue @remuslazar Wrong closing tag Please help !!!
The issue was only closing with the top level tag, doesn't close properly with deep tag.