Class XmlReader

java.lang.Object
org.pgcodekeeper.core.loader.jdbc.XmlReader

public class XmlReader extends Object
XML reader for parsing Microsoft SQL Server XML query results. Provides typed access to XML attributes converted from database query results.
  • Method Details

    • getDouble

      public double getDouble(String columnName)
      Returns the double value for the specified column name.
      Parameters:
      columnName - the column name
      Returns:
      the double value, or 0 if null
    • getLong

      public long getLong(String columnName)
      Returns the long value for the specified column name.
      Parameters:
      columnName - the column name
      Returns:
      the long value, or 0 if null
    • getBoolean

      public boolean getBoolean(String columnName)
      Returns the boolean value for the specified column name. Returns true if the value equals "1".
      Parameters:
      columnName - the column name
      Returns:
      true if the value is "1", false otherwise
    • getString

      public String getString(String columnName)
      Returns the string value for the specified column name.
      Parameters:
      columnName - the column name
      Returns:
      the string value, or null if not found
    • getFloat

      public float getFloat(String columnName)
      Returns the float value for the specified column name.
      Parameters:
      columnName - the column name
      Returns:
      the float value, or 0 if null
    • getInt

      public int getInt(String columnName)
      Returns the integer value for the specified column name.
      Parameters:
      columnName - the column name
      Returns:
      the integer value, or 0 if null
    • getShort

      public short getShort(String columnName)
      Returns the short value for the specified column name.
      Parameters:
      columnName - the column name
      Returns:
      the short value, or 0 if null
    • readXML

      public static List<XmlReader> readXML(String xml) throws XmlReaderException
      Parses XML string into a list of XmlReader instances. Each child element of the root becomes an XmlReader with its attributes as accessible data.
      Parameters:
      xml - the XML string to parse
      Returns:
      list of XmlReader instances, one for each child element
      Throws:
      XmlReaderException - if XML parsing fails