jxon
jxon copied to clipboard
Order of XML data is lost
The natural order of XML elements is lost during a conversion to JSON.
<w:p w14:paraId="54C889A4" w14:textId="77777777" w:rsidR="00042680" w:rsidRDefault="00042680">
<w:r>
<w:t xml:space="preserve">This has a </w:t>
</w:r>
<w:hyperlink r:id="rId8" w:history="1">
<w:r w:rsidRPr="00042680">
<w:rPr>
<w:rStyle w:val="Hyperlink"/>
</w:rPr>
<w:t>hyperlink</w:t>
</w:r>
</w:hyperlink>
<w:r>
<w:t xml:space="preserve"> in it.</w:t>
</w:r>
</w:p>
...converts to...
{
"w:r": [
{
"w:t": {
"$xml:space": "preserve",
"_": "This has a "
}
},
{
"w:t": {
"$xml:space": "preserve",
"_": " in it."
}
}
],
"w:hyperlink": {
"w:r": {
"w:rPr": {
"w:rStyle": {
"$w:val": "Hyperlink"
}
},
"w:t": "hyperlink",
"$w:rsidRPr": "00042680"
},
"$r:id": "rId8",
"$w:history": "1"
},
"$w14:paraId": "54C889A4",
"$w14:textId": "77777777",
"$w:rsidR": "00042680",
"$w:rsidRDefault": "00042680"
}
The w:r
elements are combined and the order is lost, making impossible to determine how the document actually flowed.