Class XPathHelper


  • public class XPathHelper
    extends java.lang.Object
    Helper class to assemble an XPATH expression to qualify the path of an XML schema structure from the XML schema root.
    Since:
    1.1
    Author:
    Werner Guttmann
    • Constructor Summary

      Constructors 
      Constructor Description
      XPathHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getSchemaLocation​(Structure structure)
      Returns a string (XPATH) representation of an XML Schema component.
      static java.lang.String getSchemaLocation​(Structure structure, boolean dealWithAnonTypes)
      Returns a string (XPATH) representation of an XML Schema component.
      static void getSchemaLocation​(Structure structure, java.lang.StringBuffer location)
      Deduces an XPATH expression qualifying the path from the schema root to the given structure in question.
      static void getSchemaLocation​(Structure structure, java.lang.StringBuffer location, boolean dealWithAnonTypes)
      Deduces an XPATH expression qualifying the path from the schema root to the given structure in question.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XPathHelper

        public XPathHelper()
    • Method Detail

      • getSchemaLocation

        public static void getSchemaLocation​(Structure structure,
                                             java.lang.StringBuffer location)
        Deduces an XPATH expression qualifying the path from the schema root to the given structure in question.
        Parameters:
        structure - AN XML structure.
        location - The XPATH expression to be created.
      • getSchemaLocation

        public static void getSchemaLocation​(Structure structure,
                                             java.lang.StringBuffer location,
                                             boolean dealWithAnonTypes)
        Deduces an XPATH expression qualifying the path from the schema root to the given structure in question.
        Parameters:
        structure - AN XML structure.
        location - The XPATH expression to be created.
        dealWithAnonTypes - Indicates whether to include XPATH fragments for anonymous types.
      • getSchemaLocation

        public static java.lang.String getSchemaLocation​(Structure structure,
                                                         boolean dealWithAnonTypes)
        Returns a string (XPATH) representation of an XML Schema component. This representation is directly adapted from XPath and will used as a key to store the component bindings.

        The location of a structure is composed of two parts:

        1. the location of the parent structure
        2. the local location of the structure itself

        The local location is defined by:

        • If the structure is an Element: the location is the XPath representation "/element_name"
        • If the structure is an Attribute: the location is the XPath representation "/@attribute_name"
        • If the structure is a ComplexType: the location is "complexType:complexType_name"
        • If the structure is a SimpleType: the location is "simpleType:simpleType_name"
        • If the structure is a Enumeration: the location is "enumType:enumType_name"
        • If the structure is a ModelGroup: the location is "group:group_name"
        Note that only top-level groups and complexTypes are named and thus will
        Parameters:
        structure - the structure for which to return a representation.
        dealWithAnonTypes - Indicates whether to include XPATH fragments for anonymous types.
        Returns:
        a string representation of an XML Schema component.
      • getSchemaLocation

        public static java.lang.String getSchemaLocation​(Structure structure)
        Returns a string (XPATH) representation of an XML Schema component. This representation is directly adapted from XPath and will used as a key to store the component bindings.
        Parameters:
        structure - the structure for which to return a representation
        Returns:
        a string representation of the XPATH identifying an XML Schema component
        See Also:
        getSchemaLocation(Structure, boolean)