@Immutable public final class XSDDocument extends Object implements XSD
XSD
.
Objects of this class are immutable and thread-safe.
Constructor and Description |
---|
XSDDocument(InputStream stream)
Public ctor, from XSD as an input stream.
|
XSDDocument(String src)
Public ctor, from XSD as a string.
|
XSDDocument(URI uri)
Public ctor, from URI.
|
XSDDocument(URL url)
Public ctor, from URL.
|
XSDDocument(XML src)
Public ctor, from XSD as a source.
|
Modifier and Type | Method and Description |
---|---|
static XSD |
make(InputStream stream)
Make an instance of XSD schema without I/O exceptions.
|
static XSD |
make(URL url)
Make an instance of XSD schema without I/O exceptions.
|
String |
toString() |
Collection<SAXParseException> |
validate(Source xml)
Validate XML.
|
public XSDDocument(@NotNull(message="XML can\'t be NULL") XML src)
src
- XSD document bodypublic XSDDocument(@NotNull(message="XSD text can\'t be NULL") String src)
src
- XSD document bodypublic XSDDocument(@NotNull(message="URL can\'t be NULL") URL url) throws IOException
url
- Location of documentIOException
- If fails to readpublic XSDDocument(@NotNull(message="URI can\'t be NULL") URI uri) throws IOException
uri
- Location of documentIOException
- If fails to readpublic XSDDocument(@NotNull(message="XSD input stream can\'t be NULL") InputStream stream)
stream
- XSD input streampublic static XSD make(@NotNull(message="XSD input stream can\'t be NULL") InputStream stream)
This factory method is useful when you need to create an instance of XSD schema as a static final variable. In this case you can't catch an exception but this method can help, for example:
class Foo { private static final XSD SCHEMA = XSDDocument.make( Foo.class.getResourceAsStream("my-schema.xsd") ); }
stream
- Input streampublic static XSD make(@NotNull(message="URL can\'t be NULL") URL url)
url
- URL with contentmake(InputStream)
@NotNull(message="list of exceptions is never NULL") public Collection<SAXParseException> validate(@NotNull(message="XML can\'t be NULL") Source xml)
XSD
Copyright © 2012–2015 jcabi.com. All rights reserved.