public class XMLSchemaService extends BaseService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAMESPACEKEYWORD |
static java.lang.String |
SCHEMA_DIR |
_serviceName
Modifier and Type | Method and Description |
---|---|
static boolean |
areAllSchemasRegistered(java.util.Vector<XMLSchema> schemaList)
Checks to see that all schemas are registered.
|
void |
doRefresh()
refresh the persistant values in this service.
|
static java.lang.String |
findDocumentNamespace(java.io.StringReader xml)
Returns the namespace for an xml document.
|
java.lang.String |
findNamespaceAndSchemaLocalLocation(java.lang.String formatId,
java.lang.String namespace)
Get the namespace-schemaLocation pairs string based on given formatId and namespace.
|
java.lang.String |
findNoNamespaceSchemaLocalLocation(java.lang.String formatId,
java.lang.String noNamespaceSchemaLocation)
Get the local (official) location for a no-namespace schema based on the given format id or no-name-space schema location uri.
|
static java.lang.String |
findNoNamespaceSchemaLocationAttr(java.io.StringReader xml)
Get the attribute value of the noNamespaceSchemaLcation of the given xml
|
static java.util.Vector<XMLSchema> |
findSchemasInXML(java.io.StringReader xml)
See if schemas have been specified in the xml:schemalocation attribute.
|
static java.lang.String |
getBaseUrlFromSchemaURL(java.lang.String url)
Get a base url from the schema url.
|
static XMLSchemaService |
getInstance()
Get the single instance of XMLService.
|
java.lang.String |
getNameSpaceAndLocation(java.lang.String formatId)
Get the all schema-location pairs registered for the formatId.
|
java.lang.String |
getNameSpaceAndLocationStringWithoutFormatId()
Gets the name space and location string.
|
java.util.Vector<java.lang.String> |
getNameSpaceList()
Gets a list of name spaces.
|
java.util.Vector<XMLNoNamespaceSchema> |
getRegisteredNoNamespaceSchemaList()
Gets the registered schema list without the name space.
|
java.util.Vector<XMLSchema> |
getRegisteredSchemaList()
Gets the registered schema list.
|
static java.lang.String |
getSchemaFileNameFromUri(java.lang.String uri)
Get a schema file name from the schema uri.
|
static boolean |
isNamespaceRegistered(java.lang.String namespace)
Test if the given namespace registered in Metacat
|
static boolean |
isSchemaRegistered(XMLSchema xmlSchema)
Returns true if the schema is registered.
|
void |
populateRegisteredSchemaList()
Populate the list of registered schemas.
|
boolean |
refreshable() |
void |
stop() |
boolean |
useFullSchemaValidation()
Report whether xml parsing is set to use full schema parsing.
|
refresh
public static final java.lang.String NAMESPACEKEYWORD
public static final java.lang.String SCHEMA_DIR
public static XMLSchemaService getInstance()
public boolean refreshable()
refreshable
in class BaseService
public void doRefresh() throws ServiceException
doRefresh
in class BaseService
ServiceException
public void stop() throws ServiceException
stop
in class BaseService
ServiceException
public java.util.Vector<XMLSchema> getRegisteredSchemaList()
public java.util.Vector<XMLNoNamespaceSchema> getRegisteredNoNamespaceSchemaList()
public java.lang.String getNameSpaceAndLocationStringWithoutFormatId()
public java.lang.String getNameSpaceAndLocation(java.lang.String formatId)
formatId
- public java.util.Vector<java.lang.String> getNameSpaceList()
public boolean useFullSchemaValidation()
public void populateRegisteredSchemaList()
public static boolean areAllSchemasRegistered(java.util.Vector<XMLSchema> schemaList)
schemaList
- a list of schemas as they appear in xml.public static boolean isSchemaRegistered(XMLSchema xmlSchema)
schema
- a single schema as it appears in xmlpublic static boolean isNamespaceRegistered(java.lang.String namespace)
namespace
- the namespace will be testedpublic java.lang.String findNamespaceAndSchemaLocalLocation(java.lang.String formatId, java.lang.String namespace) throws MetacatException
formatId
- the given format idnamespace
- the given namespaceMetacatException
public java.lang.String findNoNamespaceSchemaLocalLocation(java.lang.String formatId, java.lang.String noNamespaceSchemaLocation) throws MetacatException
formatId
- noNamespaceSchemaLocation
- MetacatException
public static java.util.Vector<XMLSchema> findSchemasInXML(java.io.StringReader xml) throws java.io.IOException
xml
- the document we want to look in for schema locationjava.io.IOException
public static java.lang.String findDocumentNamespace(java.io.StringReader xml) throws java.io.IOException, edu.ucsb.nceas.utilities.PropertyNotFoundException, org.xml.sax.SAXException
xml
- the document to searchorg.xml.sax.SAXException
edu.ucsb.nceas.utilities.PropertyNotFoundException
java.io.IOException
public static java.lang.String findNoNamespaceSchemaLocationAttr(java.io.StringReader xml) throws edu.ucsb.nceas.utilities.PropertyNotFoundException, org.xml.sax.SAXException, java.io.IOException
xml
- the xml obect needs to be searchedorg.xml.sax.SAXException
edu.ucsb.nceas.utilities.PropertyNotFoundException
java.io.IOException
public static java.lang.String getSchemaFileNameFromUri(java.lang.String uri)
uri
- the uri from which to extract the file namepublic static java.lang.String getBaseUrlFromSchemaURL(java.lang.String url)
uri
- the uri from which to extract the base urlCopyright © 2020 Regents of the University of California. All Rights Reserved.