XmlParser

abstract class XmlParser(val logger: Logger = NoOpLogger)(source)

Abstract class representing an XML parser.

Inheritors

Constructors

Link copied to clipboard
constructor(logger: Logger = NoOpLogger)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A set of elements that have not yet been assigned a parent.

Link copied to clipboard

A set of elements with an ID attribute.

Link copied to clipboard
protected abstract val fileType: FileType

The file type of the XML being parsed.

Link copied to clipboard
protected val logger: Logger
Link copied to clipboard
protected var root: XmlElementNode?

The root element of the parsed XML.

Link copied to clipboard
protected lateinit var rootNode: Element

The root element of the XML as an Element object.

Functions

Link copied to clipboard
fun accept(fileType: FileType): Boolean

Checks if the parser accepts the given file type.

Link copied to clipboard
protected fun createDefaultElement(nodeName: String, attributes: Attributes, parent: XmlParentNode): XmlElementNode

Creates a default XmlElementNode instance with the given parameters. This method is used when no specific element type is provided by the parser.

Link copied to clipboard
protected abstract fun createElement(node: Element, parent: XmlParentNode): XmlNode

Creates an XmlNode instance with the given parameters.

Link copied to clipboard
protected open fun getPreProcessedElement(node: Node, parent: XmlParentNode): XmlNode?

Returns a pre-processed Element node.

Link copied to clipboard
protected abstract fun XmlNode.isRootNode(): Boolean

Checks if the given XML node is the root node of the XML document.

Link copied to clipboard
fun parse(content: String): XmlRootNode

Parse a XML string content to an XmlRootNode