Stay organized with collections
Save and categorize content based on your preferences.
Schema
abstract class Schema
Immutable in-memory representation of grammar.
This object represents a set of constraints that can be checked/ enforced against an XML document.
A Schema
object is thread safe and applications are encouraged to share it across many parsers in many threads.
A Schema
object is immutable in the sense that it shouldn't change the set of constraints once it is created. In other words, if an application validates the same document twice against the same Schema
, it must always produce the same result.
A Schema
object is usually created from SchemaFactory
.
Two kinds of validators can be created from a Schema
object. One is Validator
, which provides highly-level validation operations that cover typical use cases. The other is ValidatorHandler
, which works on top of SAX for better modularity.
This specification does not refine the java.lang.Object#equals(java.lang.Object)
method. In other words, if you parse the same schema twice, you may still get !schemaA.equals(schemaB)
.
Summary
Protected constructors |
Constructor for the derived class.
|
Protected constructors
Schema
protected Schema()
Constructor for the derived class.
The constructor does nothing.
Public methods
newValidator
abstract fun newValidator(): Validator!
Creates a new Validator
for this Schema
.
A validator enforces/checks the set of constraints this object represents.
Return |
Validator! |
Always return a non-null valid 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,["# Schema\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSchema\n======\n\n```\nabstract class Schema\n```\n\n|---|----------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [javax.xml.validation.Schema](#) |\n\nImmutable in-memory representation of grammar.\n\nThis object represents a set of constraints that can be checked/ enforced against an XML document.\n\nA [Schema](#) object is thread safe and applications are encouraged to share it across many parsers in many threads.\n\nA [Schema](#) object is immutable in the sense that it shouldn't change the set of constraints once it is created. In other words, if an application validates the same document twice against the same [Schema](#), it must always produce the same result.\n\nA [Schema](#) object is usually created from [SchemaFactory](/reference/kotlin/javax/xml/validation/SchemaFactory).\n\nTwo kinds of validators can be created from a [Schema](#) object. One is [Validator](/reference/kotlin/javax/xml/validation/Validator), which provides highly-level validation operations that cover typical use cases. The other is [ValidatorHandler](/reference/kotlin/javax/xml/validation/ValidatorHandler), which works on top of SAX for better modularity.\n\nThis specification does not refine the [java.lang.Object#equals(java.lang.Object)](../../../java/lang/Object.html#equals(kotlin.Any)) method. In other words, if you parse the same schema twice, you may still get `!schemaA.equals(schemaB)`.\n\nSummary\n-------\n\n| Protected constructors ||\n|------------------------------------------------------------|---|\n| [Schema](#Schema())`()` Constructor for the derived class. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Validator](/reference/kotlin/javax/xml/validation/Validator)! | [newValidator](#newValidator())`()` Creates a new [Validator](/reference/kotlin/javax/xml/validation/Validator) for this [Schema](#). |\n| abstract [ValidatorHandler](/reference/kotlin/javax/xml/validation/ValidatorHandler)! | [newValidatorHandler](#newValidatorHandler())`()` Creates a new [ValidatorHandler](/reference/kotlin/javax/xml/validation/ValidatorHandler) for this [Schema](#). |\n\nProtected constructors\n----------------------\n\n### Schema\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected Schema()\n```\n\nConstructor for the derived class.\n\nThe constructor does nothing.\n\nPublic methods\n--------------\n\n### newValidator\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun newValidator(): Validator!\n```\n\nCreates a new [Validator](/reference/kotlin/javax/xml/validation/Validator) for this [Schema](#).\n\nA validator enforces/checks the set of constraints this object represents.\n\n| Return ||\n|----------------------------------------------------------------|----------------------------------------|\n| [Validator](/reference/kotlin/javax/xml/validation/Validator)! | Always return a non-null valid object. |\n\n### newValidatorHandler\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun newValidatorHandler(): ValidatorHandler!\n```\n\nCreates a new [ValidatorHandler](/reference/kotlin/javax/xml/validation/ValidatorHandler) for this [Schema](#).\n\n| Return ||\n|------------------------------------------------------------------------------|----------------------------------------|\n| [ValidatorHandler](/reference/kotlin/javax/xml/validation/ValidatorHandler)! | Always return a non-null valid object. |"]]