Changeset 15

Show
Ignore:
Timestamp:
07/22/05 11:49:34 (3 years ago)
Author:
schst
Message:

Allow more than one definition file

Files:

Legend:

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

    r1 r15  
    9494        return amount; 
    9595    } 
     96     
     97    /** 
     98     * Append more namespace definitions to the current 
     99     * definitions. Can be used if namespace definitions are read from 
     100     * more than one file. 
     101     *  
     102     * @param namespaceDefs 
     103     */ 
     104    public void appendNamespaceDefinitions(NamespaceDefinitions nsDefs) { 
     105        String namespace; 
     106        NamespaceDefinition nsDef; 
     107         
     108        for (Iterator iter = nsDefs.getDefinedNamespaces().iterator(); iter.hasNext();) { 
     109             namespace = (String) iter.next(); 
     110             nsDef     = nsDefs.getNamespaceDefinition(namespace); 
     111             this.addNamespaceDefinition(namespace, nsDef); 
     112        } 
     113    } 
    96114} 
  • trunk/src/net/schst/XJConf/XmlReader.java

    r14 r15  
    6969    private SAXParserFactory parserFactory = null; 
    7070 
    71      
     71    /** 
     72     * Classloader that will be used for extensions 
     73     * and dynamically created classes 
     74     */ 
    7275    private ClassLoader loader = this.getClass().getClassLoader(); 
    7376     
     77    /** 
     78     * Constructor 
     79     */ 
    7480    public XmlReader() { 
    7581        super(); 
    7682    } 
    77      
     83 
     84    /** 
     85     * Constructor 
     86     *  
     87     * You may pass a classloader to the constructor which will be 
     88     * used to: 
     89     * - load extension classes 
     90     * - load dynamically created clases 
     91     *  
     92     * @param loader 
     93     */ 
    7894    public XmlReader(ClassLoader loader) { 
    7995        super(); 
     
    8197    } 
    8298     
    83      
    8499   /** 
    85100    * Set the tag definitions 
     
    98113    } 
    99114 
     115    /** 
     116     * Add more namespacedefinitions to the currently 
     117     * added definitions. 
     118     *  
     119     * This is useful, when your namespace definitions 
     120     * are distributed among different files. 
     121     *  
     122     * @param defs  namespace definitions 
     123     */ 
     124    public void addTagDefinitions(NamespaceDefinitions defs) { 
     125        if (this.tagDefs == null) { 
     126            this.setTagDefinitions(defs); 
     127            return; 
     128        } 
     129        this.tagDefs.appendNamespaceDefinitions(defs); 
     130    } 
     131     
    100132    /** 
    101133     * Add a new extension 
     
    241273            namespaceURI = "__default"; 
    242274        } 
    243          
     275 
    244276        // ignore the root tag 
    245277        if (this.depth == 0) { 
  • trunk/src/net/schst/XJConf/ext/XInclude.java

    r10 r15  
    1818     */ 
    1919    private String namespace = "http://www.w3.org/2001/XInclude"; 
    20      
     20 
     21    /** 
     22     * Get the namspace URI  
     23     */ 
    2124    public String getNamespace() { 
    2225        return this.namespace;