Attachment 'Elem.java'

Download

   1 /* Creado en 23-ago-2005 */
   2 package fcc.ima.cocoon;
   3 
   4 import org.xml.sax.Attributes;
   5 
   6 /**Stores a SAX element.
   7  * <p>Almacenamiento de elemento SAX.
   8  * @author dperezcar*/
   9 public class Elem {
  10 	public String uri;
  11 	public String localName;
  12 	public String qName;
  13 	public Attributes atr;
  14 	
  15 	public Elem() {
  16 	}
  17 	public Elem(String uri, String nombreLocal, String nombreCua, Attributes atr) {
  18 		this(uri, nombreLocal, nombreCua);
  19 		this.atr = atr;
  20 	}
  21 	/**In case attributes are unneeded.
  22 	 * <p>En caso de q no se necesiten atributos*/
  23 	public Elem(String uri, String localName, String qName) {
  24 		this.uri = uri;
  25 		this.localName = localName;
  26 		this.qName = qName;
  27 	}
  28 	public String toString() {
  29 		return uri == null || uri.length() == 0 ? localName : uri+":"+localName;
  30 	}
  31 	/**Includes in addition attributes.
  32 	 * <p>Incluye ade+ atributos*/
  33 	public String toStringEx() {
  34 		StringBuffer sb = new StringBuffer(toString());
  35 		if (atr != null) {
  36 			int num = atr.getLength();
  37 			for (int i = 0; i < num; i++) {
  38 				sb.append("\n  ");
  39 				String uri = atr.getURI(i);
  40 				if (uri != null && uri.length() > 0) {
  41 					sb.append(uri);
  42 					sb.append(":");
  43 				}
  44 				sb.append(atr.getLocalName(i));
  45 				sb.append("=");
  46 				sb.append(atr.getValue(i));
  47 			}
  48 		}
  49 		return sb.toString();
  50 	}
  51 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.