home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML in Action / Dynamicke-HTML-v-akci-covermount.bin / XML / PARSER / XMLINST.EXE / classes / com / ms / xml / om / ElementFactoryImpl.java < prev    next >
Encoding:
Java Source  |  1997-11-05  |  1.5 KB  |  69 lines

  1. /*
  2.  * @(#)ElementFactoryImpl.java 1.0 6/3/97
  3.  * 
  4.  * Copyright (c) 1997 Microsoft, Corp. All Rights Reserved.
  5.  * 
  6.  */
  7.  
  8. package com.ms.xml.om;
  9.  
  10. import com.ms.xml.util.Name;
  11.  
  12. /**
  13.  * This class represents the default implementation for the element factory. 
  14.  * This is 
  15.  * what the XML parser uses if no other factory is specified. 
  16.   *
  17.  * @version 1.0, 6/3/97
  18.  */
  19. public class ElementFactoryImpl implements ElementFactory
  20. {
  21.     /**
  22.      * Constructs the factory object.
  23.      */
  24.     public ElementFactoryImpl()
  25.     {
  26.     }
  27.  
  28.  
  29.     /**
  30.      * Retrieves a new element for the specified tag and type.
  31.      * @param type The element type.
  32.      * @param tag The element name.
  33.      * @return the newly created element. 
  34.      */
  35.     public Element createElement(Element parent, int type, Name tag, String text)
  36.     {
  37.         Element e = new ElementImpl(tag, type);
  38.         if (text != null) 
  39.             e.setText(text);
  40.         if (parent != null)
  41.             parent.addChild(e,null);
  42.         return e; 
  43.     }
  44.  
  45.     /**
  46.      * This method is called when the element is fully parsed.
  47.      *
  48.      * @param   elem  The element parsed.
  49.      * @see     Element
  50.       * @return No return value.
  51.      */
  52.     public void parsed(Element elem) 
  53.     {
  54.     }
  55.  
  56.     /**
  57.      * this method is called when a new attribute is parsed for
  58.      * the given element.
  59.      */
  60.     public void parsedAttribute(Element e, Name name, Object value)
  61.     {
  62.         if (e != null)
  63.             e.setAttribute(name,value);
  64.     }
  65.  
  66.  
  67. }    
  68.  
  69.