ilog.rules.xml.binding

Class IlrXmlHelper

  • java.lang.Object
    • ilog.rules.xml.binding.IlrXmlHelper


  • public class IlrXmlHelper
    extends java.lang.Object
    This class contains some useful static methods to help parametrize and handle an XML data driver.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  IlrXmlHelper.Config
      Deprecated.  
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String XML_DIRECTORIES
      Deprecated.  
      static java.lang.String XML_DOC_PARSER_CLASS
      Resource name used to define the document parser class, which has to be an implementation of org.xml.sax.XMLReader.
      static java.lang.String XML_DOC_PARSER_OBJECT
      Deprecated.  
      static java.lang.String XML_ERROR_HANDLER_CLASS
      Resource name used to define the error handler class, which has to be an implementation of ilog.rules.xml.util.IlrXmlErrorHandler.
      static java.lang.String XML_ERROR_HANDLER_OBJECT
      Deprecated.  
      static java.lang.String XML_EXTERNAL_ENTITIES
      Resource name used to activate/deactivate the use of external entities mode.
      static java.lang.String XML_NS_EVALUATION
      Resource name used to define the namespace evaluation mode.
      static java.lang.String XML_SCHEMA_PARSER_CLASS
      Resource name used to define the schema parser class, which has to be an implementation of org.xml.sax.XMLReader.
      static java.lang.String XML_SCHEMA_PARSER_OBJECT
      Deprecated.  
      static java.lang.String XML_SCHEMA_RESOLVER_CLASS
      Resource name used to define the schema file resolver class, which is an implementation of ilog.rules.xml.util.IlrXsdLocationResolver).
      static java.lang.String XML_STRICT_IMPORT_MODE
      Resource name used to activate/deactivate the strict importation mode.
      static java.lang.String XML_STRING_FULL_ENCODING
      Resource name used to activate/deactivate the strict importation mode.
      static java.lang.String XML_XOM_MAPPER
      Deprecated.  
      static java.lang.String XML_XOM_MAPPER_CLASS
      Resource name used to define the XML-XOM mapper class, which has to be an implementation of ilog.rules.xml.util.IlrXmlXomMapper.
    • Constructor Summary

      Constructors 
      Constructor and Description
      IlrXmlHelper() 
    • Field Detail

      • XML_SCHEMA_PARSER_OBJECT

        public static final java.lang.String XML_SCHEMA_PARSER_OBJECT
        Deprecated. 
        Resource name used to define a new XML parser.
        See Also:
        Constant Field Values
      • XML_DOC_PARSER_OBJECT

        public static final java.lang.String XML_DOC_PARSER_OBJECT
        Deprecated. 
        Resource name used to define a new XML parser.
        See Also:
        Constant Field Values
      • XML_ERROR_HANDLER_OBJECT

        public static final java.lang.String XML_ERROR_HANDLER_OBJECT
        Deprecated. 
        Resource name used to define a new XML parser.
        See Also:
        Constant Field Values
      • XML_DIRECTORIES

        public static final java.lang.String XML_DIRECTORIES
        Deprecated. 
        Resource name used to define the list of file directories.
        See Also:
        Constant Field Values
      • XML_XOM_MAPPER

        public static final java.lang.String XML_XOM_MAPPER
        Deprecated. 
        Resource name used to define the XML-XOM mapper instance.
        See Also:
        Constant Field Values
      • XML_NS_EVALUATION

        public static final java.lang.String XML_NS_EVALUATION
        Resource name used to define the namespace evaluation mode.
        See Also:
        Constant Field Values
      • XML_SCHEMA_RESOLVER_CLASS

        public static final java.lang.String XML_SCHEMA_RESOLVER_CLASS
        Resource name used to define the schema file resolver class, which is an implementation of ilog.rules.xml.util.IlrXsdLocationResolver).
        See Also:
        IlrXsdLocationResolver, Constant Field Values
      • XML_XOM_MAPPER_CLASS

        public static final java.lang.String XML_XOM_MAPPER_CLASS
        Resource name used to define the XML-XOM mapper class, which has to be an implementation of ilog.rules.xml.util.IlrXmlXomMapper.
        See Also:
        IlrXmlXomMapper, Constant Field Values
      • XML_ERROR_HANDLER_CLASS

        public static final java.lang.String XML_ERROR_HANDLER_CLASS
        Resource name used to define the error handler class, which has to be an implementation of ilog.rules.xml.util.IlrXmlErrorHandler.
        See Also:
        IlrXmlErrorHandler, Constant Field Values
      • XML_SCHEMA_PARSER_CLASS

        public static final java.lang.String XML_SCHEMA_PARSER_CLASS
        Resource name used to define the schema parser class, which has to be an implementation of org.xml.sax.XMLReader.
        See Also:
        Constant Field Values
      • XML_DOC_PARSER_CLASS

        public static final java.lang.String XML_DOC_PARSER_CLASS
        Resource name used to define the document parser class, which has to be an implementation of org.xml.sax.XMLReader.
        See Also:
        Constant Field Values
      • XML_STRICT_IMPORT_MODE

        public static final java.lang.String XML_STRICT_IMPORT_MODE
        Resource name used to activate/deactivate the strict importation mode.
        See Also:
        Constant Field Values
      • XML_STRING_FULL_ENCODING

        public static final java.lang.String XML_STRING_FULL_ENCODING
        Resource name used to activate/deactivate the strict importation mode.
        See Also:
        Constant Field Values
      • XML_EXTERNAL_ENTITIES

        public static final java.lang.String XML_EXTERNAL_ENTITIES
        Resource name used to activate/deactivate the use of external entities mode.
        See Also:
        Constant Field Values
    • Constructor Detail

      • IlrXmlHelper

        public IlrXmlHelper()
    • Method Detail

      • openFile

        public static org.xml.sax.InputSource openFile(java.lang.String fileName)
                                                throws java.io.FileNotFoundException
        Open a local file as a well-initialized InputSource instance.
        Throws:
        java.io.FileNotFoundException
      • openFile

        public static org.xml.sax.InputSource openFile(java.lang.String fileName,
                                       IlrResources resource)
                                                throws java.io.FileNotFoundException
        Open a local file as a well-initialized InputSource instance.
        Throws:
        java.io.FileNotFoundException
      • getCanonicalName

        public static java.lang.String getCanonicalName(java.lang.String name)
        Returns a canonical file name.
        Parameters:
        name - The URL of the file.
        Returns:
        the canonical file name.
      • getNamespaceResolver

        public static IlrXmlNsResolver getNamespaceResolver(java.lang.String defaultPackage)
        Returns a namespace resolver based on a unique default package. Schema structures are translated into Java components included in this package.
        Parameters:
        defaultPackage - The default package of the translated Java class.
        Returns:
        the namespace resolver.
      • createDataDriver

        public static IlrXmlDataDriver createDataDriver(IlrRuleset ruleset)
                                                 throws IlrXmlErrorException
        Creates a new data driver from a ruleset. The XOM is shared between the data driver and the ruleset.
        Throws:
        IlrXmlErrorException
        Parameters:
        ruleset - The ruleset from which to take a data driver.
        Returns:
        a new data driver.
      • createDataDriver

        public static IlrXmlDataDriver createDataDriver(IlrContext context)
                                                 throws IlrXmlErrorException
        Creates a new data driver from a context. The XOM is shared between the data driver and the context.
        Throws:
        IlrXmlErrorException
        Parameters:
        context - The IlrContext from which to take a data driver.
        Returns:
        a new data driver.
      • assertXmlObject

        public static IlrXmlObject assertXmlObject(IlrContext context,
                                   java.lang.String xsdFile,
                                   java.lang.String pckName,
                                   java.lang.String xmlFile)
                                            throws IlrXmlErrorException,
                                                   java.io.FileNotFoundException
        Adds the XML object defined by its XML data file and its schema model description in a context.
        Throws:
        IlrXmlErrorException - when there are errors during the schema or the document file parsing.
        java.io.FileNotFoundException - when the schema or the document file are not found.
        Parameters:
        context - The context where the object is recursively added.
        xsdFile - The XSD file name defining the model of the object.
        pckName - The package where the object's class is defined.
        xmlFile - The XML data file that stores the XML objects.
        Returns:
        the added XML object.
      • mergeXoms

        public static boolean mergeXoms(IlrReflect fromXom,
                        IlrReflect toXom,
                        IlrSelector selector)
        Merges two dynamic XOM properties.
        Parameters:
        fromXom - The source XOM.
        toXom - The final XOM.
        selector - The selector to be applied. Can be null.
        Returns:
        the result of the merge.

© Copyright IBM Corp. 1987, 2017