import { XMLElement } from "@xml-tools/ast" ; import { resolveXMLNS , splitQNameByNamespace , resolveXMLNSFromPrefix , } from "../api" ; export function xmlToFQN ( astElement ) { const baseName = astElement . name ?? "" ; const resolvedXmlns = resolveXMLNS ( astElement ) ; if ( resolvedXmlns !== undefined ) { return resolvedXmlns + "." + baseName ; } else { return baseName ; } } export function xmlClosingTagToFQN ( astElement ) { if ( astElement . syntax . closeName === undefined ) { return "" ; } const { prefix , localName : baseName } = splitQNameByNamespace ( astElement . syntax . closeName . image ) ; const resolvedXmlns = resolveXMLNSFromPrefix ( prefix , astElement ) ; if ( resolvedXmlns !== undefined ) { return resolvedXmlns + "." + baseName ; } else { return baseName ; } }