MCPcopy Create free account
hub / github.com/NaturalIntelligence/fast-xml-parser / addChild

Function addChild

src/xmlparser/OrderedObjParser.js:579–594  ·  view source on GitHub ↗
(currentNode, childNode, matcher, startIndex)

Source from the content-addressed store, hash-verified

577}
578
579function addChild(currentNode, childNode, matcher, startIndex) {
580 // unset startIndex if not requested
581 if (!this.options.captureMetaData) startIndex = undefined;
582
583 // Pass jPath string or matcher based on options.jPath setting
584 const jPathOrMatcher = this.options.jPath ? matcher.toString() : matcher;
585 const result = this.options.updateTag(childNode.tagname, jPathOrMatcher, childNode[":@"])
586 if (result === false) {
587 //do nothing
588 } else if (typeof result === "string") {
589 childNode.tagname = result
590 currentNode.addChild(childNode, startIndex);
591 } else {
592 currentNode.addChild(childNode, startIndex);
593 }
594}
595
596/**
597 * @param {object} val - Entity object with regex and val properties

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected