FileDocCategorySizeDatePackage
ElementImpl.javaAPI DocJava SE 5 API7482Fri Aug 26 14:55:52 BST 2005com.sun.org.apache.xerces.internal.impl.xs.opti

ElementImpl

public class ElementImpl extends DefaultElement
author
Rahul Srivastava, Sun Microsystems Inc.
author
Sandy Gao, IBM
version
$Id: ElementImpl.java,v 1.5 2003/07/24 15:14:42 neilg Exp $

Fields Summary
SchemaDOM
schemaDOM
Attr[]
attrs
int
row
int
col
int
parentRow
int
line
int
column
Constructors Summary
public ElementImpl(int line, int column)

        row = -1;
        col = -1;
        parentRow = -1;
        nodeType = Node.ELEMENT_NODE;
        
        this.line = line;
        this.column = column;
    
public ElementImpl(String prefix, String localpart, String rawname, String uri, int line, int column)

    	super(prefix, localpart, rawname, uri, Node.ELEMENT_NODE);
    	row = -1;
        col = -1;
        parentRow = -1;

        this.line = line;
        this.column = column;
    
Methods Summary
public java.lang.StringgetAttribute(java.lang.String name)

    
        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getName().equals(name)) {
                return attrs[i].getValue();
            }
        }
        return "";
    
public java.lang.StringgetAttributeNS(java.lang.String namespaceURI, java.lang.String localName)

        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getLocalName().equals(localName) && attrs[i].getNamespaceURI().equals(namespaceURI)) {
                return attrs[i].getValue();
            }
        }
        return "";
    
public org.w3c.dom.AttrgetAttributeNode(java.lang.String name)

        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getName().equals(name)) {
                return attrs[i];
            }
        }
        return null;
    
public org.w3c.dom.AttrgetAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)

        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getName().equals(localName) && attrs[i].getNamespaceURI().equals(namespaceURI)) {
                return attrs[i];
            }
        }
        return null;
    
public org.w3c.dom.NamedNodeMapgetAttributes()

        return new NamedNodeMapImpl(attrs);
    
public intgetColumnNumber()
Returns the column number.

        return column;
    
public org.w3c.dom.NodegetFirstChild()

        if (parentRow == -1) {
            return null;
        }
        return schemaDOM.relations[parentRow][1];
    
public org.w3c.dom.NodegetLastChild()

        if (parentRow == -1) {
            return null;
        }
        int i=1;
        for (; i<schemaDOM.relations[parentRow].length; i++) {
            if (schemaDOM.relations[parentRow][i] == null) {
                return schemaDOM.relations[parentRow][i-1];
            }
        }
        if (i ==1) {
            i++;
        }
        return schemaDOM.relations[parentRow][i-1];
    
public intgetLineNumber()
Returns the line number.

        return line;
    
public org.w3c.dom.NodegetNextSibling()

        if (col == schemaDOM.relations[row].length-1) {
            return null;
        }
        return schemaDOM.relations[row][col+1];
    
public org.w3c.dom.DocumentgetOwnerDocument()

        return schemaDOM;
    
public org.w3c.dom.NodegetParentNode()

        return schemaDOM.relations[row][0];
    
public org.w3c.dom.NodegetPreviousSibling()

        if (col == 1) {
            return null;
        }
        return schemaDOM.relations[row][col-1];
    
public java.lang.StringgetTagName()

        return rawname;
    
public booleanhasAttribute(java.lang.String name)

        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getName().equals(name)) {
                return true;
            }
        }
        return false;
    
public booleanhasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)

        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getName().equals(localName) && attrs[i].getNamespaceURI().equals(namespaceURI)) {
                return true;
            }
        }
        return false;
    
public booleanhasAttributes()

        return (attrs.length == 0 ? false : true);
    
public booleanhasChildNodes()

        if (parentRow == -1) {
            return false;
        }
        else {
            return true;
        }
    
public voidsetAttribute(java.lang.String name, java.lang.String value)

        for (int i=0; i<attrs.length; i++) {
            if (attrs[i].getName().equals(name)) {
                attrs[i].setValue(value);
                return;
            }
        }