Changeset 26055
- Timestamp:
- 2012-08-01T13:57:10+12:00 (12 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java
r26038 r26055 1 1 package org.greenstone.gsdl3.action; 2 2 3 import org.greenstone.gsdl3.core.ModuleInterface;4 import org.greenstone.gsdl3.util.*;5 // XML classes6 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 stuff12 import java.io.File;13 import java.util.Vector;14 3 import java.util.HashMap; 15 4 import java.util.HashSet; 16 5 import java.util.Iterator; 17 6 18 import org.apache.log4j.*; 7 import org.apache.log4j.Logger; 8 import org.greenstone.gsdl3.core.ModuleInterface; 9 import org.greenstone.gsdl3.util.GSConstants; 10 import org.greenstone.gsdl3.util.GSParams; 11 import org.greenstone.gsdl3.util.GSXML; 12 import org.greenstone.gsdl3.util.UserContext; 13 import org.greenstone.gsdl3.util.XMLConverter; 14 import org.w3c.dom.Document; 15 import org.w3c.dom.Element; 16 import org.w3c.dom.Node; 17 import org.w3c.dom.NodeList; 19 18 20 19 /** base class for Actions */ … … 100 99 protected void extractMetadataNames(Element format, HashSet<String> meta_names) 101 100 { 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"); 104 102 for (int i = 0; i < metadata_nodes.getLength(); i++) 105 103 { … … 111 109 String sep = elem.getAttribute("separator"); 112 110 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); 116 115 } 117 116 else if (!pos.equals("")) … … 147 146 boolean getEquivLinkMeta = false; 148 147 149 NodeList link_nodes = format.getElementsByTagName ("gsf:link");148 NodeList link_nodes = format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "link"); 150 149 for (int i = 0; i < link_nodes.getLength(); i++) 151 150 { … … 157 156 meta_names.add("srclinkFile"); 158 157 } 159 else if (type.equals("web")) { 160 meta_names.add("weblink"); 158 else if (type.equals("web")) 159 { 160 meta_names.add("weblink"); 161 161 meta_names.add("webicon"); 162 162 meta_names.add("/weblink"); 163 163 } 164 else if (type.equals("equivdoc")) { 164 else if (type.equals("equivdoc")) 165 { 165 166 getEquivLinkMeta = true; 166 167 } … … 169 170 // get all the metadata necessary for when the user has used "gsf:equivlink" 170 171 // 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"); 172 173 if (getEquivLinkMeta || link_nodes.getLength() > 0) 173 174 { … … 191 192 } 192 193 193 if (format.getElementsByTagName ("gsf:image").getLength() > 0)194 if (format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "image").getLength() > 0) 194 195 { 195 196 meta_names.add("Thumb"); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java
r26048 r26055 454 454 protected void extractMetadataNames(Element new_format, HashSet<String> doc_meta_names, HashSet<String> class_meta_names) 455 455 { 456 NodeList templates = new_format.getElementsByTagNameNS( "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "template");456 NodeList templates = new_format.getElementsByTagNameNS(GSXML.GSF_NAMESPACE, "template"); 457 457 for (int i = 0; i < templates.getLength(); i++) 458 458 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/Receptionist.java
r25871 r26055 1 1 package org.greenstone.gsdl3.core; 2 2 3 import java.io.File; 4 import java.util.ArrayList; 5 import java.util.HashMap; 6 7 import org.apache.log4j.Logger; 8 import org.greenstone.gsdl3.action.Action; 9 import org.greenstone.gsdl3.util.GSConstants; 10 import org.greenstone.gsdl3.util.GSFile; 11 import org.greenstone.gsdl3.util.GSParams; 12 import org.greenstone.gsdl3.util.GSXML; 13 import org.greenstone.gsdl3.util.XMLConverter; 3 14 import org.greenstone.util.GlobalProperties; 4 import org.greenstone.gsdl3.util.*; 5 import org.greenstone.gsdl3.action.*; 6 // XML classes 15 import org.w3c.dom.Document; 16 import org.w3c.dom.Element; 7 17 import org.w3c.dom.Node; 8 18 import org.w3c.dom.NodeList; 9 import org.w3c.dom.Document;10 import org.w3c.dom.Element;11 12 // other java classes13 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.*;19 19 20 20 /** … … 245 245 page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT)); 246 246 // 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); 249 249 250 250 //logger.info(a+" mesa=" + this.converter.getPrettyString(message)); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r26051 r26055 198 198 { 199 199 Document currentDoc = this.converter.getDOM(currentFile); 200 NodeList metadataElems = currentDoc.getElementsByTagNameNS( "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "metadata"); //gsf:metadata201 NodeList imageElems = currentDoc.getElementsByTagNameNS( "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "image"); //gsf:image202 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"); 204 204 205 205 ArrayList<String> names = new ArrayList<String>(); … … 891 891 try 892 892 { 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"); 894 894 895 895 if (_debug) -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CrossCollectionSearch.java
r25635 r26055 86 86 { 87 87 // 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&c=<xsl:value-of select='@collection'/>&d=<xsl:value-of select='@nodeID'/><xsl:if test=\"@nodeType='leaf'\">&sib=1</xsl:if>&dt=<xsl:value-of select='@docType'/>&p.a=q&p.s=" + TEXT_QUERY_SERVICE + "&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&c=<xsl:value-of select='@collection'/>&d=<xsl:value-of select='@nodeID'/><xsl:if test=\"@nodeType='leaf'\">&sib=1</xsl:if>&dt=<xsl:value-of select='@docType'/>&p.a=q&p.s=" + TEXT_QUERY_SERVICE + "&p.c="; 89 89 if (this.cluster_name != null) 90 90 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSFile.java
r26027 r26055 19 19 package org.greenstone.gsdl3.util; 20 20 21 import java.io.File;22 //import org.apache.soap.encoding.soapenc.Base64;23 import org.apache.axis.encoding.Base64;24 21 import java.io.BufferedInputStream; 25 22 import java.io.BufferedOutputStream; 23 import java.io.File; 26 24 import java.io.FileInputStream; 27 25 import java.io.FileOutputStream; 28 import java.io.InputStream;29 26 import java.io.IOException; 30 import java.lang.ClassLoader; // to find files on the class path31 import java.net.URL;32 27 import java.nio.channels.FileChannel; 33 28 import java.util.ArrayList; 34 import java.util.Collection; 35 36 import org.apache.log4j. *;29 30 import org.apache.axis.encoding.Base64; 31 import org.apache.log4j.Logger; 37 32 import org.greenstone.util.GlobalProperties; 38 33 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r26047 r26055 291 291 public static final String VLIST = "VList"; 292 292 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 293 299 /** 294 300 * 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 61 61 Element main = main_xsl.getDocumentElement(); 62 62 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"); 64 64 if (last_import != null) 65 65 { … … 72 72 73 73 // 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"); 75 75 for (int i = 0; i < children.getLength(); i++) 76 76 { … … 78 78 // If the new xsl:import element is identical (in terms of href attr value) 79 79 // 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) 81 81 { 82 82 // Import statements should be the first children of an xsl:stylesheet element … … 90 90 91 91 // 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"); 93 93 if (last_include != null) 94 94 { … … 97 97 98 98 // includes 99 children = extra_xsl.getElementsByTagNameNS( "http://www.w3.org/1999/XSL/Transform", "include");99 children = extra_xsl.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "include"); 100 100 for (int i = 0; i < children.getLength(); i++) 101 101 { … … 105 105 // Although Node.appendChild() will first remove identical nodes before appending, we check 106 106 // 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) 108 108 { 109 109 //main.appendChild(main_xsl.importNode(node, true)); … … 112 112 } // for each include 113 113 114 if (main.getElementsByTagNameNS( "http://www.w3.org/1999/XSL/Transform", "output").getLength() == 0)114 if (main.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "output").getLength() == 0) 115 115 { 116 116 // outputs 117 children = extra_xsl.getElementsByTagNameNS( "http://www.w3.org/1999/XSL/Transform", "output");117 children = extra_xsl.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "output"); 118 118 for (int i = 0; i < children.getLength(); i++) 119 119 { … … 128 128 // variables - only top level ones!! 129 129 // 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"); 131 131 for (int i = 0; i < children.getLength(); i++) 132 132 { … … 134 134 // If the new xsl:import element is identical (in terms of href attr value) 135 135 // 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) 137 137 { 138 138 main.appendChild(main_xsl.importNode(node, true)); … … 142 142 // params - only top level ones!! 143 143 // 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"); 145 145 for (int i = 0; i < children.getLength(); i++) 146 146 { … … 148 148 // If the new xsl:import element is identical (in terms of href attr value) 149 149 // 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) 151 151 { 152 152 main.appendChild(main_xsl.importNode(node, true)); … … 156 156 // templates 157 157 // 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"); 159 159 for (int i = 0; i < children.getLength(); i++) 160 160 { … … 168 168 { 169 169 // 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 }); 171 171 172 172 // now add our good template in … … 179 179 // there can't be any duplicate named templates, so just look for matches 180 180 // 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) 182 182 { 183 183 main.appendChild(main_xsl.importNode(node, true)); … … 204 204 Element xslParent = (Element) current.getParentNode(); 205 205 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:")) 207 207 { 208 208 xslParent = (Element) xslParent.getParentNode(); … … 220 220 } 221 221 222 223 { 224 225 } 226 227 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) 228 228 { 229 229 XMLConverter converter = new XMLConverter(); … … 231 231 String path = (pathExtra == null) ? "" : pathExtra; 232 232 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"); 235 235 236 236 for (int i = 0; i < importList.getLength() + includeList.getLength(); i++) … … 243 243 try 244 244 { 245 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); 247 247 String newPath = path; 248 248 int lastSepIndex = href.lastIndexOf("/"); … … 253 253 254 254 //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); 258 258 } 259 259 catch (Exception ex) … … 276 276 } 277 277 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); 282 283 if (stylesheets.size() == 0) 283 284 { … … 314 315 } 315 316 316 317 318 317 public static void modifyConfigFormatForDebug(Document doc, String fileName) 319 318 { 320 NodeList templateNodes = doc.getElementsByTagNameNS( "http://www.w3.org/1999/XSL/Transform", "template");319 NodeList templateNodes = doc.getElementsByTagNameNS(GSXML.XSL_NAMESPACE, "template"); 321 320 if (templateNodes.getLength() == 0) 322 321 { … … 331 330 332 331 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(); 334 333 335 334 for (int i = 0; i < templateNodes.getLength(); i++) … … 419 418 public static void mergeFormatElements(Element mainFormat, Element secondaryFormat, boolean overwrite) 420 419 { 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"); 423 422 for (int i = 0; i < xslChildren.getLength() + gsfChildren.getLength(); i++) 424 423 { … … 430 429 } 431 430 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"); 434 433 for (int i = 0; i < xslChildren.getLength() + gsfChildren.getLength(); i++) 435 434 { … … 441 440 } 442 441 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"); 445 444 for (int i = 0; i < xslChildren.getLength() + gsfChildren.getLength(); i++) 446 445 { … … 457 456 { 458 457 // 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); 461 460 462 461 // now add our good template in … … 476 475 } 477 476 478 gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, "http://www.greenstone.org/greenstone3/schema/ConfigFormat", "option");477 gsfChildren = GSXML.getChildrenByTagNameNS(secondaryFormat, GSXML.GSF_NAMESPACE, "option"); 479 478 for (int i = 0; i < gsfChildren.getLength(); i++) 480 479 { 481 480 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) 483 482 { 484 483 mainFormat.appendChild(node);
Note:
See TracChangeset
for help on using the changeset viewer.