Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>DefaultHandler</code> class provides a callback to listen for start elements, and it has a signature that contains an <code>Attributes</code> object, representing the attributes of that element.</p> <p><a href="http://download.oracle.com/javase/6/docs/api/org/xml/sax/helpers/DefaultHandler.html#startElement%28java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes%29" rel="nofollow"><code>startElement(String uri, String localName, String qName, Attributes attributes)</code></a></p> <p>Looking at the <code>Attributes</code> interface, I see methods to help you out.</p> <ol> <li>If you don't know which attributes you are interested in, and you want to look at all attributes, you should use <code>getLength()</code>, and the do a <code>for-loop</code> over that length, looking at each attributes <code>getLocalName(int)</code> or <code>getQName(int)</code>, and you can find its value by calling <code>getValue(int)</code> (all <code>int</code>'s are used as indices into the attributes list).</li> <li>If you do know which attributes you are interested in, you can simply call <code>getValue(String)</code>, passing in the string name of the attribute you are after.</li> </ol> <p>Here is some example code that could get you the names and values of all attributes of a given element:</p> <pre><code>public void startElement(String ns, String localName, String qName, Attributes attrs) throws SAXException { for(int i = 0; i &lt; attrs.getLength(); ++i) { String attrName = attrs.getLocalName(i); String attrValue = attrs.getValue(i); //do stuff with name/value } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload