Skip to content

Commit

Permalink
serialize-parse xml to force xml:id recognizability
Browse files Browse the repository at this point in the history
  • Loading branch information
jpvoigt committed Feb 21, 2024
1 parent 963e063 commit fe80ba8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/store/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1465,8 +1465,11 @@ const dataModule = {
}

const deid = diplomaticElement.getAttribute('xml:id')
console.log(deid, dtDoc.querySelector('*[*|id="' + deid + '"]'))
const deids = Array.from(dtDoc.querySelectorAll('*[*|id]')).map(e => e.getAttribute('xml:id')).filter(s => s.substring(0, 1) === 'd')
const dtstr = new XMLSerializer().serializeToString(dtDoc)
console.log(dtstr.indexOf(deid))
const dtDoc2 = new DOMParser().parseFromString(dtstr, 'application/xml')
console.log(deid, dtDoc2.querySelector('*[*|id="' + deid + '"]'))
const deids = Array.from(dtDoc2.querySelectorAll('*[*|id]')).map(e => e.getAttribute('xml:id')).filter(s => s.substring(0, 1) === 'd')
console.log(deids, deid)

const dtPath = getters.currentWzDtPath
Expand All @@ -1483,7 +1486,7 @@ const dataModule = {
}
}

dispatch('loadDocumentIntoStore', { path: dtPath, dom: dtDoc })
dispatch('loadDocumentIntoStore', { path: dtPath, dom: dtDoc2 })
dispatch('logChange', { path: dtPath, baseMessage, param, xmlIDs: [diploMeasure.getAttribute('xml:id')], isNewDocument: false })

dispatch('loadDocumentIntoStore', { path: atPath, dom: atDoc })
Expand Down

0 comments on commit fe80ba8

Please sign in to comment.