Class AbstractReader

    • Constructor Detail

      • AbstractReader

        protected AbstractReader()
        Creates an AbstractReader with a NameCoder that does nothing.
        Since:
        1.4
      • AbstractReader

        protected AbstractReader​(NameCoder nameCoder)
        Creates an AbstractReader with a provided NameCoder.
        Parameters:
        nameCoder - the name coder used to read names from the incoming format
        Since:
        1.4
    • Method Detail

      • underlyingReader

        public HierarchicalStreamReader underlyingReader()
        Return the underlying HierarchicalStreamReader implementation.

        If a Converter needs to access methods of a specific HierarchicalStreamReader implementation that are not defined in the HierarchicalStreamReader interface, it should call this method before casting. This is because the reader passed to the Converter is often wrapped/decorated by another implementation to provide additional functionality (such as XPath tracking).

        For example:

        MySpecificReader mySpecificReader = (MySpecificReader)reader; // INCORRECT!
         mySpecificReader.doSomethingSpecific();
        MySpecificReader mySpecificReader = (MySpecificReader)reader.underlyingReader();  // CORRECT!
         mySpecificReader.doSomethingSpecific();

        Implementations of HierarchicalStreamReader should return 'this', unless they are a decorator, in which case they should delegate to whatever they are wrapping.

        Specified by:
        underlyingReader in interface HierarchicalStreamReader
      • decodeNode

        public java.lang.String decodeNode​(java.lang.String name)
        Decode a node name from the target format.
        Parameters:
        name - the name in the target format
        Returns:
        the original name
        Since:
        1.4
      • decodeAttribute

        public java.lang.String decodeAttribute​(java.lang.String name)
        Decode an attribute name from the target format.
        Parameters:
        name - the name in the target format
        Returns:
        the original name
        Since:
        1.4
      • encodeNode

        protected java.lang.String encodeNode​(java.lang.String name)
        Encode the node name again into the name of the target format. Internally used.
        Parameters:
        name - the original name
        Returns:
        the name in the target format
        Since:
        1.4
      • encodeAttribute

        protected java.lang.String encodeAttribute​(java.lang.String name)
        Encode the attribute name again into the name of the target format. Internally used.
        Parameters:
        name - the original name
        Returns:
        the name in the target format
        Since:
        1.4