public abstract class XMLBasedDatatypeService extends DatatypeService
ANY_DIR_URI, ANY_FILE_URI, XS_ANY_URI, XS_BOOLEAN, XS_INTEGER, XS_NON_NEGATIVE_INTEGER, XS_STRING
Constructor and Description |
---|
XMLBasedDatatypeService() |
XMLBasedDatatypeService(String id) |
Modifier and Type | Method and Description |
---|---|
Document |
asDocument()
Get the XML definition of the datatype.
|
List<String> |
getEnumerationValues()
Get all the values of the enumeration.
|
Pattern |
getPattern()
Get the regular expression pattern
|
boolean |
isEnumeration()
Whether the datatype is an enumeration (defined with the "choice" element)
|
boolean |
isPattern()
Whether the datatype is a regular expression pattern
|
protected abstract Node |
readDocument() |
static Document |
readDocument(String xml) |
static Document |
readDocument(URL url) |
ValidationResult |
validate(String content)
Test whether a value matches the datatype.
|
getId
public XMLBasedDatatypeService()
public XMLBasedDatatypeService(String id)
public static Document readDocument(URL url) throws ParserConfigurationException, SAXException, IOException
public static Document readDocument(String xml) throws ParserConfigurationException, SAXException, IOException
public Document asDocument() throws Exception
DatatypeService
asDocument
in class DatatypeService
Exception
public ValidationResult validate(String content)
DatatypeService
validate
in class DatatypeService
public boolean isEnumeration()
<choice> <value>a</value> <value>b</value> <value>c</value> </choice>
public boolean isPattern()
<data type="string"> <param name="pattern">^a|b|c$</param> </data>
public List<String> getEnumerationValues() throws UnsupportedOperationException
UnsupportedOperationException
- if the datatype is not an enumeration.public Pattern getPattern() throws UnsupportedOperationException
UnsupportedOperationException
- if the datatype is not an pattern.Copyright © 2010–2024 The DAISY Consortium. All rights reserved.