⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attributes.html

📁 使用dom2,sax2解析xml,使用解析器生成、转化xml
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><!--JBuilder QuickDoc-->
<HEAD>
<TITLE>Class org.xml.sax.Attributes</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
</HEAD>
<BODY>

<H2>
<FONT SIZE="-1">org.xml.sax</FONT>
<BR>Interface Attributes</H2>
<DL>
<DT>public interface <B>Attributes</B>
</DL>
<DL><DD>Interface for a list of XML attributes. <blockquote> <em>This module, both source code and documentation, is in the Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> </blockquote> <p>This interface allows access to a list of attributes in three different ways:</p> <ol> <li>by attribute index;</li> <li>by Namespace-qualified name; or</li> <li>by qualified (prefixed) name.</li> </ol> <p>The list will not contain attributes that were declared #IMPLIED but not specified in the start tag. It will also not contain attributes used as Namespace declarations (xmlns*) unless the <code>http://xml.org/sax/features/namespace-prefixes</code> feature is set to <var>true</var> (it is <var>false</var> by default).</p> <p>If the namespace-prefixes feature (see above) is <var>false</var>, access by qualified name may not be available; if the <code>http://xml.org/sax/features/namespaces</code> feature is <var>false</var>, access by Namespace-qualified names may not be available.</p> <p>This interface replaces the now-deprecated SAX1 <A HREF="org.xml.sax.AttributeList AttributeList">AttributeList</A> interface, which does not contain Namespace support. In addition to Namespace support, it adds the <var>getIndex</var> methods (below).</p> <p>The order of attributes in the list is unspecified, and will vary from implementation to implementation.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Version:</B><DD>2.0r2pre</DD>
<DT><B>Author:</B><DD>David Megginson, <a href="mailto:sax@megginson.com">sax@megginson.com</a></DD>
<DT><B>Since:</B><DD>SAX 2.0</DD>
<DT><B>See Also:</B><DD>org.xml.sax.helpers.AttributeListImpl</DD>
</DL>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF"><TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B>
</FONT></TD></TR></TABLE>

<H3>getLength</H3>
<PRE>
public abstract int <B>getLength</B>()</PRE>
<DL><DD>Return the number of attributes in the list. <p>Once you know the number of attributes, you can iterate through the list.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>The number of attributes in the list.</DD>
<DT><B>See Also:</B><DD>#getURI(int)</DD>
<DD>#getLocalName(int)</DD>
<DD>#getQName(int)</DD>
<DD>#getType(int)</DD>
<DD>#getValue(int)</DD>
</DL>
<HR>

<H3>getURI</H3>
<PRE>
public abstract String <B>getURI</B>(int&nbsp;index)</PRE>
<DL><DD>Look up an attribute's Namespace URI by index.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - The attribute index (zero-based).</DD>
<DT><B>Returns:</B><DD>The Namespace URI, or the empty string if none is available, or null if the index is out of range.</DD>
<DT><B>See Also:</B><DD>#getLength</DD>
</DL>
<HR>

<H3>getLocalName</H3>
<PRE>
public abstract String <B>getLocalName</B>(int&nbsp;index)</PRE>
<DL><DD>Look up an attribute's local name by index.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - The attribute index (zero-based).</DD>
<DT><B>Returns:</B><DD>The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range.</DD>
<DT><B>See Also:</B><DD>#getLength</DD>
</DL>
<HR>

<H3>getQName</H3>
<PRE>
public abstract String <B>getQName</B>(int&nbsp;index)</PRE>
<DL><DD>Look up an attribute's XML 1.0 qualified name by index.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - The attribute index (zero-based).</DD>
<DT><B>Returns:</B><DD>The XML 1.0 qualified name, or the empty string if none is available, or null if the index is out of range.</DD>
<DT><B>See Also:</B><DD>#getLength</DD>
</DL>
<HR>

