Changeset 37

Show
Ignore:
Timestamp:
08/02/05 23:06:25 (3 years ago)
Author:
schst
Message:

Renamed Tag to DefinedTag?, fixed XInclude

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/net/schst/XJConf/AttributeDefinition.java

    r35 r37  
    167167     * @return  Class object 
    168168     */ 
    169     public Class getValueType(Tag tag, ClassLoader loader) { 
     169    public Class getValueType(DefinedTag tag, ClassLoader loader) { 
    170170        try { 
    171171            return this.vConverter.getType(loader); 
     
    198198     * @throws ValueConversionException 
    199199     */ 
    200     public Object convertValue(Tag tag, ClassLoader loader) 
     200    public Object convertValue(DefinedTag tag, ClassLoader loader) 
    201201        throws ValueConversionException { 
    202202        String value; 
  • trunk/src/net/schst/XJConf/CDataDefinition.java

    r32 r37  
    7474     * Convert the character data to any type 
    7575     */ 
    76     public Object convertValue(Tag tag, ClassLoader loader) 
     76    public Object convertValue(DefinedTag tag, ClassLoader loader) 
    7777            throws ValueConversionException { 
    7878 
     
    9696     * @return  Class object 
    9797     */ 
    98     public Class getValueType(Tag tag, ClassLoader loader) { 
     98    public Class getValueType(DefinedTag tag, ClassLoader loader) { 
    9999        try { 
    100100            return this.vConverter.getType(loader); 
  • trunk/src/net/schst/XJConf/ChildDefinition.java

    r35 r37  
    4141     * Convert the value 
    4242     */ 
    43     public Object convertValue(Tag tag, ClassLoader loader) 
     43    public Object convertValue(DefinedTag tag, ClassLoader loader) 
    4444            throws ValueConversionException { 
    45         Tag child = tag.getChild(this.getName()); 
     45        DefinedTag child = tag.getChild(this.getName()); 
    4646        if (child == null) { 
    4747            throw new RuntimeException("Child element " + this.getName() + " does not exist"); 
     
    5555     * @return  Class object 
    5656     */ 
    57     public Class getValueType(Tag tag, ClassLoader loader) { 
    58         Tag child = tag.getChild(this.getName()); 
     57    public Class getValueType(DefinedTag tag, ClassLoader loader) { 
     58        DefinedTag child = tag.getChild(this.getName()); 
    5959        if (child == null) { 
    6060            throw new RuntimeException("Child element " + this.getName() + " does not exist"); 
  • trunk/src/net/schst/XJConf/ConstructorDefinition.java

    r32 r37  
    3737     * This does not do anything! 
    3838     */ 
    39     public Object convertValue(Tag tag, ClassLoader loader) 
     39    public Object convertValue(DefinedTag tag, ClassLoader loader) 
    4040            throws ValueConversionException { 
    4141        return null; 
     
    5454     * @return  Always returns null  
    5555     */ 
    56     public Class getValueType(Tag tag, ClassLoader loader) { 
     56    public Class getValueType(DefinedTag tag, ClassLoader loader) { 
    5757        return null; 
    5858    } 
  • trunk/src/net/schst/XJConf/DefinedTag.java

    r36 r37  
    1717 * @author Stephan Schmidt 
    1818 */ 
    19 public class Tag { 
     19public class DefinedTag { 
    2020   /** 
    2121    * name of the tag  
     
    4848    * @param name   name of the tag 
    4949    */ 
    50     public Tag(String name) { 
     50    public DefinedTag(String name) { 
    5151        this.name = name; 
    5252    } 
     
    5858    * @param atts   attributes of the tag 
    5959    */ 
    60     public Tag(String name, Attributes atts) { 
     60    public DefinedTag(String name, Attributes atts) { 
    6161        this.name = name; 
    6262 
     
    7373    * @return       number of childs added 
    7474    */ 
    75     public int addChild(Tag child) { 
     75    public int addChild(DefinedTag child) { 
    7676        this.children.add(child); 
    7777        return this.children.size(); 
     
    122122     * @return 
    123123     */ 
    124     public Tag getChild(String name) { 
     124    public DefinedTag getChild(String name) { 
    125125        for (Iterator iter = this.children.iterator(); iter.hasNext();) { 
    126             Tag child = (Tag) iter.next(); 
     126            DefinedTag child = (DefinedTag) iter.next(); 
    127127            if (child.getName().equals(name)) { 
    128128                return child; 
     
    182182     * @return  Class object 
    183183     */ 
    184     public Class getValueType(Tag tag, ClassLoader loader) { 
     184    public Class getValueType(DefinedTag tag, ClassLoader loader) { 
    185185        return this.def.getValueType(tag, loader); 
    186186    } 
  • trunk/src/net/schst/XJConf/Definition.java

    r32 r37  
    2727     * @throws ValueConversionException 
    2828     */ 
    29     public Object convertValue(Tag tag, ClassLoader loader) throws ValueConversionException; 
     29    public Object convertValue(DefinedTag tag, ClassLoader loader) throws ValueConversionException; 
    3030     
    3131    /** 
     
    3535     * @return 
    3636     */ 
    37     public Class getValueType(Tag tag, ClassLoader loader); 
     37    public Class getValueType(DefinedTag tag, ClassLoader loader); 
    3838     
    3939    /** 
  • trunk/src/net/schst/XJConf/Extension.java

    r36 r37  
    2525     * @throws XJConfException 
    2626     */ 
    27     public void startElement(XmlReader reader, Tag tag) 
     27    public void startElement(XmlReader reader, DefinedTag tag) 
    2828        throws XJConfException; 
    2929 
     
    3535     * @throws XJConfException 
    3636     */ 
    37     public Object endElement(XmlReader reader, Tag tag) 
     37    public Object endElement(XmlReader reader, DefinedTag tag) 
    3838        throws XJConfException;    
    3939    } 
  • trunk/src/net/schst/XJConf/TagDefinition.java

    r35 r37  
    127127     * @return   name of the tag 
    128128     */ 
    129     public String getKey(Tag tag) { 
     129    public String getKey(DefinedTag tag) { 
    130130        if (this.name.equals("__attribute")) { 
    131131            return tag.getAttribute(this.nameAttribute); 
     
    148148     * @return  Class object 
    149149     */ 
    150     public Class getValueType(Tag tag, ClassLoader loader) { 
     150    public Class getValueType(DefinedTag tag, ClassLoader loader) { 
    151151        try { 
    152152            return this.vConverter.getType(loader); 
     
    189189     * @throws ValueConversionException 
    190190     */ 
    191     public Object convertValue(Tag tag, ClassLoader loader) 
     191    public Object convertValue(DefinedTag tag, ClassLoader loader) 
    192192        throws ValueConversionException { 
    193193 
     
    237237     * @throws ValueConversionException 
    238238     */ 
    239     private void addAttributesToValue(Object instance, Tag tag, ClassLoader loader) 
     239    private void addAttributesToValue(Object instance, DefinedTag tag, ClassLoader loader) 
    240240        throws ValueConversionException { 
    241241         
     
    277277     * @throws ValueConversionException 
    278278     */ 
    279     private void addChildrenToValue(Object instance, Tag tag, ClassLoader loader) 
     279    private void addChildrenToValue(Object instance, DefinedTag tag, ClassLoader loader) 
    280280        throws ValueConversionException { 
    281281         
     
    292292 
    293293        for (int i = 0; i < children.size(); i++) { 
    294             Tag child = (Tag)children.get(i); 
     294            DefinedTag child = (DefinedTag)children.get(i); 
    295295 
    296296            if (ignore.contains(child.getName())) { 
  • trunk/src/net/schst/XJConf/XmlReader.java

    r36 r37  
    238238        } 
    239239 
    240         Tag tag = new Tag(qName, atts); 
     240        DefinedTag tag = new DefinedTag(sName, atts); 
    241241        // fetch the defintion for this tag 
    242242        TagDefinition tagDef = this.tagDefs.getTagDefinition(namespaceURI, sName); 
     
    281281 
    282282        // get the last tag from the stack 
    283         Tag tag = (Tag)this.tagStack.pop(); 
     283        DefinedTag tag = (DefinedTag)this.tagStack.pop(); 
    284284 
    285285        if (this.extensions.containsKey(namespaceURI)) { 
    286286            Object result = ((Extension)(this.extensions.get(namespaceURI))).endElement(this, tag); 
     287             
    287288        } else { 
    288289            if (this.depth == 1) { 
    289290                this.config.put(tag.getKey(), tag.getConvertedValue(this.loader)); 
    290291            } else { 
    291                 Tag parent = (Tag)this.tagStack.pop(); 
     292                DefinedTag parent = (DefinedTag)this.tagStack.pop(); 
    292293                parent.addChild(tag); 
    293294                this.tagStack.push(parent); 
     
    306307            return; 
    307308        } 
    308         Tag tag = (Tag)this.tagStack.peek(); 
     309        DefinedTag tag = (DefinedTag)this.tagStack.peek(); 
    309310        tag.addData(buf, offset, len); 
    310311    } 
  • trunk/src/net/schst/XJConf/ext/XInclude.java

    r36 r37  
    44 
    55import net.schst.XJConf.Extension; 
    6 import net.schst.XJConf.Tag; 
     6import net.schst.XJConf.DefinedTag; 
    77import net.schst.XJConf.XmlReader; 
    88import net.schst.XJConf.ext.xinc.XIncludeException; 
     
    3535     * child elements. 
    3636     */ 
    37     public void startElement(XmlReader reader, Tag tag) { 
     37    public void startElement(XmlReader reader, DefinedTag tag) { 
    3838    } 
    3939 
     
    4343     * Does the actual x-include. 
    4444     */ 
    45     public Object endElement(XmlReader reader, Tag tag) 
     45    public Object endElement(XmlReader reader, DefinedTag tag) 
    4646        throws XIncludeException { 
    4747         
    4848        if (tag.getName().equals("include")) { 
     49             
    4950            String href = tag.getAttribute("href"); 
    5051            if (href == null) {