FileDocCategorySizeDatePackage
ElementImpl.javaAPI DocJava SE 6 API6221Tue Jun 10 00:22:46 BST 2008com.sun.org.apache.xerces.internal.impl.xs.opti

ElementImpl

public class ElementImpl extends DefaultElement
xerces.internal
author
Rahul Srivastava, Sun Microsystems Inc.
author
Sandy Gao, IBM
version
$Id: ElementImpl.java,v 1.2.6.1 2005/09/08 09:38:50 sunithareddy Exp $

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

        row = -1;
        col = -1;
        parentRow = -1;
        nodeType = Node.ELEMENT_NODE;
        
        this.line = line;
        this.column = column;
        charOffset = offset;
    
public ElementImpl(int line, int column)

        this(line, column, -1);
    
public ElementImpl(String prefix, String localpart, String rawname, String uri, int line, int column, int offset)

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

        this(prefix, localpart, rawname, uri, line, column, -1);
    
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 intgetCharacterOffset()
Returns the character offset.

        return charOffset;
    
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.StringgetSyntheticAnnotation()

        return fSyntheticAnnotation;
    
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;
            }
        }