harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r507006 [2/5] - in /harmony/enhanced/classlib/trunk/modules/swing: ./ src/main/java/common/javax/swing/text/html/parser/
Date Tue, 13 Feb 2007 14:02:58 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ContentModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ContentModel.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ContentModel.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ContentModel.java Tue Feb 13 06:02:55 2007
@@ -16,11 +16,14 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.27 $
  */
 package javax.swing.text.html.parser;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Vector;
 
 /**
@@ -512,4 +515,93 @@
             throw new ClassCastException (content.getClass().getName());
         }
     }
+    
+    
+    /**
+     * Determines the sequence of {@link Element} needed to be implied to
+     * insert an {@link Element}.
+     * 
+     * @param e
+     *            the {@link Element} found in the document are for which the
+     *            implication is needed.
+     * @param parsed
+     *            the {@link ArrayList} of {@link Element}s found previosly to
+     *            the {@link Element} e.
+     * @param many
+     *            a value specifyng whether the given {@link Element} may appear
+     *            more than once in the {@link ContentModel}
+     * @param depth
+     *            the depth level been searched in the {@link ContentModel}
+     * @param path
+     *            a possible path of implied {@link Element}s that may leed to
+     *            the {@link Element} e.
+     * @return 
+     *          <ol>
+     *          <li> null, if an implication path to the element e could not be found.
+     *          <li> an empty {@link List} if the element may be inserted
+     *               in the actual position, with no implication of other elements needed.
+     *          <li> a non empty {@link List} if some {@link Element}s need to be implied.
+     *               In such case, the {@link List} is formed by a pair. The first
+     *               component defines the {@link Element} needed to be implied. The
+     *               second component defines if the {@link Element} must be opened and
+     *               closed (if true) or just opened (false). 
+     *          </ol>
+     */
+    List<Pair<Element,Boolean>> implication(
+            final Element e,
+            final List<Element> parsed,
+            final boolean many,
+            final int depth,
+            final LinkedList<Pair<Element, Boolean>> path) {
+        
+        ContentModel auxModel;
+        List <Pair<Element,Boolean>> implied = null;
+
+        if (content instanceof Element) {
+            Element currentElement =(Element)content;
+            if (e.equals(currentElement) && (!parsed.contains(e) || many)) {
+                implied = new LinkedList<Pair<Element,Boolean>>(path);
+            } else if (currentElement.inclusions != null
+                        && e.getIndex() > 0
+                        && currentElement.inclusions.get(e.getIndex())) {
+                implied = new LinkedList<Pair<Element,Boolean>>(path);
+                implied.add(new Pair<Element,Boolean>(currentElement, Boolean.FALSE));
+            } else if (depth > 1
+                    && !currentElement.hasRequiredAttributes()
+                    && !currentElement.isEmpty()
+                    && !currentElement.isScript()
+                    && !parsed.contains(currentElement)
+                    && currentElement.getContent() != null) {
+                LinkedList<Pair<Element, Boolean>> newPath = (LinkedList)path.clone();
+                newPath.add(new Pair<Element, Boolean>(currentElement, new Boolean(false)));
+                implied = currentElement.getContent().implication(e, parsed, many, depth-1, newPath);
+            }
+        } else if (type == STAR_TYPE || type == PLUS_TYPE) {
+            if (content != null) {
+                implied = ((ContentModel)content).implication(e, parsed, true, depth, path);
+            }
+        } else if (type == COMMA_TYPE) {
+            auxModel = (ContentModel) content;
+            while (auxModel != null && implied == null) {
+                implied = auxModel.implication(e, parsed, many, depth, path);                   
+                if (implied == null && !auxModel.empty()) {
+                    path.add(new Pair<Element, Boolean>(auxModel.first(),
+                            new Boolean(true)));
+                }
+                auxModel = auxModel.next;
+            }
+        } else if (type == LINE_TYPE || type == AMPER_TYPE) {
+            auxModel = (ContentModel) content;
+            while (auxModel != null && implied == null) {
+                implied = auxModel.implication(e, parsed, many, depth, path);
+                auxModel = auxModel.next;
+            }
+        } else {
+            if (content != null) {
+                implied = ((ContentModel)content).implication(e, parsed, many, depth, path);
+            }
+        }
+
+        return implied;
+    }      
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java Tue Feb 13 06:02:55 2007
@@ -16,13 +16,12 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.11 $
  */
 package javax.swing.text.html.parser;
 
 import java.io.DataInputStream;
 import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.util.BitSet;
 import java.util.Hashtable;
 import java.util.Vector;
