Revision 479 tmp/org.txm.groovy.core/src/groovy/org/txm/importer/RenameTag.groovy

RenameTag.groovy (revision 479)
27 27
//
28 28
package org.txm.importer
29 29

  
30
import javax.xml.parsers.*
31
import javax.xml.transform.*
32
import javax.xml.xpath.*
30
import java.io.File;
33 31

  
34
import org.txm.importer.PersonalNamespaceContext
35
import org.txm.utils.xml.DomUtils
36
import org.w3c.dom.Document
32
import org.w3c.dom.Document;
33
import java.io.File;
37 34

  
35
import org.w3c.dom.Document;
36
import org.w3c.dom.Element;
37

  
38
import javax.xml.parsers.*;
39
import javax.xml.xpath.*;
40
import javax.xml.transform.*;
41
import javax.xml.transform.dom.DOMSource;
42
import javax.xml.transform.stream.StreamResult;
43
import org.txm.importer.graal.PersonalNamespaceContext;
44

  
38 45
// TODO: Auto-generated Javadoc
39 46
/**
40 47
 * The Class RenameTag : using Stax or DOM depending on the file size
......
73 80
		if (xmlfile.length() <= DOMMAXSIZE) {
74 81
			String xpath = "//"+oldname;
75 82
			DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
83
			domFactory.setXIncludeAware(true);
76 84
			domFactory.setNamespaceAware(true); // never forget this!
77 85
			DocumentBuilder builder = domFactory.newDocumentBuilder();
78 86
			Document doc = builder.parse(xmlfile);
......
86 94
			for(def node : nodes) {
87 95
				doc.renameNode(node, null, newname)
88 96
			}
89
			return DomUtils.save(doc, xmlfile)
97
			return org.txm.utils.xml.DomUtils.save(doc, xmlfile)
90 98
		}
91 99
		else {
92 100
			RenameTag builder = new RenameTag(xmlfile, oldname, newname);

Also available in: Unified diff