Changeset 26055

Show
Ignore:
Timestamp:
01.08.2012 13:57:10 (7 years ago)
Author:
sjm84
Message:

Adding constants for the various XML namespaces used in the code

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java

    r26038 r26055  
    11package org.greenstone.gsdl3.action; 
    22 
    3 import org.greenstone.gsdl3.core.ModuleInterface; 
    4 import org.greenstone.gsdl3.util.*; 
    5 // XML classes 
    6 import org.w3c.dom.Node; 
    7 import org.w3c.dom.NodeList; 
    8 import org.w3c.dom.Element; 
    9 import org.w3c.dom.Document; 
    10  
    11 // other java stuff 
    12 import java.io.File; 
    13 import java.util.Vector; 
    143import java.util.HashMap; 
    154import java.util.HashSet; 
    165import java.util.Iterator; 
    176 
    18 import org.apache.log4j.*; 
     7import org.apache.log4j.Logger; 
     8import org.greenstone.gsdl3.core.ModuleInterface; 
     9import org.greenstone.gsdl3.util.GSConstants; 
     10import org.greenstone.gsdl3.util.GSParams; 
     11import org.greenstone.gsdl3.util.GSXML; 
     12import org.greenstone.gsdl3.util.UserContext; 
     13import org.greenstone.gsdl3.util.XMLConverter; 
     14import org.w3c.dom.Document; 
     15import org.w3c.dom.Element; 
     16import org.w3c.dom.Node; 
     17import org.w3c.dom.NodeList; 
    1918 
    2019/** base class for Actions */ 
     
    10099    protected void extractMetadataNames(Element format, HashSet<String> meta_names) 
    101100    { 
    102         //NodeList nodes = format.getElementsByTagNameNS("metadata", "http://www.greenstone.org/configformat"); 
    103         NodeList metadata_nodes = format.getElementsByTagName("gsf:metadata"); 
     101        NodeList metadata_nodes = format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "metadata"); 
    104102        for (int i = 0; i < metadata_nodes.getLength(); i++) 
    105103        { 
     
    111109            String sep = elem.getAttribute("separator"); 
    112110 
    113             if(pos.equals("offset")) { // offset when requested to use mdoffset 
    114                 metadata.append("offset"); 
    115                 metadata.append(GSConstants.META_RELATION_SEP);              
     111            if (pos.equals("offset")) 
     112            { // offset when requested to use mdoffset 
     113                metadata.append("offset"); 
     114                metadata.append(GSConstants.META_RELATION_SEP); 
    116115            } 
    117116            else if (!pos.equals("")) 
     
    147146        boolean getEquivLinkMeta = false; 
    148147 
    149         NodeList link_nodes = format.getElementsByTagName("gsf:link"); 
     148        NodeList link_nodes = format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "link"); 
    150149        for (int i = 0; i < link_nodes.getLength(); i++) 
    151150        { 
     
    157156                meta_names.add("srclinkFile"); 
    158157            } 
    159             else if (type.equals("web")) { 
    160                     meta_names.add("weblink"); 
     158            else if (type.equals("web")) 
     159            { 
     160                meta_names.add("weblink"); 
    161161                meta_names.add("webicon"); 
    162162                meta_names.add("/weblink"); 
    163163            } 
    164             else if (type.equals("equivdoc")) { 
     164            else if (type.equals("equivdoc")) 
     165            { 
    165166                getEquivLinkMeta = true; 
    166167            } 
     
    169170        // get all the metadata necessary for when the user has used "gsf:equivlink" 
    170171        // so that we can build up the equivlink from the metadata components it needs 
    171         link_nodes = format.getElementsByTagName("gsf:equivlinkgs3"); 
     172        link_nodes = format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "equivlinkgs3"); 
    172173        if (getEquivLinkMeta || link_nodes.getLength() > 0) 
    173174        { 
     
    191192        } 
    192193 
    193         if (format.getElementsByTagName("gsf:image").getLength() > 0) 
     194        if (format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "image").getLength() > 0) 
    194195        { 
    195196            meta_names.add("Thumb"); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java

    r26048 r26055  
    454454    protected void extractMetadataNames(Element new_format, HashSet<String> doc_meta_names, HashSet<String> class_meta_names) 
    455455    { 
    456         NodeList templates = new_format.getElementsByTagNameNS("http://www.greenstone.org/greenstone3/schema/ConfigFormat", "template"); 
     456        NodeList templates = new_format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "template"); 
    457457        for (int i = 0; i < templates.getLength(); i++) 
    458458        { 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/Receptionist.java

    r25871 r26055  
    11package org.greenstone.gsdl3.core; 
    22 
     3import java.io.File; 
     4import java.util.ArrayList; 
     5import java.util.HashMap; 
     6 
     7import org.apache.log4j.Logger; 
     8import org.greenstone.gsdl3.action.Action; 
     9import org.greenstone.gsdl3.util.GSConstants; 
     10import org.greenstone.gsdl3.util.GSFile; 
     11import org.greenstone.gsdl3.util.GSParams; 
     12import org.greenstone.gsdl3.util.GSXML; 
     13import org.greenstone.gsdl3.util.XMLConverter; 
    314import org.greenstone.util.GlobalProperties; 
    4 import org.greenstone.gsdl3.util.*; 
    5 import org.greenstone.gsdl3.action.*; 
    6 // XML classes 
     15import org.w3c.dom.Document; 
     16import org.w3c.dom.Element; 
    717import org.w3c.dom.Node; 
    818import org.w3c.dom.NodeList; 
    9 import org.w3c.dom.Document; 
    10 import org.w3c.dom.Element; 
    11  
    12 // other java classes 
    13 import java.io.File; 
    14 import java.util.HashMap; 
    15 import java.util.Enumeration; 
    16 import java.util.ArrayList; 
    17  
    18 import org.apache.log4j.*; 
    1919 
    2020/** 
     
    245245        page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT)); 
    246246        // just in case these namespaces end up in the page and we want to display the XML 
    247         page.setAttribute("xmlns:gsf", "http://www.greenstone.org/greenstone3/schema/ConfigFormat"); 
    248         page.setAttribute("xmlns:xsl", "http://www.w3.org/1999/XSL/Transform"); 
     247        page.setAttribute("xmlns:gsf", GSXML.GSF_NAMESPACE); 
     248        page.setAttribute("xmlns:xsl", GSXML.XSL_NAMESPACE); 
    249249 
    250250        //logger.info(a+" mesa=" + this.converter.getPrettyString(message)); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r26051 r26055  
    198198        { 
    199199            Document currentDoc = this.converter.getDOM(currentFile); 
    200             NodeList metadataElems = currentDoc.getElementsByTagNameNS("http://www.greenstone.org/greenstone3/schema/ConfigFormat", "metadata"); //gsf:metadata 
    201             NodeList imageElems = currentDoc.getElementsByTagNameNS("http://www.greenstone.org/greenstone3/schema/ConfigFormat", "image"); //gsf:image 
    202             NodeList includeElems = currentDoc.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "include"); 
    203             NodeList importElems = currentDoc.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "import"); 
     200            NodeList metadataElems = currentDoc.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "metadata"); //gsf:metadata 
     201            NodeList imageElems = currentDoc.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "image"); //gsf:image 
     202            NodeList includeElems = currentDoc.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "include"); 
     203            NodeList importElems = currentDoc.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "import"); 
    204204 
    205205            ArrayList<String> names = new ArrayList<String>(); 
     
    891891            try 
    892892            { 
    893                 Document inlineTemplateDoc = this.converter.getDOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:java=\"http://xml.apache.org/xslt/java\" xmlns:util=\"xalan://org.greenstone.gsdl3.util.XSLTUtil\" xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">" + inlineTemplate + "</xsl:stylesheet>", "UTF-8"); 
     893                Document inlineTemplateDoc = this.converter.getDOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"" + GSXML.XSL_NAMESPACE + "\" xmlns:java=\"" + GSXML.JAVA_NAMESPACE + "\" xmlns:util=\"" + GSXML.UTIL_NAMESPACE + "\" xmlns:gsf=\"" + GSXML.GSF_NAMESPACE + "\">" + inlineTemplate + "</xsl:stylesheet>", "UTF-8"); 
    894894 
    895895                if (_debug) 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CrossCollectionSearch.java

    r25635 r26055  
    8686        { 
    8787            // add in a default format statement 
    88             String format_string = "<format xmlns:gsf='http://www.greenstone.org/greenstone3/schema/ConfigFormat' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'><gsf:template match='documentNode'><td><a><xsl:attribute name='href'>?a=d&amp;c=<xsl:value-of select='@collection'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test=\"@nodeType='leaf'\">&amp;sib=1</xsl:if>&amp;dt=<xsl:value-of select='@docType'/>&amp;p.a=q&amp;p.s=" + TEXT_QUERY_SERVICE + "&amp;p.c="; 
     88            String format_string = "<format xmlns:gsf='" + GSXML.GSF_NAMESPACE + "' xmlns:xsl='" + GSXML.XSL_NAMESPACE + "'><gsf:template match='documentNode'><td><a><xsl:attribute name='href'>?a=d&amp;c=<xsl:value-of select='@collection'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test=\"@nodeType='leaf'\">&amp;sib=1</xsl:if>&amp;dt=<xsl:value-of select='@docType'/>&amp;p.a=q&amp;p.s=" + TEXT_QUERY_SERVICE + "&amp;p.c="; 
    8989            if (this.cluster_name != null) 
    9090            { 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSFile.java

    r26027 r26055  
    1919package org.greenstone.gsdl3.util; 
    2020 
    21 import java.io.File; 
    22 //import org.apache.soap.encoding.soapenc.Base64; 
    23 import org.apache.axis.encoding.Base64; 
    2421import java.io.BufferedInputStream; 
    2522import java.io.BufferedOutputStream; 
     23import java.io.File; 
    2624import java.io.FileInputStream; 
    2725import java.io.FileOutputStream; 
    28 import java.io.InputStream; 
    2926import java.io.IOException; 
    30 import java.lang.ClassLoader; // to find files on the class path 
    31 import java.net.URL; 
    3227import java.nio.channels.FileChannel; 
    3328import java.util.ArrayList; 
    34 import java.util.Collection; 
    35  
    36 import org.apache.log4j.*; 
     29 
     30import org.apache.axis.encoding.Base64; 
     31import org.apache.log4j.Logger; 
    3732import org.greenstone.util.GlobalProperties; 
    3833 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r26047 r26055  
    291291    public static final String VLIST = "VList"; 
    292292 
     293    //for namespaces 
     294    public static final String XSL_NAMESPACE = "http://www.w3.org/1999/XSL/Transform"; 
     295    public static final String GSF_NAMESPACE = "http://www.greenstone.org/greenstone3/schema/ConfigFormat"; 
     296    public static final String JAVA_NAMESPACE = "http://xml.apache.org/xslt/java"; 
     297    public static final String UTIL_NAMESPACE = "xalan://org.greenstone.gsdl3.util.XSLTUtil"; 
     298 
    293299    /** 
    294300     * takes a list of elements, and returns an array of strings of the values 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXSLT.java

    r25988 r26055  
    6161        Element main = main_xsl.getDocumentElement(); 
    6262        Node insertion_point = null; 
    63         Element last_import = GSXML.getLastElementByTagNameNS(main, "http://www.w3.org/1999/XSL/Transform", "import"); 
     63        Element last_import = GSXML.getLastElementByTagNameNS(main, GSXML.XSL_NAMESPACE, "import"); 
    6464        if (last_import != null) 
    6565        { 
     
    7272 
    7373        // imports 
    74         NodeList children = extra_xsl.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "import"); 
     74        NodeList children = extra_xsl.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "import"); 
    7575        for (int i = 0; i < children.getLength(); i++) 
    7676        { 
     
    7878            // If the new xsl:import element is identical (in terms of href attr value)  
    7979            // to any in the merged document, don't copy it over 
    80             if (GSXML.getNamedElementNS(main, "http://www.w3.org/1999/XSL/Transform", "import", "href", node.getAttribute("href")) == null) 
     80            if (GSXML.getNamedElementNS(main, GSXML.XSL_NAMESPACE, "import", "href", node.getAttribute("href")) == null) 
    8181            { 
    8282                // Import statements should be the first children of an xsl:stylesheet element 
     
    9090 
    9191        // do we have a new insertion point?? 
    92         Element last_include = GSXML.getLastElementByTagNameNS(main, "http://www.w3.org/1999/XSL/Transform", "include"); 
     92        Element last_include = GSXML.getLastElementByTagNameNS(main, GSXML.XSL_NAMESPACE, "include"); 
    9393        if (last_include != null) 
    9494        { 
     
    9797 
    9898        // includes 
    99         children = extra_xsl.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "include"); 
     99        children = extra_xsl.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "include"); 
    100100        for (int i = 0; i < children.getLength(); i++) 
    101101        { 
     
    105105            // Although Node.appendChild() will first remove identical nodes before appending, we check 
    106106            // only the href attribute to see if they're "identical" to any pre-existing <xsl:include> 
    107             if (GSXML.getNamedElementNS(main, "http://www.w3.org/1999/XSL/Transform", "include", "href", node.getAttribute("href")) == null) 
     107            if (GSXML.getNamedElementNS(main, GSXML.XSL_NAMESPACE, "include", "href", node.getAttribute("href")) == null) 
    108108            { 
    109109                //main.appendChild(main_xsl.importNode(node, true)); 
     
    112112        } // for each include 
    113113 
    114         if (main.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "output").getLength() == 0) 
     114        if (main.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "output").getLength() == 0) 
    115115        { 
    116116            // outputs 
    117             children = extra_xsl.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "output"); 
     117            children = extra_xsl.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "output"); 
    118118            for (int i = 0; i < children.getLength(); i++) 
    119119            { 
     
    128128        // variables - only top level ones!! 
    129129        // append to end of document 
    130         children = GSXML.getChildrenByTagNameNS(extra_xsl, "http://www.w3.org/1999/XSL/Transform", "variable"); 
     130        children = GSXML.getChildrenByTagNameNS(extra_xsl, GSXML.XSL_NAMESPACE, "variable"); 
    131131        for (int i = 0; i < children.getLength(); i++) 
    132132        { 
     
    134134            // If the new xsl:import element is identical (in terms of href attr value)  
    135135            // to any in the merged document, don't copy it over 
    136             if (GSXML.getNamedElementNS(main, "http://www.w3.org/1999/XSL/Transform", "variable", "name", node.getAttribute("name")) == null) 
     136            if (GSXML.getNamedElementNS(main, GSXML.XSL_NAMESPACE, "variable", "name", node.getAttribute("name")) == null) 
    137137            { 
    138138                main.appendChild(main_xsl.importNode(node, true)); 
     
    142142        // params - only top level ones!! 
    143143        // append to end of document 
    144         children = GSXML.getChildrenByTagNameNS(extra_xsl, "http://www.w3.org/1999/XSL/Transform", "param"); 
     144        children = GSXML.getChildrenByTagNameNS(extra_xsl, GSXML.XSL_NAMESPACE, "param"); 
    145145        for (int i = 0; i < children.getLength(); i++) 
    146146        { 
     
    148148            // If the new xsl:import element is identical (in terms of href attr value)  
    149149            // to any in the merged document, don't copy it over 
    150             if (GSXML.getNamedElementNS(main, "http://www.w3.org/1999/XSL/Transform", "param", "name", node.getAttribute("name")) == null) 
     150            if (GSXML.getNamedElementNS(main, GSXML.XSL_NAMESPACE, "param", "name", node.getAttribute("name")) == null) 
    151151            { 
    152152                main.appendChild(main_xsl.importNode(node, true)); 
     
    156156        // templates 
    157157        // append to end of document 
    158         children = extra_xsl.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "template"); 
     158        children = extra_xsl.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "template"); 
    159159        for (int i = 0; i < children.getLength(); i++) 
    160160        { 
     
    168168            { 
    169169                // if we have a name attribute, remove any other similarly named template 
    170                 GSXML.removeElementsWithAttributesNS(main, "http://www.w3.org/1999/XSL/Transform", "template", new String[] { "name", "match", "mode" }, new String[] { template_name, template_match, template_mode }); 
     170                GSXML.removeElementsWithAttributesNS(main, GSXML.XSL_NAMESPACE, "template", new String[] { "name", "match", "mode" }, new String[] { template_name, template_match, template_mode }); 
    171171 
    172172                // now add our good template in 
     
    179179                // there can't be any duplicate named templates, so just look for matches 
    180180                // we already have the one with highest import precedence (from the top most level) so don't add any more in 
    181                 if (GSXML.getElementsWithAttributesNS(main, "http://www.w3.org/1999/XSL/Transform", "template", new String[] { "name", "match", "mode" }, new String[] { template_name, template_match, template_mode }).getLength() == 0) 
     181                if (GSXML.getElementsWithAttributesNS(main, GSXML.XSL_NAMESPACE, "template", new String[] { "name", "match", "mode" }, new String[] { template_name, template_match, template_mode }).getLength() == 0) 
    182182                { 
    183183                    main.appendChild(main_xsl.importNode(node, true)); 
     
    204204                Element xslParent = (Element) current.getParentNode(); 
    205205 
    206                 while (xslParent.getNamespaceURI() != "http://www.w3.org/1999/XSL/Transform" && !xslParent.getNodeName().startsWith("xsl:")) 
     206                while (xslParent.getNamespaceURI() != GSXML.XSL_NAMESPACE && !xslParent.getNodeName().startsWith("xsl:")) 
    207207                { 
    208208                    xslParent = (Element) xslParent.getParentNode(); 
     
    220220    } 
    221221 
    222   public static void inlineImportAndIncludeFiles(Document doc, String pathExtra, String site, String collection, String interface_name, ArrayList<String> base_interfaces) 
    223     { 
    224       inlineImportAndIncludeFilesDebug(doc, pathExtra, false, null, site, collection, interface_name, base_interfaces); 
    225     } 
    226  
    227   public static void inlineImportAndIncludeFilesDebug(Document doc, String pathExtra, boolean debug, String docFileName, String site, String collection, String interface_name, ArrayList<String> base_interfaces) 
     222    public static void inlineImportAndIncludeFiles(Document doc, String pathExtra, String site, String collection, String interface_name, ArrayList<String> base_interfaces) 
     223    { 
     224        inlineImportAndIncludeFilesDebug(doc, pathExtra, false, null, site, collection, interface_name, base_interfaces); 
     225    } 
     226 
     227    public static void inlineImportAndIncludeFilesDebug(Document doc, String pathExtra, boolean debug, String docFileName, String site, String collection, String interface_name, ArrayList<String> base_interfaces) 
    228228    { 
    229229        XMLConverter converter = new XMLConverter(); 
     
    231231        String path = (pathExtra == null) ? "" : pathExtra; 
    232232 
    233         NodeList importList = doc.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "import"); 
    234         NodeList includeList = doc.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "include"); 
     233        NodeList importList = doc.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "import"); 
     234        NodeList includeList = doc.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "include"); 
    235235 
    236236        for (int i = 0; i < importList.getLength() + includeList.getLength(); i++) 
     
    243243            try 
    244244            { 
    245               //Document inlineDoc = converter.getDOM(new File(filePath), "UTF-8"); 
    246               Document inlineDoc = mergedXSLTDocumentCascade(path+href, site, collection, interface_name, base_interfaces, debug); 
     245                //Document inlineDoc = converter.getDOM(new File(filePath), "UTF-8"); 
     246                Document inlineDoc = mergedXSLTDocumentCascade(path + href, site, collection, interface_name, base_interfaces, debug); 
    247247                String newPath = path; 
    248248                int lastSepIndex = href.lastIndexOf("/"); 
     
    253253 
    254254                //Do this recursively 
    255                 inlineImportAndIncludeFilesDebug(inlineDoc, newPath, debug, "merged "+href/*filePath*/, site, collection, interface_name, base_interfaces); 
    256  
    257                 GSXSLT.mergeStylesheetsDebug(doc, inlineDoc.getDocumentElement(), false, debug, docFileName, /*filePath*/"merged "+href); 
     255                inlineImportAndIncludeFilesDebug(inlineDoc, newPath, debug, "merged " + href/* filePath */, site, collection, interface_name, base_interfaces); 
     256 
     257                GSXSLT.mergeStylesheetsDebug(doc, inlineDoc.getDocumentElement(), false, debug, docFileName, /* filePath */"merged " + href); 
    258258            } 
    259259            catch (Exception ex) 
     
    276276    } 
    277277 
    278         public static Document mergedXSLTDocumentCascade(String xslt_filename, String site, String collection, String this_interface, ArrayList<String> base_interfaces, boolean debug) { 
    279           XMLConverter converter = new XMLConverter(); 
    280           // find the list of stylesheets with this name 
    281           ArrayList<File> stylesheets = GSFile.getStylesheetFiles(GlobalProperties.getGSDL3Home(), site, collection, this_interface, base_interfaces, xslt_filename); 
     278    public static Document mergedXSLTDocumentCascade(String xslt_filename, String site, String collection, String this_interface, ArrayList<String> base_interfaces, boolean debug) 
     279    { 
     280        XMLConverter converter = new XMLConverter(); 
     281        // find the list of stylesheets with this name 
     282        ArrayList<File> stylesheets = GSFile.getStylesheetFiles(GlobalProperties.getGSDL3Home(), site, collection, this_interface, base_interfaces, xslt_filename); 
    282283        if (stylesheets.size() == 0) 
    283284        { 
     
    314315    } 
    315316 
    316  
    317  
    318317    public static void modifyConfigFormatForDebug(Document doc, String fileName) 
    319318    { 
    320         NodeList templateNodes = doc.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "template"); 
     319        NodeList templateNodes = doc.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "template"); 
    321320        if (templateNodes.getLength() == 0) 
    322321        { 
     
    331330 
    332331        XMLConverter converter = new XMLConverter(); 
    333         Element debugElement = (Element) converter.getDOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xslt:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xslt=\"output.xsl\" xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">" + debugElementString + "</xslt:stylesheet>").getDocumentElement().getFirstChild(); 
     332        Element debugElement = (Element) converter.getDOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xslt:stylesheet version=\"1.0\" xmlns:xsl=\"" + GSXML.XSL_NAMESPACE + "\" xmlns:xslt=\"output.xsl\" xmlns:gsf=\"" + GSXML.GSF_NAMESPACE + "\">" + debugElementString + "</xslt:stylesheet>").getDocumentElement().getFirstChild(); 
    334333 
    335334        for (int i = 0; i < templateNodes.getLength(); i++) 
     
    419418    public static void mergeFormatElements(Element mainFormat, Element secondaryFormat, boolean overwrite) 
    420419    { 
    421         NodeList xslChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.w3.org/1999/XSL/Transform", "variable"); 
    422         NodeList gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "variable"); 
     420        NodeList xslChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.XSL_NAMESPACE, "variable"); 
     421        NodeList gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.GSF_NAMESPACE, "variable"); 
    423422        for (int i = 0; i < xslChildren.getLength() + gsfChildren.getLength(); i++) 
    424423        { 
     
    430429        } 
    431430 
    432         xslChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.w3.org/1999/XSL/Transform", "param"); 
    433         gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "param"); 
     431        xslChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.XSL_NAMESPACE, "param"); 
     432        gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.GSF_NAMESPACE, "param"); 
    434433        for (int i = 0; i < xslChildren.getLength() + gsfChildren.getLength(); i++) 
    435434        { 
     
    441440        } 
    442441 
    443         xslChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.w3.org/1999/XSL/Transform", "template"); 
    444         gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "template"); 
     442        xslChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.XSL_NAMESPACE, "template"); 
     443        gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.GSF_NAMESPACE, "template"); 
    445444        for (int i = 0; i < xslChildren.getLength() + gsfChildren.getLength(); i++) 
    446445        { 
     
    457456            { 
    458457                // if we have a name attribute, remove any other similarly named template 
    459                 GSXML.removeElementsWithAttributesNS(mainFormat, "http://www.w3.org/1999/XSL/Transform", "template", attributeNames, attributeValues); 
    460                 GSXML.removeElementsWithAttributesNS(mainFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "template", attributeNames, attributeValues); 
     458                GSXML.removeElementsWithAttributesNS(mainFormat, GSXML.XSL_NAMESPACE, "template", attributeNames, attributeValues); 
     459                GSXML.removeElementsWithAttributesNS(mainFormat, GSXML.GSF_NAMESPACE, "template", attributeNames, attributeValues); 
    461460 
    462461                // now add our good template in 
     
    476475        } 
    477476 
    478         gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "option"); 
     477        gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.GSF_NAMESPACE, "option"); 
    479478        for (int i = 0; i < gsfChildren.getLength(); i++) 
    480479        { 
    481480            Element node = (Element) gsfChildren.item(i); 
    482             if (GSXML.getNamedElementNS(mainFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "option", "name", node.getAttribute("name")) == null) 
     481            if (GSXML.getNamedElementNS(mainFormat, GSXML.GSF_NAMESPACE, "option", "name", node.getAttribute("name")) == null) 
    483482            { 
    484483                mainFormat.appendChild(node);