Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.impl » richParser » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans.impl.richParser;
   17   
   18   import org.apache.xmlbeans.GDate;
   19   import org.apache.xmlbeans.GDuration;
   20   import org.apache.xmlbeans.XmlCalendar;
   21   import org.apache.xmlbeans.impl.common.XmlWhitespace;
   22   
   23   import javax.xml.stream.XMLStreamReader;
   24   import javax.xml.stream.XMLStreamException;
   25   import javax.xml.namespace.QName;
   26   import java.math.BigInteger;
   27   import java.math.BigDecimal;
   28   import java.util.Date;
   29   import java.io.InputStream;
   30   
   31   /**
   32    * This interface extends the simple XMLStreamReader interface adding
   33    * methods to get java objects asociated with schemas simple types like:
   34    * ints, long, BigIntegers, Dates etc
   35    *
   36    * Note: Given the fact that an implemetation of this interface will not
   37    * run validation in the stream, we will not include support for lists,
   38    * enumeration and unions. They might be possible to introduce but the
   39    * user has to push the corect schema type. Because usualy the backends
   40    * are not list/union aware, there would be not performance win from this.
   41    * If interest rises for this, support should be added.
   42    *
   43    * Author: Cezar Andrei (cezar.andrei at bea.com)
   44    * Date: Nov 14, 2003
   45    */
   46   public interface XMLStreamReaderExt
   47       extends XMLStreamReader
   48   {
   49        public static final int WS_PRESERVE = XmlWhitespace.WS_PRESERVE;
   50        public static final int WS_REPLACE = XmlWhitespace.WS_REPLACE;
   51        public static final int WS_COLLAPSE = XmlWhitespace.WS_COLLAPSE;
   52   
   53       /** Returns the value as a {@link String}. */
   54       public String getStringValue() throws XMLStreamException;
   55   
   56       /** Returns the value as a {@link String}, with wsStyle applied. */
   57       public String getStringValue(int wsStyle) throws XMLStreamException;
   58   
   59       /** Returns the value as a boolean. */
   60       public boolean getBooleanValue() throws XMLStreamException;
   61   
   62       /** Returns the value as a byte. */
   63       public byte getByteValue() throws XMLStreamException;
   64   
   65       /** Returns the value as a short. */
   66       public short getShortValue() throws XMLStreamException;
   67   
   68       /** Returns the value as an int. */
   69       public int getIntValue() throws XMLStreamException;
   70   
   71       /** Returns the value as a long. */
   72       public long getLongValue() throws XMLStreamException;
   73   
   74       /** Returns the value as a {@link java.math.BigInteger}. */
   75       public BigInteger getBigIntegerValue() throws XMLStreamException;
   76   
   77       /** Returns the value as a {@link java.math.BigDecimal}. */
   78       public BigDecimal getBigDecimalValue() throws XMLStreamException;
   79   
   80       /** Returns the value as a float. */
   81       public float getFloatValue() throws XMLStreamException;
   82   
   83       /** Returns the value as a double. */
   84       public double getDoubleValue() throws XMLStreamException;
   85   
   86       /** Returns the decoded hexbinary value as an InputStream. */
   87       public InputStream getHexBinaryValue() throws XMLStreamException;
   88   
   89       /** Returns the decoded base64 value as anInputStream. */
   90       public InputStream getBase64Value() throws XMLStreamException;
   91   
   92       /** Returns the value as an XmlCalendar which extends {@link java.util.Calendar}. */
   93       public XmlCalendar getCalendarValue() throws XMLStreamException;
   94   
   95       /** Returns the value as a {@link java.util.Date}. */
   96       public Date getDateValue() throws XMLStreamException;
   97   
   98       /** Returns the value as a {@link org.apache.xmlbeans.GDate}. */
   99       public GDate getGDateValue() throws XMLStreamException;
  100   
  101       /** Returns the value as a {@link org.apache.xmlbeans.GDuration}. */
  102       public GDuration getGDurationValue() throws XMLStreamException;
  103   
  104       /** Returns the value as a {@link javax.xml.namespace.QName}. */
  105       public QName getQNameValue() throws XMLStreamException;
  106   
  107       /** Returns the value as a {@link String}. */
  108       public String getAttributeStringValue(int index) throws XMLStreamException;
  109   
  110       /** Returns the value as a {@link String}, with wsStyle applied. */
  111       public String getAttributeStringValue(int index, int wsStyle) throws XMLStreamException;
  112   
  113       /** Returns the value as a boolean. */
  114       public boolean getAttributeBooleanValue(int index) throws XMLStreamException;
  115   
  116       /** Returns the value as a byte. */
  117       public byte getAttributeByteValue(int index) throws XMLStreamException;
  118   
  119       /** Returns the value as a short. */
  120       public short getAttributeShortValue(int index) throws XMLStreamException;
  121   
  122       /** Returns the value as an int. */
  123       public int getAttributeIntValue(int index) throws XMLStreamException;
  124   
  125       /** Returns the value as a long. */
  126       public long getAttributeLongValue(int index) throws XMLStreamException;
  127   
  128       /** Returns the value as a {@link java.math.BigInteger}. */
  129       public BigInteger getAttributeBigIntegerValue(int index) throws XMLStreamException;
  130   
  131       /** Returns the value as a {@link java.math.BigDecimal}. */
  132       public BigDecimal getAttributeBigDecimalValue(int index) throws XMLStreamException;
  133   
  134       /** Returns the value as a float. */
  135       public float getAttributeFloatValue(int index) throws XMLStreamException;
  136   
  137       /** Returns the value as a double. */
  138       public double getAttributeDoubleValue(int index) throws XMLStreamException;
  139   
  140       /** Returns the decoded hexbinary value as an InputStream. */
  141       public InputStream getAttributeHexBinaryValue(int index) throws XMLStreamException;
  142   
  143       /** Returns the decoded base64 value as anInputStream. */
  144       public InputStream getAttributeBase64Value(int index) throws XMLStreamException;
  145   
  146       /** Returns the value as an XmlCalendar which extends {@link java.util.Calendar}. */
  147       public XmlCalendar getAttributeCalendarValue(int index) throws XMLStreamException;
  148   
  149       /** Returns the value as a {@link java.util.Date}. */
  150       public Date getAttributeDateValue(int index) throws XMLStreamException;
  151   
  152       /** Returns the value as a {@link org.apache.xmlbeans.GDate}. */
  153       public GDate getAttributeGDateValue(int index) throws XMLStreamException;
  154   
  155       /** Returns the value as a {@link org.apache.xmlbeans.GDuration}. */
  156       public GDuration getAttributeGDurationValue(int index) throws XMLStreamException;
  157   
  158       /** Returns the value as a {@link javax.xml.namespace.QName}. */
  159       public QName getAttributeQNameValue(int index) throws XMLStreamException;
  160   
  161       /** Returns the value as a {@link String}. */
  162       public String getAttributeStringValue(String uri, String local) throws XMLStreamException;
  163   
  164       /** Returns the value as a {@link String}, with wsStyle applied. */
  165       public String getAttributeStringValue(String uri, String local, int wsStyle) throws XMLStreamException;
  166   
  167       /** Returns the value as a boolean. */
  168       public boolean getAttributeBooleanValue(String uri, String local) throws XMLStreamException;
  169   
  170       /** Returns the value as a byte. */
  171       public byte getAttributeByteValue(String uri, String local) throws XMLStreamException;
  172   
  173       /** Returns the value as a short. */
  174       public short getAttributeShortValue(String uri, String local) throws XMLStreamException;
  175   
  176       /** Returns the value as an int. */
  177       public int getAttributeIntValue(String uri, String local) throws XMLStreamException;
  178   
  179       /** Returns the value as a long. */
  180       public long getAttributeLongValue(String uri, String local) throws XMLStreamException;
  181   
  182       /** Returns the value as a {@link java.math.BigInteger}. */
  183       public BigInteger getAttributeBigIntegerValue(String uri, String local) throws XMLStreamException;
  184   
  185       /** Returns the value as a {@link java.math.BigDecimal}. */
  186       public BigDecimal getAttributeBigDecimalValue(String uri, String local) throws XMLStreamException;
  187   
  188       /** Returns the value as a float. */
  189       public float getAttributeFloatValue(String uri, String local) throws XMLStreamException;
  190   
  191       /** Returns the value as a double. */
  192       public double getAttributeDoubleValue(String uri, String local) throws XMLStreamException;
  193   
  194       /** Returns the decoded hexbinary value as an InputStream. */
  195       public InputStream getAttributeHexBinaryValue(String uri, String local) throws XMLStreamException;
  196   
  197       /** Returns the decoded base64 value as anInputStream. */
  198       public InputStream getAttributeBase64Value(String uri, String local) throws XMLStreamException;
  199   
  200       /** Returns the value as an XmlCalendar which extends {@link java.util.Calendar}. */
  201       public XmlCalendar getAttributeCalendarValue(String uri, String local) throws XMLStreamException;
  202   
  203       /** Returns the value as a {@link java.util.Date}. */
  204       public Date getAttributeDateValue(String uri, String local) throws XMLStreamException;
  205   
  206       /** Returns the value as a {@link org.apache.xmlbeans.GDate}. */
  207       public GDate getAttributeGDateValue(String uri, String local) throws XMLStreamException;
  208   
  209       /** Returns the value as a {@link org.apache.xmlbeans.GDuration}. */
  210       public GDuration getAttributeGDurationValue(String uri, String local) throws XMLStreamException;
  211   
  212       /** Returns the value as a {@link javax.xml.namespace.QName}. */
  213       public QName getAttributeQNameValue(String uri, String local) throws XMLStreamException;
  214   
  215       /** Sets the default value for the next getXXXValue() call.
  216        *  For example:
  217        *     setDefaultValue("7");
  218        *     //the xml looks like: <int>  </int>
  219        *     int i = getIntValue(); // returns 7
  220        *     // from now on the default value will not apply anymore
  221        * Note: Works for getAttributeXXXValue(...) too.
  222        */
  223       public void setDefaultValue(String defaultValue) throws XMLStreamException;
  224   }

Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.impl » richParser » [javadoc | source]