xml.parser
Class SchemaMapping.TransformURI

java.lang.Object
  extended by xml.parser.SchemaMapping.Mapping
      extended by xml.parser.SchemaMapping.TransformURI
Enclosing class:
SchemaMapping

public static class SchemaMapping.TransformURI
extends SchemaMapping.Mapping

URI pattern -> related URL. The pattern is in glob syntax : - star matches any sequence of character except slashes - dot really means a dot. Any text matched by * is inserted in place of the corresponding * in the destination pattern e.g. : *.xml -> *.xsd *.xml -> *.rng


Field Summary
 
Fields inherited from class xml.parser.SchemaMapping.Mapping
base, baseURI, parent
 
Constructor Summary
SchemaMapping.TransformURI(java.net.URI baseURI, java.lang.String fromPattern, java.lang.String toPattern)
           
 
Method Summary
 SchemaMapping.Mapping getMappingForDocument(java.lang.String ignoredPublicId, java.lang.String url, java.lang.String ignoredNamespace, java.lang.String ignoredPrefix, java.lang.String ignoredLocalName)
          iterate over the mappings and return the first hit.
 SchemaMapping.Result getSchemaForDocument(java.lang.String ignoredPublicId, java.lang.String url, java.lang.String ignoredNamespace, java.lang.String ignoredPrefix, java.lang.String ignoredLocalName, boolean ignored)
          TODO: what if pattern is absolute and url is relative ? TODO: patterns with ..
 java.lang.String toString()
           
 
Methods inherited from class xml.parser.SchemaMapping.Mapping
getBaseURI, getParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SchemaMapping.TransformURI

public SchemaMapping.TransformURI(java.net.URI baseURI,
                                  java.lang.String fromPattern,
                                  java.lang.String toPattern)
Parameters:
baseURI - baseURI to use if resource is relative
fromPattern - matched pattern
toPattern - result pattern
Throws:
java.lang.IllegalArgumentException - if pattern is null
Method Detail

getSchemaForDocument

public SchemaMapping.Result getSchemaForDocument(java.lang.String ignoredPublicId,
                                                 java.lang.String url,
                                                 java.lang.String ignoredNamespace,
                                                 java.lang.String ignoredPrefix,
                                                 java.lang.String ignoredLocalName,
                                                 boolean ignored)
TODO: what if pattern is absolute and url is relative ? TODO: patterns with .. won't be correctly resolved

Specified by:
getSchemaForDocument in class SchemaMapping.Mapping
Parameters:
ignoredPublicId - public ID of the parsed document
url - system ID of the parsed document
ignoredNamespace - namespace of the root element of the parsed document
ignoredPrefix - prefix of the root element of the parsed document
ignoredLocalName - localName of the root element of the parsed document
ignored - if the schema referenced from a typeId must be returned
Returns:
schema URL for given document (and baseURI) or null if not found

getMappingForDocument

public SchemaMapping.Mapping getMappingForDocument(java.lang.String ignoredPublicId,
                                                   java.lang.String url,
                                                   java.lang.String ignoredNamespace,
                                                   java.lang.String ignoredPrefix,
                                                   java.lang.String ignoredLocalName)
Description copied from class: SchemaMapping.Mapping
iterate over the mappings and return the first hit. all the parameters are given the same priority : it's really the ordering of rules which defines a priority order. Any of the paremeters can be null.

Specified by:
getMappingForDocument in class SchemaMapping.Mapping
Parameters:
ignoredPublicId - public ID of the parsed document
url - system ID of the parsed document
ignoredNamespace - namespace of the root element of the parsed document
ignoredPrefix - prefix of the root element of the parsed document
ignoredLocalName - localName of the root element of the parsed document
Returns:
schema URL for given document (and baseURI) or null if not found

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
xml serialization