import { Node } from '@xmldom/xmldom'; import { DefaultAttribute, HelperElement, ModifyXmlCallback, OverrideAttribute, RelationshipAttribute, XmlDocument, XmlElement } from '../types/xml-types'; import { GetRelationshipsCallback, Target } from '../types/types'; import IArchive from '../interfaces/iarchive'; import { ContentTypeExtension } from '../enums/content-type-map'; export declare class XmlHelper { static modifyXmlInArchive(archive: IArchive, file: string, callbacks: ModifyXmlCallback[]): Promise; static getXmlFromArchive(archive: IArchive, file: string): Promise; static writeXmlToArchive(archive: IArchive, file: string, xml: XmlDocument): void; static appendIf(element: HelperElement): Promise; static append(element: HelperElement): Promise; static removeIf(element: HelperElement): Promise; static getNextRelId(rootArchive: IArchive, file: string): Promise; static getMaxId(rels: NodeListOf | HTMLCollectionOf, attribute: string, increment?: boolean, minId?: number): number; static getRelationshipTargetsByPrefix(archive: IArchive, path: string, prefix: string | string[]): Promise; static parseRelationTarget(element: XmlElement, prefix?: string): Target; static targetMatchesRelationship(relType: string, subtype: string, file: string, prefix: string): boolean; static getTargetsByRelationshipType(archive: IArchive, path: string, type: string): Promise; static getRelationshipItems(archive: IArchive, path: string, cb: GetRelationshipsCallback, tag?: string): Promise; static findByAttribute(xml: XmlDocument | Document, tagName: string, attributeName: string, attributeValue: string): boolean; static replaceAttribute(archive: IArchive, path: string, tagName: string, attributeName: string, attributeValue: string, replaceValue: string, replaceAttributeName?: string): Promise; static getTargetByRelId(archive: IArchive, relsPath: string, element: XmlElement, type: string): Promise; static isElementCreationId(selector: string): boolean; static findByElementCreationId(archive: IArchive, path: string, creationId: string): Promise; static findByElementName(archive: IArchive, path: string, name: string, nameIdx?: number): Promise; static findByName(doc: Document, name: string, nameIdx?: number): XmlElement; static findByCreationId(doc: Document, creationId: string): XmlElement; static findFirstByAttributeValue(nodes: NodeListOf | HTMLCollectionOf, attributeName: string, attributeValue: string): XmlElement; static findByAttributeValue(nodes: NodeListOf | HTMLCollectionOf, attributeName: string, attributeValue: string): XmlElement[]; static createContentTypeChild(archive: IArchive, attributes: OverrideAttribute | DefaultAttribute): HelperElement; static createRelationshipChild(archive: IArchive, targetRelFile: string, attributes: RelationshipAttribute): HelperElement; static appendImageExtensionToContentType(targetArchive: IArchive, extension: ContentTypeExtension): Promise; static appendSharedString(sharedStrings: Document, stringValue: string): number; static insertAfter(newNode: XmlElement, referenceNode: XmlElement): XmlElement; static sliceCollection(collection: HTMLCollectionOf, length: number, from?: number): void; static getClosestParent(tag: string, element: XmlElement): XmlElement; static remove(toRemove: XmlElement): void; static removeAllChildren(element: XmlElement): void; static moveChild(childToMove: XmlElement, insertBefore?: XmlElement): void; static appendClone(childToClone: XmlElement, parent: XmlElement): XmlElement; static sortCollection(collection: HTMLCollectionOf, order: number[], callback?: ModifyXmlCallback): void; static modifyCollection(collection: HTMLCollectionOf, callback: ModifyXmlCallback): void; static modifyCollectionAsync(collection: HTMLCollectionOf, callback: ModifyXmlCallback): Promise; static dump(element: XMLDocument | Element | Node): void; static removeByTagName: (element: XmlElement, tagName: string, i?: number) => void; /** * Find an element with the given tag name, searching deeply through the structure * @param element The root element to search in * @param tagName The tag name to search for * @returns The found element or null */ static findElement(element: XmlElement, tagName: string): XmlElement | null; }