xml.parser
Class SchemaMapping.URIPatternRule

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

public static class SchemaMapping.URIPatternRule
extends SchemaMapping.Mapping

URI pattern -> typeID or URL. The pattern is in glob syntax : - star matches any sequence of character except slashes - dot really means a dot. e.g. : *.rng -> relax NG schema *.xsd -> Schema for Schemas


Field Summary
protected  java.lang.String target
          typeId or URL of the schema to use if this rule matches
protected  boolean targetIsTypeId
          for serialisation : output typeId="..." or url="..."
 
Fields inherited from class xml.parser.SchemaMapping.Mapping
base, baseURI, parent
 
Constructor Summary
SchemaMapping.URIPatternRule(java.net.URI baseURI, java.lang.String pattern, java.lang.String target, boolean targetIsTypeId)
           
 
Method Summary
 SchemaMapping.Mapping getMappingForDocument(java.lang.String publicId, java.lang.String systemId, java.lang.String namespace, java.lang.String prefix, java.lang.String localName)
          iterate over the mappings and return the first hit.
 SchemaMapping.Result getSchemaForDocument(java.lang.String publicId, java.lang.String systemId, java.lang.String namespace, java.lang.String prefix, java.lang.String localName, boolean followTypeId)
          iterate over the mappings and return the first hit.
 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
 

Field Detail

target

protected final java.lang.String target
typeId or URL of the schema to use if this rule matches


targetIsTypeId

protected final boolean targetIsTypeId
for serialisation : output typeId="..." or url="..."

Constructor Detail

SchemaMapping.URIPatternRule

public SchemaMapping.URIPatternRule(java.net.URI baseURI,
                                    java.lang.String pattern,
                                    java.lang.String target,
                                    boolean targetIsTypeId)
Parameters:
pattern - matched pattern
target - typeID or URL
targetIsTypeId - typeID / URL ?
Throws:
java.lang.IllegalArgumentException - if pattern is null
Method Detail

toString

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

getSchemaForDocument

public final SchemaMapping.Result getSchemaForDocument(java.lang.String publicId,
                                                       java.lang.String systemId,
                                                       java.lang.String namespace,
                                                       java.lang.String prefix,
                                                       java.lang.String localName,
                                                       boolean followTypeId)
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:
getSchemaForDocument in class SchemaMapping.Mapping
Parameters:
publicId - public ID of the parsed document
systemId - system ID of the parsed document
namespace - namespace of the root element of the parsed document
prefix - prefix of the root element of the parsed document
localName - localName of the root element of the parsed document
followTypeId - 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 final SchemaMapping.Mapping getMappingForDocument(java.lang.String publicId,
                                                         java.lang.String systemId,
                                                         java.lang.String namespace,
                                                         java.lang.String prefix,
                                                         java.lang.String localName)
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:
publicId - public ID of the parsed document
systemId - system ID of the parsed document
namespace - namespace of the root element of the parsed document
prefix - prefix of the root element of the parsed document
localName - localName of the root element of the parsed document
Returns:
schema URL for given document (and baseURI) or null if not found