Gathering detailed insights and metrics for xmldom
Gathering detailed insights and metrics for xmldom
Gathering detailed insights and metrics for xmldom
Gathering detailed insights and metrics for xmldom
@xmldom/xmldom
A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.
xmldom-sre
A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.
@types/xmldom
TypeScript definitions for xmldom
xmldom-qsa
Based on @xmldom/xmldom with some minor enhancements. Add querySelector, querySelectorAll and match method to Document and Element.
A pure JavaScript W3C standard-based (XML DOM Level 2 Core) `DOMParser` and `XMLSerializer` module.
npm install xmldom
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.6
Supply Chain
99.6
Quality
78.5
Maintenance
25
Vulnerability
100
License
HTML (55.5%)
JavaScript (44.38%)
Handlebars (0.07%)
Shell (0.04%)
Total Downloads
930,483,430
Last Day
259,921
Last Week
1,156,453
Last Month
5,176,382
Last Year
76,642,162
375 Stars
854 Commits
90 Forks
8 Watching
7 Branches
56 Contributors
Minified
Minified + Gzipped
Latest Version
0.6.0
Package Id
xmldom@0.6.0
Size
26.52 kB
NPM Version
6.14.12
Node Version
10.24.1
Publised On
17 Apr 2021
Cumulative downloads
Total Downloads
Last day
-5.3%
259,921
Compared to previous day
Last week
-15%
1,156,453
Compared to previous week
Last month
1.6%
5,176,382
Compared to previous month
Last year
-30.5%
76,642,162
Compared to previous year
A JavaScript implementation of W3C DOM for Node.js, Rhino and the browser. Fully
compatible with W3C DOM level2
; and some compatible with level3
. Supports
DOMParser
and XMLSerializer
interface such as in browser.
Original project location: https://github.com/jindw/xmldom
npm install xmldom
1const { DOMParser } = require('xmldom') 2 3const doc = new DOMParser().parseFromString( 4 '<xml xmlns="a" xmlns:c="./lite">\n' + 5 '\t<child>test</child>\n' + 6 '\t<child></child>\n' + 7 '\t<child/>\n' + 8 '</xml>', 9 'text/xml' 10) 11doc.documentElement.setAttribute('x', 'y') 12doc.documentElement.setAttributeNS('./lite', 'c:x', 'y2') 13console.info(doc) 14 15const nsAttr = doc.documentElement.getAttributeNS('./lite', 'x') 16console.info(nsAttr)
Note: in Typescript and ES6 you can use the import approach, as follows:
1import { DOMParser } from 'xmldom'
1parseFromString(xmlsource,mimeType)
1//added the options argument 2new DOMParser(options) 3 4//errorHandler is supported 5new DOMParser({ 6 /** 7 * locator is always need for error position info 8 */ 9 locator:{}, 10 /** 11 * you can override the errorHandler for xml parser 12 * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html 13 */ 14 errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback} 15 //only callback model 16 //errorHandler:function(level,msg){console.log(level,msg)} 17}) 18
1serializeToString(node)
attribute:
nodeValue|prefix
readonly attribute:
nodeName|nodeType|parentNode|childNodes|firstChild|lastChild|previousSibling|nextSibling|attributes|ownerDocument|namespaceURI|localName
method:
insertBefore(newChild, refChild)
replaceChild(newChild, oldChild)
removeChild(oldChild)
appendChild(newChild)
hasChildNodes()
cloneNode(deep)
normalize()
isSupported(feature, version)
hasAttributes()
DOMException
The DOMException class has the following constants (and value
of type Number
):
DOMException.INDEX_SIZE_ERR
(1
)DOMException.DOMSTRING_SIZE_ERR
(2
)DOMException.HIERARCHY_REQUEST_ERR
(3
)DOMException.WRONG_DOCUMENT_ERR
(4
)DOMException.INVALID_CHARACTER_ERR
(5
)DOMException.NO_DATA_ALLOWED_ERR
(6
)DOMException.NO_MODIFICATION_ALLOWED_ERR
(7
)DOMException.NOT_FOUND_ERR
(8
)DOMException.NOT_SUPPORTED_ERR
(9
)DOMException.INUSE_ATTRIBUTE_ERR
(10
)DOMException.INVALID_STATE_ERR
(11
)DOMException.SYNTAX_ERR
(12
)DOMException.INVALID_MODIFICATION_ERR
(13
)DOMException.NAMESPACE_ERR
(14
)DOMException.INVALID_ACCESS_ERR
(15
)The DOMException object has the following properties: code This property is of type Number.
method:
hasFeature(feature, version)
createDocumentType(qualifiedName, publicId, systemId)
createDocument(namespaceURI, qualifiedName, doctype)
Document : Node
readonly attribute:
doctype|implementation|documentElement
method:
createElement(tagName)
createDocumentFragment()
createTextNode(data)
createComment(data)
createCDATASection(data)
createProcessingInstruction(target, data)
createAttribute(name)
createEntityReference(name)
getElementsByTagName(tagname)
importNode(importedNode, deep)
createElementNS(namespaceURI, qualifiedName)
createAttributeNS(namespaceURI, qualifiedName)
getElementsByTagNameNS(namespaceURI, localName)
getElementById(elementId)
DocumentFragment : Node
Element : Node
readonly attribute:
tagName
method:
getAttribute(name)
setAttribute(name, value)
removeAttribute(name)
getAttributeNode(name)
setAttributeNode(newAttr)
removeAttributeNode(oldAttr)
getElementsByTagName(name)
getAttributeNS(namespaceURI, localName)
setAttributeNS(namespaceURI, qualifiedName, value)
removeAttributeNS(namespaceURI, localName)
getAttributeNodeNS(namespaceURI, localName)
setAttributeNodeNS(newAttr)
getElementsByTagNameNS(namespaceURI, localName)
hasAttribute(name)
hasAttributeNS(namespaceURI, localName)
Attr : Node
attribute:
value
readonly attribute:
name|specified|ownerElement
readonly attribute:
length
method:
item(index)
readonly attribute:
length
method:
getNamedItem(name)
setNamedItem(arg)
removeNamedItem(name)
item(index)
getNamedItemNS(namespaceURI, localName)
setNamedItemNS(arg)
removeNamedItemNS(namespaceURI, localName)
CharacterData : Node
method:
substringData(offset, count)
appendData(arg)
insertData(offset, arg)
deleteData(offset, count)
replaceData(offset, count, arg)
Text : CharacterData
method:
splitText(offset)
Comment : CharacterData
readonly attribute:
name|entities|notations|publicId|systemId|internalSubset
Notation : Node
readonly attribute:
publicId|systemId
Entity : Node
readonly attribute:
publicId|systemId|notationName
EntityReference : Node
ProcessingInstruction : Node
attribute:
data
readonly attribute:
target
attribute:
textContent
method:
isDefaultNamespace(namespaceURI){
lookupNamespaceURI(prefix)
[Node] Source position extension;
attribute:
//Numbered starting from '1'
lineNumber
//Numbered starting from '1'
columnNumber
Stable Version
2
9.8/10
Summary
xmldom allows multiple root nodes in a DOM
Affected Versions
<= 0.6.0
9.8/10
Summary
Withdrawn: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') in @xmldom/xmldom and xmldom
Affected Versions
<= 0.6.0
2
6.5/10
Summary
Misinterpretation of malicious XML input
Affected Versions
<= 0.6.0
4.3/10
Summary
Misinterpretation of malicious XML input
Affected Versions
< 0.5.0
Patched Versions
0.5.0
Reason
no binaries found in the repo
Reason
29 out of 29 merged PRs checked by a CI test -- score normalized to 10
Reason
project has 11 contributing companies or organizations
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
project is fuzzed
Details
Reason
license file detected
Details
Reason
30 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 7
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
badge detected: Passing
Reason
Found 3/6 approved changesets -- score normalized to 5
Reason
Project has not signed or included provenance with any releases.
Details
Score
Last Scanned on 2025-02-01T18:03:29Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More