KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > mathml > MathMLElementImpl


1 package JSci.mathml;
2
3 import org.w3c.dom.*;
4 import org.w3c.dom.mathml.*;
5 import org.apache.xerces.dom.ElementNSImpl;
6
7 /**
8  * Implements a MathML element (and node list).
9  * @version 1.0
10  * @author Mark Hale
11  */

12 public class MathMLElementImpl extends ElementNSImpl implements MathMLElement, MathMLNodeList {
13         static final String JavaDoc mathmlURI = "http://www.w3.org/1998/Math/MathML";
14
15         /**
16          * Constructs a MathML element.
17          */

18         public MathMLElementImpl(MathMLDocumentImpl owner, String JavaDoc qualifiedName) {
19                 super(owner, mathmlURI, qualifiedName);
20         }
21
22         public String JavaDoc getClassName() {
23                 return getAttribute("class");
24         }
25         public void setClassName(String JavaDoc className) {
26                 setAttribute("class", className);
27         }
28
29         public String JavaDoc getMathElementStyle() {
30                 return getAttribute("style");
31         }
32         public void setMathElementStyle(String JavaDoc mathElementStyle) {
33                 setAttribute("style", mathElementStyle);
34         }
35
36         public String JavaDoc getId() {
37                 return getAttribute("id");
38         }
39         public void setId(String JavaDoc id) {
40                 setAttribute("id", id);
41         }
42
43         public String JavaDoc getHref() {
44                 return getAttribute("xlink:href");
45         }
46         public void setHref(String JavaDoc href) {
47                 setAttribute("xlink:href", href);
48         }
49
50         public String JavaDoc getXref() {
51                 return getAttribute("xref");
52         }
53         public void setXref(String JavaDoc xref) {
54                 setAttribute("xref", xref);
55         }
56
57         public MathMLMathElement getOwnerMathElement() {
58                 if (this instanceof MathMLMathElement) {
59                         return null;
60                 }
61                 Node parent = getParentNode();
62                 while (!(parent instanceof MathMLMathElement)) {
63                         parent = parent.getParentNode();
64                 }
65                 return (MathMLMathElement) parent;
66         }
67 }
68
Popular Tags