Converts an XML element, in the shape of xml-js's non-compact Element, into an XmlComponent tree.
Element
This function recursively processes the element and creates a tree of ImportedXmlComponent objects that match the structure of the original XML.
The XML element as an XmlElement
An ImportedXmlComponent tree, text string, or undefined
const component = convertToXmlComponent({ type: "element", name: "w:p", elements: [{ type: "element", name: "w:r", elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "Hello" }] }] }],}); Copy
const component = convertToXmlComponent({ type: "element", name: "w:p", elements: [{ type: "element", name: "w:r", elements: [{ type: "element", name: "w:t", elements: [{ type: "text", text: "Hello" }] }] }],});
Converts an XML element, in the shape of xml-js's non-compact
Element, into an XmlComponent tree.This function recursively processes the element and creates a tree of ImportedXmlComponent objects that match the structure of the original XML.