001    /*
002     * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    /* $Id: Annotation.java 310 2007-05-18 20:26:36Z maxberger $ */
018    
019    package net.sourceforge.jeuclid.content.semantic;
020    
021    import net.sourceforge.jeuclid.MathBase;
022    import net.sourceforge.jeuclid.elements.AbstractInvisibleJEuclidElement;
023    
024    import org.w3c.dom.mathml.MathMLAnnotationElement;
025    
026    /**
027     * This class represents a annotation element.
028     * 
029     * @author Max Berger
030     * @version $Revision: 310 $
031     */
032    public class Annotation extends AbstractInvisibleJEuclidElement implements
033            MathMLAnnotationElement {
034    
035        /**
036         * The XML element from this class.
037         */
038        public static final String ELEMENT = "annotation";
039    
040        /** The body attribute. */
041        public static final String ATTR_BODY = "body";
042    
043        /** The encoding attribute. */
044        public static final String ATTR_ENCODING = "encoding";
045    
046        /**
047         * Creates a math element.
048         * 
049         * @param base
050         *            The base for the math element tree.
051         */
052        public Annotation(final MathBase base) {
053            super(base);
054        }
055    
056        /** {@inheritDoc} */
057        public String getTagName() {
058            return Annotation.ELEMENT;
059        }
060    
061        /** {@inheritDoc} */
062        public String getBody() {
063            return this.getMathAttribute(Annotation.ATTR_BODY);
064        }
065    
066        /** {@inheritDoc} */
067        public String getEncoding() {
068            return this.getMathAttribute(Annotation.ATTR_ENCODING);
069        }
070    
071        /** {@inheritDoc} */
072        public void setBody(final String body) {
073            this.setAttribute(Annotation.ATTR_BODY, body);
074        }
075    
076        /** {@inheritDoc} */
077        public void setEncoding(final String encoding) {
078            this.setAttribute(Annotation.ATTR_ENCODING, encoding);
079        }
080    
081    }