Home | History | Annotate | Download | only in dom
      1 /*
      2  * Copyright (C) 2007 Esmertec AG.
      3  * Copyright (C) 2007 The Android Open Source Project
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package com.android.mms.dom;
     19 
     20 import org.w3c.dom.Attr;
     21 import org.w3c.dom.DOMException;
     22 import org.w3c.dom.Element;
     23 import org.w3c.dom.Node;
     24 import org.w3c.dom.TypeInfo;
     25 
     26 public class AttrImpl extends NodeImpl implements Attr {
     27     private String mName;
     28     private String mValue;
     29 
     30 	/*
     31      * Internal methods
     32      */
     33 
     34 	protected AttrImpl(DocumentImpl owner, String name) {
     35 		super(owner);
     36 		mName = name;
     37 	}
     38 
     39     /*
     40      * Attr Interface Methods
     41      */
     42 
     43 	public String getName() {
     44 		return mName;
     45 	}
     46 
     47 	public Element getOwnerElement() {
     48 		// TODO Auto-generated method stub
     49 		return null;
     50 	}
     51 
     52 	public boolean getSpecified() {
     53 		return mValue != null;
     54 	}
     55 
     56 	public String getValue() {
     57 		return mValue;
     58 	}
     59 
     60 	// Instead of setting a <code>Text></code> with the content of the
     61 	// String value as defined in the specs,  we directly set here the
     62 	// internal mValue member.
     63 	public void setValue(String value) throws DOMException {
     64 		mValue = value;
     65 	}
     66 
     67     /*
     68      * Node Interface Methods
     69      */
     70 
     71 	@Override
     72 	public String getNodeName() {
     73 		return mName;
     74 	}
     75 
     76 	@Override
     77 	public short getNodeType() {
     78 		return Node.ATTRIBUTE_NODE;
     79 	}
     80 
     81 	@Override
     82 	public Node getParentNode() {
     83 		return null;
     84 	}
     85 
     86 	@Override
     87 	public Node getPreviousSibling() {
     88 		return null;
     89 	}
     90 
     91 	@Override
     92 	public Node getNextSibling() {
     93 		return null;
     94 	}
     95 
     96 	@Override
     97 	public void setNodeValue(String nodeValue) throws DOMException {
     98         setValue(nodeValue);
     99     }
    100 
    101     public TypeInfo getSchemaTypeInfo() {
    102         return null;
    103     }
    104 
    105     public boolean isId() {
    106         return false;
    107     }
    108 }
    109