[Snyk] Upgrade @rgrove/parse-xml from 4.0.1 to 4.1.0 #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was automatically created by Snyk using the credentials of a real user.
Snyk has created this PR to upgrade @rgrove/parse-xml from 4.0.1 to 4.1.0.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Release notes
Package name: @rgrove/parse-xml
Added
Added a new
includeOffsets
parser option. #25When
true
, the starting and ending byte offsets of each node in the input string will be made available viastart
andend
properties on the node. The default isfalse
.This option is useful if you want to preserve the original source text of each node when later serializing a document back to XML. Previously, the original source text was always discarded, which meant that if you parsed a document and then serialized it, the original source text would be lost.
let xml = '<root><child /></root>';
let doc = parseXml(xml, { includeOffsets: true });
console.log(doc.root.toJSON());
// => { type: 'element', name: 'root', start: 0, end: 22, ... }
console.log(doc.root.children[0].toJSON());
// => { type: 'element', name: 'child', start: 6, end: 15, ... }
Added a new
preserveXmlDeclaration
parser option. #31When
true
, anXmlDeclaration
node representing the XML declaration (if there is one) will be included in the parsed document. Whenfalse
, the XML declaration will be discarded. The default isfalse
, which matches the behavior of previous versions.This option is useful if you want to preserve the XML declaration when later serializing a document back to XML. Previously, the XML declaration was always discarded, which meant that if you parsed a document with an XML declaration and then serialized it, the original XML declaration would be lost.
let xml = '<?xml version="1.0" encoding="UTF-8"?><root />';
let doc = parseXml(xml, { preserveXmlDeclaration: true });
console.log(doc.children[0].toJSON());
// => { type: 'xmldecl', version: '1.0', encoding: 'UTF-8' }
Added a new
preserveDocumentType
parser option. #32When
true
, anXmlDocumentType
node representing a document type declaration (if there is one) will be included in the parsed document. Whenfalse
, any document type declaration encountered will be discarded. The default isfalse
, which matches the behavior of previous versions.Note that the parser only includes the document type declaration in the node tree; it doesn't actually validate the document against the DTD, load external DTDs, or resolve custom entity references.
This option is useful if you want to preserve the document type declaration when later serializing a document back to XML. Previously, the document type declaration was always discarded, which meant that if you parsed a document with a document type declaration and then serialized it, the original document type declaration would be lost.
let xml = '<!DOCTYPE root SYSTEM "root.dtd"><root />';
let doc = parseXml(xml, { preserveDocumentType: true });
console.log(doc.children[0].toJSON());
// => { type: 'doctype', name: 'root', systemId: 'root.dtd' }
xml = '<!DOCTYPE kittens [<!ELEMENT kittens (#PCDATA)>]><kittens />';
doc = parseXml(xml, { preserveDocumentType: true });
console.log(doc.children[0].toJSON());
// => {
// type: 'doctype',
// name: 'kittens',
// internalSubset: '<!ELEMENT kittens (#PCDATA)>'
// }
Changed
XmlError
class, which extendsError
. These errors still have all the same properties as before, but now with improved type definitions. #27Fixed
Leading and trailing whitespace in comment content is no longer trimmed. This issue only affected parsing when the
preserveComments
parser option was enabled. #28Text content following a CDATA section is no longer appended to the preceding
XmlCdata
node. This issue only affected parsing when thepreserveCdata
parser option was enabled. #29Fixed
parseXml()
function'soptions
argument is now correctly marked as optional. [#23]Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs