Referencia de API
API de Nodos XML
Referencia completa de clases, métodos y funciones para XmlNode, XmlNodes, XmlAttributes, importación/exportación y espacios de nombres.
Referencia de las clases y funciones del módulo de nodos XML exportadas desde @nodecfdi/cfdi-core.
XmlNode<TAttributes extends string = string>
Implementa XmlNodeInterface<TAttributes>.
constructor(name: string, attributes?: AttributesRecord<TAttributes>, children?: XmlNodeInterface[], value?: string, cdata?: string)length: number(getter)name(): stringchildren(): XmlNodesaddChild(node: XmlNodeInterface): XmlNodeInterfaceattributes(): XmlAttributes<TAttributes>hasAttribute(name: AttributeName<TAttributes>): booleansetAttribute(name: AttributeName<TAttributes>, value?: string | null): voidgetAttribute(name: AttributeName<TAttributes>): stringaddAttributes(attributes: AttributesRecord<TAttributes>): voidclear(): voidsearchAttribute(...searchPath: string[]): stringsearchNodes(...searchPath: string[]): XmlNodessearchNode(...searchPath: string[]): XmlNodeInterface | undefinedvalue(): stringsetValue(value: string): voidcdata(): stringsetCData(cdata: string): void[Symbol.iterator](): IterableIterator<XmlNodeInterface>
XmlAttributes<TAttributes extends string = string>
constructor(attributes?: AttributesRecord<TAttributes>)size: number/length: number(getters)get(name: AttributeName<TAttributes>): stringset(name: AttributeName<TAttributes>, value?: string | { toString: () => string } | null): thisdelete(name: AttributeName<TAttributes>): booleanclear(): thishas(name: AttributeName<TAttributes>): booleanimport(attributes: AttributesRecord<TAttributes>): thisexport(): Record<string, string>exportMap(): Map<string, string>forEach(callbackFn: (value: string, key: string, map: Map<string, string>) => void, thisArgument?: unknown): voidentries(): IterableIterator<[string, string]>keys(): IterableIterator<string>values(): IterableIterator<string>[Symbol.iterator](): IterableIterator<[string, string]>
XmlNodes
Extiende Array<XmlNodeInterface>.
constructor(nodes?: XmlNodeInterface[])add(...nodes: XmlNodeInterface[]): thisdelete(node: XmlNodeInterface): thisclear(): thishas(node: XmlNodeInterface): booleanfirst(): XmlNodeInterface | undefinedget(position: number): XmlNodeInterfacefirstNodeWithName(nodeName: string): XmlNodeInterface | undefinedgetNodesByName(nodeName: string): XmlNodesorder(): voidsetOrder(names: string[]): voidgetOrder(): string[]importFromArray(nodes: XmlNodeInterface[]): this
XmlNodesSorter
constructor(order?: string[])setOrder(names: string[]): booleanparseNames(names: unknown[]): string[]getOrder(): string[]sort(nodes: XmlNodeInterface[]): XmlNodeInterface[]compareNodesByName(a: XmlNodeInterface, b: XmlNodeInterface): numbervalueByName(name: string): number
Importación y exportación
XmlNodeImporter:constructor(element: Element),import(): XmlNodeInterfaceXmlNodeExporter:constructor(node: XmlNodeInterface),export(): ElementnodeToXmlElement(node: XmlNodeInterface): ElementnodeToXmlString(node: XmlNodeInterface, withXmlHeader?: boolean): stringnodeFromXmlElement(element: Element): XmlNodeInterfacenodeFromXmlString(content: string): XmlNodeInterface
NodeNsDefinitionsMover
hasNamespaceFilter(): booleangetNamespaceFilter(): NamespaceFilter | nullsetNamespaceFilter(filter?: NamespaceFilter | null): thisprocess(root: XmlNodeInterface): voidfilterNamespace(namespace: string): boolean