@@ -53,12 +52,13 @@
 
     private static final String pattern = "(\\|)+";
 
+    private boolean readDTD;
+    
     /**
      * Created DTD will not be pushed to DTD hash.
      * @throws IllegalArgumentException if name equals to null
      */
     public static DTD getDTD(final String name) throws IOException {
-        checkName(name);
         String key = name.toLowerCase();
         Object dtd = dtdHash.get(key);
         return dtd == null ? new DTD(name.toLowerCase()) : (DTD)dtd;
@@ -70,24 +70,9 @@
      */
     public static void putDTDHash(final String name,
                                   final DTD dtd) {
-        checkName(name);
-        checkValue(dtd);
         dtdHash.put(name.toLowerCase(), dtd);
     }
 
-    private static void checkName(final String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Name must be not null");
-        }
-    }
-
-    private static void checkValue(final DTD dtd) {
-        if (dtd == null) {
-            throw new IllegalArgumentException("DTD must be not null");
-        }
-    }
-
-
     protected DTD(final String name) {
         //TODO may be it need change the order
         this.name = name;
@@ -127,7 +112,9 @@
 
         putElement(createDefaultElement(HTMLConstants.STYLE_ELEMENT_NAME, 11));
         putElement(createDefaultElement(HTMLConstants.LINK_ELEMENT_NAME, 12));
-        putElement(new Element(13, HTMLConstants.UNKNOWN_ELEMENT_NAME, false,
+        putElement(createDefaultElement(HTMLConstants.SCRIPT_ELEMENT_NAME, 13));
+        
+        putElement(new Element(14, HTMLConstants.UNKNOWN_ELEMENT_NAME, false,
                                true, null, null, EMPTY, null, null, null));
 
         entityHash.put(HTMLConstants.SPACE_ENTITY_NAME,
@@ -146,7 +133,6 @@
         elementHash.put(element.getName(), element);
     }
 
-
     private Element createDefaultElement(final String name,
                                          final int index) {
         return new Element(index, name, false, false, null, null,
@@ -159,21 +145,16 @@
     }
 
     public void read(final DataInputStream stream) throws IOException {
-        ObjectInputStream is = new ObjectInputStream(stream);
-        try {
-            elementHash = (Hashtable<String, Element>)is.readObject();
-            elements = (Vector<Element>)is.readObject();
-            int size = is.readInt();
-            for (int i = 0; i < size; i ++) {
-                String name = (String)is.readObject();
-                int data = is.readInt();
-                DTDUtilities.handleEntity(this, name, data);
-            }
-            is.close();
-            updateFields();
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();
-        }
+        // converts from DataInputStream into a byte array
+        byte[] enc = new byte[stream.available()];
+        stream.read(enc);
+
+        // decode the byte array
+        Asn1Dtd asn1 = new Asn1Dtd(enc);
+        
+        // sets attributes
+        asn1.getDTD(this);
+        setReading(true);
     }
 
     public String toString() {
@@ -242,7 +223,10 @@
         BitSet result = new BitSet();
         for (int i = 0; i < names.length; i++) {
             Element elem = (Element)elementHash.get(names[i]);
-            if (elem != null) {
+            if (elem == null) {
+                elem = defineElement(names[i], DTDConstants.ANY, false, false, null, null, null, null);
+            }
+            if (!names[i].equals("")) {
                 result.set(elem.getIndex());
             }
         }
@@ -253,7 +237,8 @@
     protected Entity defEntity(final String name,
                                final int type,
                                final String str) {
-        return defineEntity(name, type, str == null ? null : str.toCharArray());
+//        return defineEntity(name, type, str == null ? null : str.toCharArray());
+        return defineEntity(name, type, str.toCharArray());
     }
 
     public Entity defEntity(final String name,
@@ -319,14 +304,24 @@
         if (obj == null) {
             result = new Entity(name, type, data);
             entityHash.put(name, result);
+            if (readDTD) {
+                for (int i=0; i<data.length; i++) {
+                    entityHash.put(Integer.valueOf(data[i]), result);
+                }
+            }
         } else {
             result = (Entity)obj;
         }
         return result;
     }
 
+    /**
+     *
+     * @return if index < 0 or elements.size() <= index returns null.
+     */
     public Element getElement(final int index) {
-        return elements.elementAt(index);
+        // same as RI
+        return (Element) elements.elementAt(index);
     }
 
     public Element getElement(final String name) {
@@ -340,7 +335,7 @@
     }
 
     public Entity getEntity(final int index) {
-        return null;
+        return entityHash.get(Integer.valueOf(index));
     }
 
     public Entity getEntity(final String name) {
@@ -350,29 +345,12 @@
     public String getName() {
         return name;
     }
-
-    private void replace(final Element elem) {
-        elementHash.put(elem.name, elem);
-        int index = elem.getIndex();
-        elements.setElementAt(elem, index);
-    }
-
-    private void updateField(final Element elem) {
-        elem.updateElement(getElement(elem.getName()));
-        replace(elem);
-    }
-
-    private void updateFields() {
-        updateField(pcdata);
-        updateField(html);
-        updateField(meta);
-        updateField(base);
-        updateField(isindex);
-        updateField(head);
-        updateField(body);
-        updateField(applet);
-        updateField(param);
-        updateField(p);
-        updateField(title);
+    
+    void setReading (boolean b) {
+        readDTD = b;
+    }
+    
+    boolean isRead () {
+        return readDTD;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDConstants.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDConstants.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDConstants.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDConstants.java Tue Feb 13 06:02:55 2007
@@ -16,7 +16,7 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.4 $
  */
 package javax.swing.text.html.parser;
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDUtilities.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDUtilities.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDUtilities.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTDUtilities.java Tue Feb 13 06:02:55 2007
@@ -16,13 +16,13 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.4 $
  */
 package javax.swing.text.html.parser;
 
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.ObjectOutputStream;
 import java.util.Hashtable;
 import java.util.Iterator;
 
@@ -230,33 +230,24 @@
         }
         dtd.defElement("#PCDATA", EMPTY, false, false, null, null, null, null);
     }
-    //TODO Probably, don't suplicate information in elements vector
-    static void createBinaryDTD(final String fileName) {
+    
+    public static void createBinaryDTD(final String fileName, DTD dtd) {
         try {
-           ObjectOutputStream os = new ObjectOutputStream(
-                                   new FileOutputStream(fileName));
-           DTD dtd = new DTD("tmp");
-           initDTD(dtd);
-           os.writeObject(dtd.elementHash);
-           os.writeObject(dtd.elements);
-           int size = dtd.entityHash.size();
-           os.writeInt((size - 3)/2);
-           Iterator iter = dtd.entityHash.keySet().iterator();
-           while (iter.hasNext()) {
-               Object key = iter.next();
-               if (key instanceof String
-                   && !key.equals("#SPACE")
-                   && !key.equals("#RS")
-                   && !key.equals("#RE")) {
-                   Entity entity = (Entity)dtd.entityHash.get(key);
-                   os.writeObject(key);
-                   os.writeInt(entity.data[0]);
-               }
-           }
-           os.flush();
-           os.close();
+            FileOutputStream stream = new FileOutputStream(fileName);
+            Asn1Dtd asn1 = new Asn1Dtd(dtd);
+            byte[] enc = asn1.getEncoded();
+            stream.write(enc);
+            stream.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
         } catch (IOException e) {
             e.printStackTrace();
         }
+    }
+    
+    public static void createBinaryDTD(final String fileName) {
+        DTD dtd = new DTD("tmp");
+        initDTD(dtd);
+        createBinaryDTD(fileName, dtd);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DocumentParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DocumentParser.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DocumentParser.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DocumentParser.java Tue Feb 13 06:02:55 2007
@@ -14,64 +14,98 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Evgeniya G. Maenkova
- * @version $Revision$
- */
 package javax.swing.text.html.parser;
 
 import java.io.IOException;
 import java.io.Reader;
 import javax.swing.text.ChangedCharSetException;
+import javax.swing.text.html.HTML;
 import javax.swing.text.html.HTMLEditorKit;
 
+/**
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.14 $
+ */
 public class DocumentParser extends Parser {
 
-    public DocumentParser(final DTD a0) {
-        super(a0);
-        throw new UnsupportedOperationException("Not implemented");
-    }
+    private static final HTML.Attribute HTTP_EQUIV = 
+        HTML.getAttributeKey("http-equiv");
 
+    private static final String CONTENT_TYPE = "content-type";
+    
+    private static final HTML.Attribute CONTENT = 
+        HTML.getAttributeKey("content");
+    
+    private static final String CHARSET = "charset";
+    
+    private HTMLEditorKit.ParserCallback callback;
 
-    protected void handleError(final int a0, final String a1) {
-        throw new UnsupportedOperationException("Not implemented");
+    private boolean ignoreCharSet;
 
+    public DocumentParser(final DTD dtd) {
+        super(dtd);
     }
 
-
-    protected void handleText(final char[] a0) {
-        throw new UnsupportedOperationException("Not implemented");
-
+    protected void handleError(final int ln, final String errorMsg) {
+        callback.handleError(errorMsg, ln);
     }
 
-
-    protected void handleEndTag(final TagElement a0) {
-        throw new UnsupportedOperationException("Not implemented");
+    protected void handleText(final char[] data) {
+        callback.handleText(data, getCurrentPos());
     }
 
-
-    protected void handleEmptyTag(final TagElement a0) throws ChangedCharSetException {
-        throw new UnsupportedOperationException("Not implemented");
-
+    protected void handleEndTag(final TagElement tag) {
+        callback.handleEndTag(tag.getHTMLTag(), getCurrentPos());
     }
 
+    protected void handleEmptyTag(final TagElement tag)
+            throws ChangedCharSetException {
+        if (!ignoreCharSet && (tag.getHTMLTag() == HTML.Tag.META)) {
+            String httpEquivValue = (String) getAttributes().getAttribute(HTTP_EQUIV);
+            String contentValue = (String) getAttributes().getAttribute(CONTENT);
 
-    protected void handleComment(final char[] a0) {
-        throw new UnsupportedOperationException("Not implemented");
-
+            if (httpEquivValue != null && contentValue != null &&
+                    httpEquivValue.equalsIgnoreCase(CONTENT_TYPE) &&
+                    contentValue.toLowerCase().contains(CHARSET)) {
+                // notice that always here ignoreCharSet will be false 
+                throw new ChangedCharSetException(contentValue, ignoreCharSet); 
+            }
+        }
+        callback.handleSimpleTag(
+                tag.getHTMLTag(), getAttributes(), getCurrentPos());
     }
 
-
-    protected void handleStartTag(final TagElement a0) {
-        throw new UnsupportedOperationException("Not implemented");
-
+    protected void handleComment(final char[] text) {
+        callback.handleComment(text, getCurrentPos());
     }
 
+    protected void handleStartTag(final TagElement tag) {
+        callback.handleStartTag(
+                tag.getHTMLTag(), getAttributes(), getCurrentPos());
+    }
+    
+    
 
-    public void parse(final Reader a0, final HTMLEditorKit.ParserCallback a1, final boolean a2) throws IOException {
-        throw new UnsupportedOperationException("Not implemented");
+    public void parse(final Reader in,
+            final HTMLEditorKit.ParserCallback callback,
+            final boolean ignoreCharSet) throws IOException {
+        /*
+         * TODO
+         * when the Reader in is null handle implied methods are invoked
+         * and the handleError report a nullPointerException 
+         * 
+         * Should be handled in Parser class without calling cup class ?  
+         */
 
-    }
+        this.callback = callback;
+        this.ignoreCharSet = ignoreCharSet;
+        super.parse(in);
 
-}
+        callback.handleEndOfLineString(super.getEOLString());    
 
+        // a close invocation flush the remaining bytes
+        in.close();  
+    }
+}
\ No newline at end of file

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Element.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Element.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Element.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Element.java Tue Feb 13 06:02:55 2007
@@ -16,12 +16,16 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.11 $
  */
 package javax.swing.text.html.parser;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.BitSet;
+import java.util.List;
+
+import javax.swing.text.html.HTML;
 
 public final class Element implements DTDConstants, Serializable {
     public int index;
@@ -43,6 +47,8 @@
     public AttributeList atts;
 
     public Object data;
+    
+    private final String SCRIPT_TAG_NAME = "script";
 
     Element(final int index,
             final String name,
@@ -86,9 +92,6 @@
 
     public AttributeList getAttributeByValue(final String value) {
         AttributeList currentAtts = this.atts;
-        if (value == null) {
-            return null;
-        }
         while (currentAtts != null) {
             if (currentAtts.containsValue(value)) {
                 return currentAtts;
@@ -100,11 +103,10 @@
 
     public AttributeList getAttribute(final String name) {
         AttributeList currentAtts = this.atts;
-        if (name == null) {
-            return null;
-        }
         while (currentAtts != null) {
-            if (name.equals(currentAtts.getName())) {
+            // we change the order of the comparision to force a 
+            // NullPointerException if currentAtts.getName() is null (same as RI)
+            if (currentAtts.getName().equals(name)) {
                 return currentAtts;
             }
             currentAtts = currentAtts.next;
@@ -113,7 +115,7 @@
     }
 
     public String toString() {
-        return name;
+        return name; // (same as RI)
     }
 
     public boolean isEmpty() {
@@ -171,18 +173,41 @@
         this.atts = atts;
         this.data = data;
     }
-
-    final void updateElement(final Element element) {
-        this.index = element.index;
-        this.name = element.name;
-        this.oStart = element.oStart;
-        this.oEnd = element.oEnd;
-        this.inclusions = element.inclusions;
-        this.exclusions = element.exclusions;
-        this.type = element.type;
-        this.content = element.content;
-        this.atts = element.atts;
-        this.data = element.data;
+    
+    /**
+     * Returns a list of required attributes for the {@link Element}.
+     * 
+     * @return a {@link List} with all the required attributes for the
+     *            {@link Element}.
+     */
+    final List<Object> getRequiredAttributes() {            
+        List<Object> reqAtts = new ArrayList<Object>();
+        AttributeList attList = atts;
+        while (attList != null) {
+            if (attList.getModifier() == DTDConstants.REQUIRED) {
+                Object attr = HTML.getAttributeKey(attList.getName());
+                reqAtts.add(attr == null ? attList.getName() : attr);
+            }
+            attList = attList.getNext();
+        }
+        return reqAtts;
+    }
+    
+    final boolean hasRequiredAttributes() {
+        boolean flag = false;
+        AttributeList attList = atts;
+        while (attList != null) {
+            if (attList.getModifier() == DTDConstants.REQUIRED) {
+                flag = true;
+                break;
+            }
+            attList = attList.getNext();
+        }
+        return flag;
+    }
+    
+    final boolean isScript() {
+        return name.equalsIgnoreCase(SCRIPT_TAG_NAME);
     }
 }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/ElementsHandler.java Tue Feb 13 06:02:55 2007
@@ -14,9 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.4 $
  */
 package javax.swing.text.html.parser;
 import java.util.Hashtable;
@@ -36,7 +37,7 @@
     static void handleElement(final String name,
                               final String desc) {
         DTDUtilities.handleElement(dtd, name, desc, atts);
-    }
+    }    
     static void initElementsCreation(final Object dtd) {
         ElementsHandler.dtd = dtd;
         handleAllElements();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/EntitiesHandler.java Tue Feb 13 06:02:55 2007
@@ -16,7 +16,7 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.4 $
  */
 package javax.swing.text.html.parser;
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/Entity.java Tue Feb 13 06:02:55 2007
@@ -16,7 +16,7 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.5 $
  */
 package javax.swing.text.html.parser;
 

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLAttributeList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLAttributeList.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLAttributeList.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLAttributeList.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,109 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents an attribute of a html tag. Contains a reference to the 
+ * next attribute. 
+ * 
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen 
+ * @version $Revision: 1.4 $
+ */
+class HTMLAttributeList {
+
+    /**
+     * The attribute name
+     */
+    private String attrName;
+    
+    /**
+     * The attribute value
+     */
+    private Object attrValue;
+    
+    /**
+     * The first position of the attribute 
+     */
+    private int pos;
+
+    /**
+     * The final position of the attribute 
+     */
+    private int endPos;
+    
+    /**
+     * Stores a list of lexical errors 
+     */
+    private List<String> error = null;
+    
+    /**
+     * A reference to the next attribute
+     */
+    private HTMLAttributeList next; 
+    
+    HTMLAttributeList (final String attrName, final Object attrValue, 
+            final int pos, final int endPos, final HTMLAttributeList next) {        
+        this(attrName,attrValue,pos,endPos,next,null);        
+    }	
+    
+    
+    HTMLAttributeList (final String attrName, final Object attrValue, 
+            final int pos, final int endPos, 
+            final HTMLAttributeList next,List<String> error) {
+    	this.attrName = attrName.toLowerCase();
+        this.attrValue = attrValue;
+        this.pos = pos;
+        this.endPos = endPos;
+        this.next = next;
+        this.error=error;                  
+    }
+    
+    List<String> getError(){
+    	return error;
+    }
+    
+    String getAttributeName () {
+        return attrName;
+    }
+    
+    Object getAttributeValue () {
+        return attrValue;
+    }
+    
+    int getPos () {
+        return pos;
+    }
+    
+    int getEndPos () {
+        return endPos;
+    }
+    
+    HTMLAttributeList getNext () {
+        return next;
+    }
+    
+    void setNext (HTMLAttributeList nextAttr) {
+        this.next = nextAttr;
+    }
+    
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLAttributeList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLComment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLComment.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLComment.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLComment.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,61 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+/**
+ * This class is used by CUP in order to encapsulte a html comment 
+ * in the stream 
+ * 
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.5 $
+ */
+class HTMLComment extends HTMLObject {
+
+    /**
+     * The comment's text
+     */
+	private String text;
+    
+    /**
+     * The comment's line
+     */
+    private int line;
+
+	public HTMLComment(String text, int offset, int line) {
+		super(offset);
+		this.text = text;
+        this.line = line;
+	}
+
+    /**
+     * @return the comment's text
+     */
+	public String getText() {
+		return text;
+	}
+    
+    /**
+     * @return the comment's line
+     */
+    public int getLine() {
+        return line;
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLComment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java?view=diff&rev=507006&r1=507005&r2=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLConstants.java Tue Feb 13 06:02:55 2007
@@ -16,27 +16,28 @@
  */
 /**
  * @author Evgeniya G. Maenkova
- * @version $Revision$
+ * @version $Revision: 1.12 $
  */
 package javax.swing.text.html.parser;
 
 interface HTMLConstants {
-    String PCDATA_ELEMENT_NAME = "#PCDATA";
-    String HTML_ELEMENT_NAME = "HTML";
-    String META_ELEMENT_NAME = "META";
-    String BASE_ELEMENT_NAME = "BASE";
-    String ISINDEX_ELEMENT_NAME = "ISINDEX";
-    String HEAD_ELEMENT_NAME = "HEAD";
-    String BODY_ELEMENT_NAME = "BODY";
-    String APPLET_ELEMENT_NAME = "APPLET";
-    String PARAM_ELEMENT_NAME = "PARAM";
-    String P_ELEMENT_NAME = "P";
-    String TITLE_ELEMENT_NAME = "TITLE";
-    String STYLE_ELEMENT_NAME = "STYLE";
-    String LINK_ELEMENT_NAME = "LINK";
-    String UNKNOWN_ELEMENT_NAME = "UNKNOWN";
-
+    String PCDATA_ELEMENT_NAME = "#pcdata";
+    String HTML_ELEMENT_NAME = "html";
+    String META_ELEMENT_NAME = "meta";
+    String BASE_ELEMENT_NAME = "base";
+    String ISINDEX_ELEMENT_NAME = "isindex";
+    String HEAD_ELEMENT_NAME = "head";
+    String BODY_ELEMENT_NAME = "body";
+    String APPLET_ELEMENT_NAME = "applet";
+    String PARAM_ELEMENT_NAME = "param";
+    String P_ELEMENT_NAME = "p";
+    String TITLE_ELEMENT_NAME = "title";
+    String STYLE_ELEMENT_NAME = "style";
+    String LINK_ELEMENT_NAME = "link";
+    String SCRIPT_ELEMENT_NAME = "script";
+    String UNKNOWN_ELEMENT_NAME = "unknown";
+    
     String SPACE_ENTITY_NAME = "#SPACE";
     String RS_ENTITY_NAME = "#RS";
     String RE_ENTITY_NAME = "#RE";
-}
+}
\ No newline at end of file

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLErrorType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLErrorType.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLErrorType.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLErrorType.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package javax.swing.text.html.parser;
+
+/**
+ * Represents the error types reported by the handle methods of 
+ * the class {@link Parser}.  
+ * 
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.6 $
+ */
+enum HTMLErrorType {
+    /*
+     * Notice the final space in some error constants: to behave as the RI 
+     */
+    ERR_TAG_UNRECOGNIZED("tag.unrecognized "),
+    ERR_END_UNRECOGNIZED("end.unrecognized"),
+    ERR_START_MISSING("start.missing"),
+    ERR_END_MISSING("end.missing"),
+    ERR_INVALID_TAG_ATTR("invalid.tagatt"),
+    ERR_MULTI_TAG_ATTR("multi.tagatt"),
+    ERR_REQ_ATT("req.att "),
+    ERR_INVALID_TAG_CHAR("invalid.tagchar"),
+    ERR_TAG_IGNORE("tag.ignore"),
+    ERR_TAG_UNEXPECTED("tag.unexpected"),
+    ERR_END_EXTRA_TAG("end.extra.tag"),
+    ERR_UNMATCHED_END_TAG("unmatched.endtag"),
+    ERR_THROWABLE("java.lang.IOException"),
+    ERR_ATTVALERR("attvalerr"),
+    ERR_EXPECTED("expected"),
+    ERR_EXPECTED_TAGNAME("expected.tagname"),
+    ERR_EOF_LITERAL("eof.literal"),
+    ERR_JAVASCRIPT_UNSUPPORTED("javascript.unsupported"), 
+    DEF_ERROR("?");
+    
+    /**
+     * Encapsulates the current error type 's value
+     */
+    private String value;
+    
+    /**
+     * Constructor
+     * 
+     * @param value Represents the error type 's value   
+     */
+    private HTMLErrorType(String value) {
+        this.value = value;
+    }
+    
+    /**
+     * Get the current error type 's value    
+     */
+    public String toString() {
+        return value;
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLErrorType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLMarkup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLMarkup.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLMarkup.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLMarkup.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+/**
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.3 $
+ */
+class HTMLMarkup extends HTMLObject{
+
+	private String declaration;
+    
+    private String content;
+
+	public HTMLMarkup(String decl, String cont, int offset) {		
+		super(offset);
+		this.declaration = decl;
+        this.content = cont;
+	}
+
+	public String getDeclaration() {
+		return declaration;
+	}
+
+    public String getContent() {
+        return content;
+    }
+   
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLMarkup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLObject.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLObject.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLObject.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLObject.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+/**
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.4 $
+ */
+abstract class HTMLObject {
+
+	private int offset;
+
+	public HTMLObject(int offset) {
+		this.offset = offset;
+	}
+
+	public int getOffset() {
+		return offset;
+	}
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTag.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTag.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTag.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTag.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,91 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+import javax.swing.text.SimpleAttributeSet;
+
+
+/**
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.14 $
+ */
+class HTMLTag extends HTMLObject {
+
+    private String name;
+     
+    private HTMLAttributeList attList;
+    
+    private HTMLTagType type;
+    
+    private int endPos;
+
+    private int line;
+    
+    private SimpleAttributeSet attributes;
+
+    /**
+     * The dafault value given as attribute value for an attribute whose
+     * value was not defined in the parsed document.
+     */
+    public static final String DEF_ATTR_VAL = "#DEFAULT";
+    
+	public HTMLTag(HTMLTagType type, String name, HTMLAttributeList attList, int offset, int endPos, int line) {
+		super(offset);
+		this.type = type;
+		this.attList = attList;
+        this.name = name.toLowerCase();
+        this.endPos = endPos;
+        this.line = line;
+        this.attributes = new SimpleAttributeSet();
+	}
+
+    /*
+     * getters
+     */
+    
+	public String getName() {
+		return name;
+	}
+
+    public HTMLAttributeList getHtmlAttributeList() {
+        return attList;
+    }
+    
+    public SimpleAttributeSet getAttributes() {
+        return attributes;
+    }
+    
+    public void setAttributes(SimpleAttributeSet attributes) {
+        this.attributes = attributes;
+    }
+    
+    public HTMLTagType getType() {
+		return type;
+	}
+
+    public int getEndPos() {
+        return endPos;
+    }
+    
+    public int getLine() {
+        return line;
+    }
+}
+

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTagType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTagType.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTagType.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTagType.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+/**
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.4 $
+ */
+enum HTMLTagType {
+    START, SIMPLE, END; 
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLTagType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLText.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLText.java?view=auto&rev=507006
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLText.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLText.java Tue Feb 13 06:02:55 2007
@@ -0,0 +1,103 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.swing.text.html.parser;
+
+
+/**
+ * @author Diego Raúl Mercado
+ * @author Alejandro Sánchez
+ * @author Alejandro Barturen
+ * @version $Revision: 1.11 $
+ */
+class HTMLText extends HTMLObject {
+
+    /**
+     * The text that was found in the text
+     */
+    private String text;
+
+    /**
+     * Determines whether a normal text had spaces at the begining of it (and were
+     * removed)
+     */
+    private boolean hasLeadingSpaces;
+
+    /**
+     * Determines whether a normal text had spaces at the end of it (and were
+     * removed)
+     */
+    private boolean hasTrailingSpaces;
+
+    /**
+     * Makes a new {@link HTMLText} object
+     * 
+     * @param text
+     *            The parsed text
+     * @param pos
+     *            The position where the text was found
+     * @param hasLeadingSpaces
+     *            Determines whether the parser text had spaces at the begining
+     *            of it.
+     * @param hasTrailingSpaces
+     *            Determines whether the parser text had spaces at the end
+     *            of it.
+     */
+    public HTMLText(String text, int pos, boolean hasLeadingSpaces, boolean hasTrailingSpaces) {
+        super(pos);
+        this.text = text;
+        this.hasLeadingSpaces = hasLeadingSpaces;
+        this.hasTrailingSpaces = hasTrailingSpaces;
+    }
+
+    /**
+     * Returns the parsed text contained by this object.
+     * 
+     * @return the parsed text.
+     */
+    public String getText() {
+        return text;
+    }
+
+    /**
+     * Tells if the parsed text (stored in this object) has spaces at the 
+     * begining of it.
+     * 
+     * @return True if the parsed text had spaces at the begining of it. Otherwise it
+     *         returns False.
+     */
+    public boolean hasLeadingSpaces() {
+        return hasLeadingSpaces;
+    }
+    
+    /**
+     * Tells if the parsed text (stored in this object) has spaces at the end of
+     * it.
+     * 
+     * @return True if the parsed text had spaces at the end of it. Otherwise it
+     *         returns False.
+     */
+    public boolean hasTrailingSpaces() {
+        return hasTrailingSpaces;
+    }    
+
+    public String toString() {
+    	return text;    	
+    }
+    
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/HTMLText.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message