<H3>getType</H3>
<PRE>
public abstract String <B>getType</B>(int&nbsp;index)</PRE>
<DL><DD>Look up an attribute's type by index. <p>The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).</p> <p>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-Value Normalization").</p> <p>For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - The attribute index (zero-based).</DD>
<DT><B>Returns:</B><DD>The attribute's type as a string, or null if the index is out of range.</DD>
<DT><B>See Also:</B><DD>#getLength</DD>
</DL>
<HR>

<H3>getValue</H3>
<PRE>
public abstract String <B>getValue</B>(int&nbsp;index)</PRE>
<DL><DD>Look up an attribute's value by index. <p>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.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - The attribute index (zero-based).</DD>
<DT><B>Returns:</B><DD>The attribute's value as a string, or null if the index is out of range.</DD>
<DT><B>See Also:</B><DD>#getLength</DD>
</DL>
<HR>

<H3>getIndex</H3>
<PRE>
public int <B>getIndex</B>(String&nbsp;uri,
                    String&nbsp;localName)</PRE>
<DL><DD>Look up the index of an attribute by Namespace name.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI, or the empty string if the name has no Namespace URI.</DD>
<DD><CODE>localName</CODE> - The attribute's local name.</DD>
<DT><B>Returns:</B><DD>The index of the attribute, or -1 if it does not appear in the list.</DD>
</DL>
<HR>

<H3>getIndex</H3>
<PRE>
public int <B>getIndex</B>(String&nbsp;qName)</PRE>
<DL><DD>Look up the index of an attribute by XML 1.0 qualified name.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>qName</CODE> - The qualified (prefixed) name.</DD>
<DT><B>Returns:</B><DD>The index of the attribute, or -1 if it does not appear in the list.</DD>
</DL>
<HR>

<H3>getType</H3>
<PRE>
public abstract String <B>getType</B>(String&nbsp;uri,
                               String&nbsp;localName)</PRE>
<DL><DD>Look up an attribute's type by Namespace name. <p>See <A HREF="#getType(int) getType(int)">getType(int)</A> for a description of the possible types.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI, or the empty String if the name has no Namespace URI.</DD>
<DD><CODE>localName</CODE> - The local name of the attribute.</DD>
<DT><B>Returns:</B><DD>The attribute type as a string, or null if the attribute is not in the list or if Namespace processing is not being performed.</DD>
</DL>
<HR>

<H3>getType</H3>
<PRE>
public abstract String <B>getType</B>(String&nbsp;qName)</PRE>
<DL><DD>Look up an attribute's type by XML 1.0 qualified name. <p>See <A HREF="#getType(int) getType(int)">getType(int)</A> for a description of the possible types.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>qName</CODE> - The XML 1.0 qualified name.</DD>
<DT><B>Returns:</B><DD>The attribute type as a string, or null if the attribute is not in the list or if qualified names are not available.</DD>
</DL>
<HR>

<H3>getValue</H3>
<PRE>
public abstract String <B>getValue</B>(String&nbsp;uri,
                                String&nbsp;localName)</PRE>
<DL><DD>Look up an attribute's value by Namespace name. <p>See <A HREF="#getValue(int) getValue(int)">getValue(int)</A> for a description of the possible values.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI, or the empty String if the name has no Namespace URI.</DD>
<DD><CODE>localName</CODE> - The local name of the attribute.</DD>
<DT><B>Returns:</B><DD>The attribute value as a string, or null if the attribute is not in the list.</DD>
</DL>
<HR>

<H3>getValue</H3>
<PRE>
public abstract String <B>getValue</B>(String&nbsp;qName)</PRE>
<DL><DD>Look up an attribute's value by XML 1.0 qualified name. <p>See <A HREF="#getValue(int) getValue(int)">getValue(int)</A> for a description of the possible values.</p><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>qName</CODE> - The XML 1.0 qualified name.</DD>
<DT><B>Returns:</B><DD>The attribute value as a string, or null if the attribute is not in the list or if qualified names are not available.</DD>
</DL>
<HR>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -