Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.lib
Class ConversionRules

    java.lang.Object
      net.sf.saxon.lib.ConversionRules

All Implemented Interfaces:
  Serializable

    public class ConversionRules

extends Object
implements Serializable

This class defines a set of rules for converting between different atomic types. It handles the variations that arise between different versions of the W3C specifications, for example the changes in Name syntax between XML 1.0 and XML 1.1, the introduction of "+INF" as a permitted xs:double value in XSD 1.1, and so on.

It is possible to nominate a customized `ConversionRules` object at the level of the `Configuration`, either by instantiating this class and changing the properties, or by subclassing.

Since:
  9.3
See Also:
  `Configuration.setConversionRules(ConversionRules)`, Serialized Form

Constructor Summary
`ConversionRules()`

Method Summary
`ConversionRules` | `copy()`
`Converter` | `getConverter(AtomicType source, AtomicType target)` Get a Converter for a given pair of atomic types.
`NameChecker` | `getNameChecker()` Get the class that will be used to check whether XML names are valid.
`StringConverter` | `getStringConverter(AtomicType target)` Get a Converter that converts from strings to a given atomic type.
`StringToDouble` | `getStringToDoubleConverter()` Get the converter that will be used for converting strings to doubles and floats.
`boolean` | `isAllowYearZero()` Ask whether year zero is permitted in dates.
`boolean` | `isDeclaredNotation(String uri, String local)` Ask whether a given notation is accepted by xs:NOTATION and its subclasses.
`boolean` | `isValidURI(CharSequence string)` Ask whether a string is a valid instance of xs:anyURI according to the rules defined by the current URIChecker
`void` | `setAllowYearZero(boolean allowed)` Say whether year zero is permitted in dates.
`void` | `setNameChecker(NameChecker checker)` Set the class that will be used to check whether XML names are valid.
`void` | `setNotationSet(NotationSet notations)` Specify the set of notations that are accepted by xs:NOTATION and its subclasses.
`void` | `setStringToDoubleConverter(StringToDouble converter)` Set the converter that will be used for converting strings to doubles and floats.
`void` | `setURIChecker(URIChecker checker)` Set the class to be used for checking URI values.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConversionRules

    public ConversionRules()

Method Detail

### copy

    public ConversionRules copy()

### setNameChecker

    public void setNameChecker(NameChecker checker)

  Set the class that will be used to check whether XML names are valid.

  Parameters:
    `checker` - the class to be used for checking names. There are variants of this class depending on which version/edition of the XML specification is in use.

### getNameChecker

    public NameChecker getNameChecker()

  Get the class that will be used to check whether XML names are valid.

  Returns:
    the class to be used for checking names. There are variants of this class depending on which version/edition of the XML specification is in use.

### setStringToDoubleConverter

    public void setStringToDoubleConverter(StringToDouble converter)

  Set the converter that will be used for converting strings to doubles and floats.

  Parameters:
    `converter` - the converter to be used. There are two converters in regular use: they differ only in whether the lexical value "+INF" is recognized as a representation of positive infinity.

### getStringToDoubleConverter

    public StringToDouble getStringToDoubleConverter()

  Get the converter that will be used for converting strings to doubles and floats.

  Returns:
    the converter to be used. There are two converters in regular use: they differ only in whether the lexical value "+INF" is recognized as a representation of positive infinity.

### setNotationSet

    public void setNotationSet(NotationSet notations)

  Specify the set of notations that are accepted by xs:NOTATION and its subclasses. This is to support the rule that for a notation to be valid, it must be declared in an xs:notation declaration in the schema

  Parameters:
    `notations` - the set of notations that are recognized; or null, to indicate that all notation names are accepted

### isDeclaredNotation

    public boolean isDeclaredNotation(String uri,
                                      String local)

  Ask whether a given notation is accepted by xs:NOTATION and its subclasses. This is to support the rule that for a notation to be valid, it must be declared in an xs:notation declaration in the schema

  Parameters:
    `uri` - the namespace URI of the notation
    `local` - the local part of the name of the notation
  Returns:
    true if the notation is in the set of recognized notation names

### setURIChecker

    public void setURIChecker(URIChecker checker)

  Set the class to be used for checking URI values. By default, no checking takes place.

  Parameters:
    `checker` - an object to be used for checking URIs; or null if any string is accepted as an anyURI value

### isValidURI

    public boolean isValidURI(CharSequence string)

  Ask whether a string is a valid instance of xs:anyURI according to the rules defined by the current URIChecker

  Parameters:
    `string` - the string to be checked against the rules for URIs
  Returns:
    true if the string represents a valid xs:anyURI value

### setAllowYearZero

    public void setAllowYearZero(boolean allowed)

  Say whether year zero is permitted in dates. By default it is not permitted when XSD 1.0 is in use, but it is permitted when XSD 1.1 is used.

  Parameters:
    `allowed` - true if year zero is permitted

### isAllowYearZero

    public boolean isAllowYearZero()

  Ask whether year zero is permitted in dates. By default it is not permitted when XSD 1.0 is in use, but it is permitted when XSD 1.1 is used.

  Returns:
    true if year zero is permitted

### getConverter

    public Converter getConverter(AtomicType source,
                                  AtomicType target)

  Get a Converter for a given pair of atomic types. These can be primitive types, derived types, or user-defined types. The converter implements the casting rules.

  Parameters:
    `source` - the source type
    `target` - the target type
  Returns:
    a Converter if conversion between the two types is possible; or null otherwise

### getStringConverter

    public StringConverter getStringConverter(AtomicType target)

  Get a Converter that converts from strings to a given atomic type. These can be primitive types, derived types, or user-defined types. The converter implements the casting rules.

  Parameters:
    `target` - the target type
  Returns:
    a Converter if conversion between the two types is possible; or null otherwise

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.