Stay organized with collections
Save and categorize content based on your preferences.
Element
open class Element
An XML element. Provides access to child elements and hooks to listen for events related to this element.
Summary
Public methods |
open Element! |
Gets the child element with the given name.
|
open Element! |
Gets the child element with the given name.
|
open Element! |
Gets the child element with the given name.
|
open Element! |
Gets the child element with the given name.
|
open Unit |
Sets start and end element listeners at the same time.
|
open Unit |
Sets a listener for the end of this element.
|
open Unit |
Sets a listener for the end of this text element.
|
open Unit |
Sets a listener for the start of this element.
|
open Unit |
Sets start and end text element listeners at the same time.
|
open String |
|
Public methods
getChild
open fun getChild(localName: String!): Element!
Gets the child element with the given name. Uses an empty string as the namespace.
getChild
open fun getChild(
uri: String!,
localName: String!
): Element!
Gets the child element with the given name.
requireChild
open fun requireChild(localName: String!): Element!
Gets the child element with the given name. Uses an empty string as the namespace. We will throw a org.xml.sax.SAXException
at parsing time if the specified child is missing. This helps you ensure that your listeners are called.
requireChild
open fun requireChild(
uri: String!,
localName: String!
): Element!
Gets the child element with the given name. We will throw a org.xml.sax.SAXException
at parsing time if the specified child is missing. This helps you ensure that your listeners are called.
setElementListener
open fun setElementListener(elementListener: ElementListener!): Unit
Sets start and end element listeners at the same time.
setEndElementListener
open fun setEndElementListener(endElementListener: EndElementListener!): Unit
Sets a listener for the end of this element.
setEndTextElementListener
open fun setEndTextElementListener(endTextElementListener: EndTextElementListener!): Unit
Sets a listener for the end of this text element.
setStartElementListener
open fun setStartElementListener(startElementListener: StartElementListener!): Unit
Sets a listener for the start of this element.
setTextElementListener
open fun setTextElementListener(elementListener: TextElementListener!): Unit
Sets start and end text element listeners at the same time.
toString
open fun toString(): String
Return |
String |
a string representation of the object. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Element\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nElement\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/sax/Element \"View this page in Java\") \n\n```\nopen class Element\n```\n\n|---|--------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.sax.Element](#) |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [RootElement](/reference/kotlin/android/sax/RootElement) |----------------------------------------------------------|-----------------------| | [RootElement](/reference/kotlin/android/sax/RootElement) | The root XML element. | |\n\nAn XML element. Provides access to child elements and hooks to listen for events related to this element.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Element](#)! | [getChild](#getChild(kotlin.String))`(`localName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Gets the child element with the given name. |\n| open [Element](#)! | [getChild](#getChild(kotlin.String,%20kotlin.String))`(`uri:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `localName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Gets the child element with the given name. |\n| open [Element](#)! | [requireChild](#requireChild(kotlin.String))`(`localName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Gets the child element with the given name. |\n| open [Element](#)! | [requireChild](#requireChild(kotlin.String,%20kotlin.String))`(`uri:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `localName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Gets the child element with the given name. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setElementListener](#setElementListener(android.sax.ElementListener))`(`elementListener:` `[ElementListener](/reference/kotlin/android/sax/ElementListener)!`)` Sets start and end element listeners at the same time. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setEndElementListener](#setEndElementListener(android.sax.EndElementListener))`(`endElementListener:` `[EndElementListener](/reference/kotlin/android/sax/EndElementListener)!`)` Sets a listener for the end of this element. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setEndTextElementListener](#setEndTextElementListener(android.sax.EndTextElementListener))`(`endTextElementListener:` `[EndTextElementListener](/reference/kotlin/android/sax/EndTextElementListener)!`)` Sets a listener for the end of this text element. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setStartElementListener](#setStartElementListener(android.sax.StartElementListener))`(`startElementListener:` `[StartElementListener](/reference/kotlin/android/sax/StartElementListener)!`)` Sets a listener for the start of this element. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setTextElementListener](#setTextElementListener(android.sax.TextElementListener))`(`elementListener:` `[TextElementListener](/reference/kotlin/android/sax/TextElementListener)!`)` Sets start and end text element listeners at the same time. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### getChild\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getChild(localName: String!): Element!\n```\n\nGets the child element with the given name. Uses an empty string as the namespace. \n\n### getChild\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getChild(\n uri: String!, \n localName: String!\n): Element!\n```\n\nGets the child element with the given name. \n\n### requireChild\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun requireChild(localName: String!): Element!\n```\n\nGets the child element with the given name. Uses an empty string as the namespace. We will throw a [org.xml.sax.SAXException](../../org/xml/sax/SAXException.html#) at parsing time if the specified child is missing. This helps you ensure that your listeners are called. \n\n### requireChild\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun requireChild(\n uri: String!, \n localName: String!\n): Element!\n```\n\nGets the child element with the given name. We will throw a [org.xml.sax.SAXException](../../org/xml/sax/SAXException.html#) at parsing time if the specified child is missing. This helps you ensure that your listeners are called. \n\n### setElementListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setElementListener(elementListener: ElementListener!): Unit\n```\n\nSets start and end element listeners at the same time. \n\n### setEndElementListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setEndElementListener(endElementListener: EndElementListener!): Unit\n```\n\nSets a listener for the end of this element. \n\n### setEndTextElementListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setEndTextElementListener(endTextElementListener: EndTextElementListener!): Unit\n```\n\nSets a listener for the end of this text element. \n\n### setStartElementListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setStartElementListener(startElementListener: StartElementListener!): Unit\n```\n\nSets a listener for the start of this element. \n\n### setTextElementListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setTextElementListener(elementListener: TextElementListener!): Unit\n```\n\nSets start and end text element listeners at the same time. \n\n### toString\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun toString(): String\n```\n\n| Return ||\n|----------------------------------------------------------------------------------|----------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |"]]