All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javolution.xml.sax.Attributes Maven / Gradle / Ivy

Go to download

Only the Java Core part of Javolution library, with slight modifications for use in MSFTBX.

The newest version!
/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2012 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 */
package javolution.xml.sax;

import java.lang.CharSequence;

import javolution.text.CharArray;

/**
 * 

This interface represents a list of XML attributes.

* *

It is a more efficient version of org.xml.sax.Attributes * with {@link CharArray CharArray}/{@link CharSequence CharSequence} * instead of the String to avoid forcing dynamic object * allocations.

* * @author David Megginson * @author Jean-Marie Dautelle * @version 4.0, June 16, 2006 */ public interface Attributes { /** * Returns the number of attributes in this list of attributes. * * @return the number of attributes. */ int getLength(); /** * Looks up an attribute's Namespace URI by index. * * @param index the attribute index (zero-based). * @return the Namespace URI, or an empty character sequence if none is * available, or null if the index is out of range. * @see #getLength */ CharArray getURI(int index); /** * Looks up an attribute's local name by index. * * @param index the attribute index (zero-based). * @return the local name, or an empty character sequence if Namespace * processing is not being performed, or null if * the index is out of range. * @see #getLength */ CharArray getLocalName(int index); /** * Looks up an attribute's XML 1.0 qualified name by index. * * @param index the attribute index (zero-based). * @return the XML 1.0 qualified name, or an empty character sequence if * none is available, or null if the index is out * of range. * @see #getLength */ CharArray getQName(int index); /** * Looks up an attribute's type by index. * *

The attribute type is one of the strings "CDATA", "ID", * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", * or "NOTATION" (always in upper case).

* *

If the parser has not read a declaration for the attribute, * or if the parser does not report attribute types, then it must * return the value "CDATA" as stated in the XML 1.0 Recommentation * (clause 3.3.3, "Attribute-TextBuilder Normalization").

* *

For an enumerated attribute that is not a notation, the * parser will report the type as "NMTOKEN".

* * @param index the attribute index (zero-based). * @return the attribute's type as a string, or null if the * index is out of range. * @see #getLength */ CharArray getType(int index); /** * Looks up an attribute's value by index. * *

If the attribute value is a list of tokens (IDREFS, * ENTITIES, or NMTOKENS), the tokens will be concatenated * into a single string with each token separated by a * single space.

* * @param index the attribute index (zero-based). * @return the attribute's value as a character sequence, * null if the index is out of range. * @see #getLength */ CharArray getValue(int index); /** * Looks up the index of an attribute by namespace name (convenience * method). * This method returns the index of the attribute whose uri/localName * have the same character content as the specified uri/localName. * * @param uri the Namespace URI, or an empty character sequence if * the name has no Namespace URI. * @param localName the attribute's local name. * @return the index of the attribute, or -1 if it does not * appear in the list. */ int getIndex(CharSequence uri, CharSequence localName); /** * Looks up the index of an attribute by XML 1.0 qualified name * (convenience method). This method returns the index of the attribute * whose name has the same character content as the specified qName. * * @param qName the qualified (prefixed) name. * @return the index of the attribute, or -1 if it does not * appear in the list. */ int getIndex(CharSequence qName); /** * Looks up an attribute's type by Namespace name (convenience method). * This method returns the type of the attribute whose uri/localName * have the same character content as the specified uri/localName. * * @param uri the Namespace URI, or an empty string if the * name has no Namespace URI. * @param localName the local name of the attribute. * @return the attribute type as a string, or null if the attribute is not * in the list or if Namespace processing is not being performed. */ CharArray getType(CharSequence uri, CharSequence localName); /** * Looks up an attribute's type by XML 1.0 qualified name. * This method returns the type of the attribute whose qName * has the same character content as the specified qName. * * @param qName The XML 1.0 qualified name. * @return the attribute type as a string, or null if the attribute is not * in the list or if qualified names are not available. */ CharArray getType(CharSequence qName); /** * Looks up an attribute's value by Namespace name (convenience method). * This method returns the value of the attribute whose uri/localName * have the same character content as the specified uri/localName. * * @param uri the Namespace URI, or the empty string if the name has no * Namespace URI. * @param localName the local name of the attribute. * @return the attribute value as a character sequence, or null * if the attribute is not in the list. */ CharArray getValue(CharSequence uri, CharSequence localName); /** * Looks up an attribute's value by XML 1.0 qualified name (convenience * method). This method returns the value of the attribute whose qName * has the same character content as the specified qName. * * @param qName The XML 1.0 qualified name. * @return the attribute value as a character sequence, or null * if the attribute is not in the list or if qualified names * are not available. */ CharArray getValue(CharSequence qName); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy