You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a document needs to import the standard libraries to use any of the node definitions available.
This get's embedded inside the working document. When writing to XML, this content get's embedded inside the
document which can often be undesirable.
You thus need to either create a write predicate function and pass this over to XmlWriteOptions or
traverse and prune yourself. This is highly dependent on knowing to look for items with source URIs.
Proposal 1
Add a new convenience option on XmlWriteOptions to automatically strip out these libraries using a built in / predefined predicate.
Perhaps something as simple as a writeLibraries boolean. If this was done by default then the user would only provide the options to disable -- but this breaks current behaviour so is probably undesirable.
Proposal 2
Add a convenient function to strip out library content (referenced content). Something like this:
defremoveReferencedElements(doc):
""" Remove any elements which are referenced in. That is has a source URI. """forelemindoc.getChildren():
ifelem.hasSourceUri():
doc.removeChild(elem.getName())
(The alternative of keeping reference documents for standard libraries -- which would mean there is nothing to prune
has already been proposed but no design has been finalized currently).
The text was updated successfully, but these errors were encountered:
Issue
Currently a document needs to import the standard libraries to use any of the node definitions available.
This get's embedded inside the working document. When writing to XML, this content get's embedded inside the
document which can often be undesirable.
You thus need to either create a write predicate function and pass this over to XmlWriteOptions or
traverse and prune yourself. This is highly dependent on knowing to look for items with source URIs.
Proposal 1
Add a new convenience option on
XmlWriteOptions
to automatically strip out these libraries using a built in / predefined predicate.Perhaps something as simple as a
writeLibraries
boolean. If this was done by default then the user would only provide the options to disable -- but this breaks current behaviour so is probably undesirable.Proposal 2
Add a convenient function to strip out library content (referenced content). Something like this:
(The alternative of keeping reference documents for standard libraries -- which would mean there is nothing to prune
has already been proposed but no design has been finalized currently).
The text was updated successfully, but these errors were encountered: