001: /*
002: * Fast Infoset ver. 0.1 software ("Software")
003: *
004: * Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
005: *
006: * Software is licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License. You may
008: * obtain a copy of the License at:
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015: * License for the specific language governing permissions and limitations.
016: *
017: * Sun supports and benefits from the global community of open source
018: * developers, and thanks the community for its important contributions and
019: * open standards-based technology, which Sun has adopted into many of its
020: * products.
021: *
022: * Please note that portions of Software may be provided with notices and
023: * open source licenses from such communities and third parties that govern the
024: * use of those portions, and any licenses granted hereunder do not alter any
025: * rights and obligations you may have under such open source licenses,
026: * however, the disclaimer of warranty and limitation of liability provisions
027: * in this License will apply to all Software in this distribution.
028: *
029: * You acknowledge that the Software is not designed, licensed or intended
030: * for use in the design, construction, operation or maintenance of any nuclear
031: * facility.
032: *
033: * Apache License
034: * Version 2.0, January 2004
035: * http://www.apache.org/licenses/
036: *
037: */
038:
039: package org.jvnet.fastinfoset.sax;
040:
041: import org.xml.sax.Attributes;
042:
043: /**
044: * Interface for a list of XML attributes that may contain encoding algorithm
045: * data.
046: * <p>
047: * Implementations shall ensure that the {@link Attributes#getValue(int)} method
048: * correctly returns a String object even if the attribute is represented
049: * as algorithm data.
050: * <p>
051: * If an attribute has algorithm data then the {@link #getAlgorithmData} method
052: * shall return a non <code>null</code> value.
053: *
054: * @see org.jvnet.fastinfoset.sax.FastInfosetReader
055: * @see org.xml.sax.XMLReader
056: */
057: public interface EncodingAlgorithmAttributes extends Attributes {
058:
059: /**
060: * Return the URI of the encoding algorithm.
061: *
062: * <p>If the algorithm data corresponds to a built-in encoding algorithm
063: * then the null is returned.</p>
064: *
065: * <p>If the algorithm data corresponds to an application-defined encoding
066: * algorithm then the URI of the algorithm is returned.</p>
067: *
068: * <p>If {@link #getAlgorithmData(int)} returns null then the result of
069: * this method is undefined.<p>
070: *
071: * @param index The attribute index (zero-based).
072: * @return The URI. If the index is out of range then null is returned.
073: */
074: public String getAlgorithmURI(int index);
075:
076: /**
077: * Return the index of the encoding algorithm.
078: *
079: * <p>If {@link #getAlgorithmData(int)} returns null then the result of
080: * this method is undefined.<p>
081: *
082: * @param index The attribute index (zero-based).
083: * @return The algorithm index. If index is out of range then -1 is returned.
084: * @see org.jvnet.fastinfoset.EncodingAlgorithmIndexes
085: */
086: public int getAlgorithmIndex(int index);
087:
088: /**
089: * Return the data of the encoding algorithm.
090: *
091: * <p>If the algorithm data corresponds to a built-in encoding algorithm
092: * then an Object corresponding to the Java primitive type is returned.</p>
093: *
094: * <p>If the algorithm data corresponds to an application-defined encoding
095: * algorithm then an Object that is an instance of <code>byte[]</code>
096: * is returned if there is no EncodingAlgorithm registered for the
097: * application-defined encoding algorithm URI. Otherwise, an Object produced
098: * from the registeredEncodingAlgorithm is returned.</p>
099: *
100: * <p>If there no encoding algorithm data associated an attribute then
101: * <code>null</code> is returned.<p>
102: *
103: * @param index The attribute index (zero-based).
104: * @return The data. If the index is out of range then null is returned.
105: */
106: public Object getAlgorithmData(int index);
107:
108: /**
109: * Return the alphabet associated with the attribute value.
110: *
111: * @param index The attribute index (zero-based).
112: * @return The alphabet.
113: * If the index is out of range then null is returned.
114: * If there is is no alphabet then null is returned.
115: */
116: public String getAlpababet(int index);
117:
118: /**
119: * Return the whether the attribute value should be indexed or not.
120: *
121: * @param index The attribute index (zero-based).
122: * @return True if attribute value should be indexed, otherwise false.
123: */
124: public boolean getToIndex(int index);
125: }
|