Factored out freemarker-dom from freemarker-core. Also added mechanism to
"inject" DOM wrapping capability into DefaultObjectWrapper on configuration
time. See details below.
- `DefaultObjectWrapper` now has a configuration setting, `extensions`, to add
`DefaultObjectWrapperExtension`-s, which
meant to be used for wrapping application-specific objects specially. Along
with this, `DefaultObjectWrapper` now has
two protected methods to customze the wrapping logic,
`wrapSpecialObject(Object)` and `wrapGenericObject(Object)`; the
last replaces the `handleUnknownType(Object)` method from FM2.
`DefaultObjectWrapperExtension`-s are applied before or
after `wrapSpecialObject`, depending on what
`DefaultObjectWrapperExtension.getPhase()` returns. See the JavaDoc of
`DefaultObjectWrapper.wrap(Object)` for more on wrapping phases.
- `DefaultObjectWrapper` doesn't wrap W3C DOM nodes (XML) specially anymore, as
DOM wrapping was factored out to a
separate jar (freemarker-dom) as part of modularizing FreeMarker. To ensure
that DOM nodes are wrapped specially as
in FM2, the `extensions` setting of the `DefaultObjectWrapper` has to be so
that it contains
`DOMDefaultObjectWrapperExtension.INSTANCE`. For example:
cfgBuilder.objectWrapper(
new DefaultObjectWrapper.Builder(Configuration.VERSION_3_0_0)
.extensions(DOMDefaultObjectWrapperExtension.INSTANCE)
.build())
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/be556897
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/be556897
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/be556897
Branch: refs/heads/3
Commit: be556897911e91e32aaa8f989a20591fe0f71d8c
Parents: 053b82e
Author: ddekany <[email protected]>
Authored: Sun May 21 23:30:44 2017 +0200
Committer: ddekany <[email protected]>
Committed: Sun May 21 23:34:40 2017 +0200
----------------------------------------------------------------------
FM3-CHANGE-LOG.txt | 21 +-
freemarker-core-test/build.gradle | 26 +-
.../freemarker/core/TypeErrorMessagesTest.java | 51 +-
.../model/impl/DefaultObjectWrapperTest.java | 23 +-
.../templatesuite/CoreTemplateTestSuite.java | 37 --
.../apache/freemarker/dom/DOMSiblingTest.java | 99 ---
.../freemarker/dom/DOMSimplifiersTest.java | 201 ------
.../java/org/apache/freemarker/dom/DOMTest.java | 159 -----
.../templatesuite/expected/default-xmlns.txt | 25 -
.../templatesuite/expected/xml-fragment.txt | 25 -
.../expected/xml-ns_prefix-scope.txt | 29 -
.../core/templatesuite/expected/xml.txt | 65 --
.../core/templatesuite/expected/xmlns1.txt | 63 --
.../core/templatesuite/expected/xmlns3.txt | 47 --
.../core/templatesuite/expected/xmlns4.txt | 47 --
.../core/templatesuite/expected/xmlns5.txt | 26 -
.../core/templatesuite/models/defaultxmlns1.xml | 24 -
.../models/xml-ns_prefix-scope.xml | 26 -
.../core/templatesuite/models/xml.xml | 31 -
.../core/templatesuite/models/xmlfragment.xml | 19 -
.../core/templatesuite/models/xmlns.xml | 32 -
.../core/templatesuite/models/xmlns2.xml | 32 -
.../core/templatesuite/models/xmlns3.xml | 32 -
.../templatesuite/templates/default-xmlns.ftl | 28 -
.../templatesuite/templates/xml-fragment.ftl | 26 -
.../templates/xml-ns_prefix-scope-lib.ftl | 23 -
.../templates/xml-ns_prefix-scope-main.ftl | 36 --
.../core/templatesuite/templates/xml.ftl | 47 --
.../core/templatesuite/templates/xmlns1.ftl | 53 --
.../core/templatesuite/templates/xmlns3.ftl | 70 ---
.../core/templatesuite/templates/xmlns4.ftl | 70 ---
.../core/templatesuite/templates/xmlns5.ftl | 28 -
.../freemarker/core/templatesuite/testcases.xml | 8 -
.../apache/freemarker/dom/DOMSiblingTest.xml | 31 -
freemarker-core/build.gradle | 14 +-
.../core/model/TemplateNodeModelEx.java | 4 +-
.../core/model/impl/DefaultObjectWrapper.java | 187 +++++-
.../impl/DefaultObjectWrapperExtension.java | 48 ++
.../DefaultObjectWrapperExtensionPhase.java | 39 ++
.../model/impl/RestrictedObjectWrapper.java | 2 +-
.../java/org/apache/freemarker/dom/AtAtKey.java | 58 --
.../freemarker/dom/AttributeNodeModel.java | 69 ---
.../freemarker/dom/CharacterDataNodeModel.java | 46 --
.../apache/freemarker/dom/DocumentModel.java | 76 ---
.../freemarker/dom/DocumentTypeModel.java | 56 --
.../java/org/apache/freemarker/dom/DomLog.java | 32 -
.../apache/freemarker/dom/DomStringUtil.java | 67 --
.../org/apache/freemarker/dom/ElementModel.java | 234 -------
.../freemarker/dom/JaxenXPathSupport.java | 243 --------
.../apache/freemarker/dom/NodeListModel.java | 219 -------
.../org/apache/freemarker/dom/NodeModel.java | 613 -------------------
.../apache/freemarker/dom/NodeOutputter.java | 258 --------
.../dom/NodeQueryResultItemObjectWrapper.java | 92 ---
.../org/apache/freemarker/dom/PINodeModel.java | 45 --
.../dom/SunInternalXalanXPathSupport.java | 163 -----
.../org/apache/freemarker/dom/XPathSupport.java | 30 -
.../freemarker/dom/XalanXPathSupport.java | 163 -----
.../java/org/apache/freemarker/dom/package.html | 30 -
freemarker-dom/build.gradle | 83 +++
.../java/org/apache/freemarker/dom/AtAtKey.java | 58 ++
.../freemarker/dom/AttributeNodeModel.java | 69 +++
.../freemarker/dom/CharacterDataNodeModel.java | 46 ++
.../dom/DOMDefaultObjectWrapperExtension.java | 48 ++
.../apache/freemarker/dom/DocumentModel.java | 76 +++
.../freemarker/dom/DocumentTypeModel.java | 56 ++
.../java/org/apache/freemarker/dom/DomLog.java | 32 +
.../apache/freemarker/dom/DomStringUtil.java | 67 ++
.../org/apache/freemarker/dom/ElementModel.java | 234 +++++++
.../freemarker/dom/JaxenXPathSupport.java | 243 ++++++++
.../apache/freemarker/dom/NodeListModel.java | 219 +++++++
.../org/apache/freemarker/dom/NodeModel.java | 613 +++++++++++++++++++
.../apache/freemarker/dom/NodeOutputter.java | 258 ++++++++
.../dom/NodeQueryResultItemObjectWrapper.java | 92 +++
.../org/apache/freemarker/dom/PINodeModel.java | 45 ++
.../dom/SunInternalXalanXPathSupport.java | 163 +++++
.../org/apache/freemarker/dom/XPathSupport.java | 30 +
.../freemarker/dom/XalanXPathSupport.java | 163 +++++
.../java/org/apache/freemarker/dom/package.html | 30 +
.../apache/freemarker/dom/DOMSiblingTest.java | 97 +++
.../freemarker/dom/DOMSimplifiersTest.java | 201 ++++++
.../java/org/apache/freemarker/dom/DOMTest.java | 159 +++++
.../dom/DefaultObjectWrapperExtensionTest.java | 69 +++
.../freemarker/dom/TypeErrorMessagesTest.java | 57 ++
.../dom/templatesuite/DomTemplateTestSuite.java | 62 ++
.../apache/freemarker/dom/test/DOMLoader.java | 145 +++++
.../apache/freemarker/dom/DOMSiblingTest.xml | 31 +
.../templatesuite/expected/default-xmlns.txt | 25 +
.../dom/templatesuite/expected/xml-fragment.txt | 25 +
.../expected/xml-ns_prefix-scope.txt | 29 +
.../dom/templatesuite/expected/xml.txt | 65 ++
.../dom/templatesuite/expected/xmlns1.txt | 63 ++
.../dom/templatesuite/expected/xmlns3.txt | 47 ++
.../dom/templatesuite/expected/xmlns4.txt | 47 ++
.../dom/templatesuite/expected/xmlns5.txt | 26 +
.../dom/templatesuite/models/defaultxmlns1.xml | 24 +
.../models/xml-ns_prefix-scope.xml | 26 +
.../freemarker/dom/templatesuite/models/xml.xml | 31 +
.../dom/templatesuite/models/xmlfragment.xml | 19 +
.../dom/templatesuite/models/xmlns.xml | 32 +
.../dom/templatesuite/models/xmlns2.xml | 32 +
.../dom/templatesuite/models/xmlns3.xml | 32 +
.../templatesuite/templates/default-xmlns.ftl | 28 +
.../templatesuite/templates/xml-fragment.ftl | 26 +
.../templates/xml-ns_prefix-scope-lib.ftl | 23 +
.../templates/xml-ns_prefix-scope-main.ftl | 36 ++
.../dom/templatesuite/templates/xml.ftl | 47 ++
.../dom/templatesuite/templates/xmlns1.ftl | 53 ++
.../dom/templatesuite/templates/xmlns3.ftl | 70 +++
.../dom/templatesuite/templates/xmlns4.ftl | 70 +++
.../dom/templatesuite/templates/xmlns5.ftl | 28 +
.../freemarker/dom/templatesuite/testcases.xml | 65 ++
freemarker-servlet/build.gradle | 19 +
freemarker-test-utils/build.gradle | 19 +
.../freemarker/test/TemplateTestSuite.java | 3 -
.../org/apache/freemarker/test/XMLLoader.java | 138 -----
settings.gradle | 1 +
116 files changed, 4738 insertions(+), 4205 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt
index 64a2a38..9600281 100644
--- a/FM3-CHANGE-LOG.txt
+++ b/FM3-CHANGE-LOG.txt
@@ -17,7 +17,7 @@
* under the License.
*/
-Because the Manual won't be updated for a good while, I will lead
+Because the Manual won't be updated for a good while, we will lead
the FreeMarer 3 changelog here:
- Increased version number to 3.0.0 (nightly aka. SNAPSHOT)
@@ -227,6 +227,21 @@ the FreeMarer 3 changelog here:
- Modularized the project. Now we have these published jar-s:
- org.apache.freemarker:freemarker-core
- org.apache.freemarker:freemarker-servlet
- - [TODO] org.apache.freemarker:freemarker-dom
+ - org.apache.freemarker:freemarker-dom
There are several other internal modules related to testing; these aren't
published.
-- Migrated buiding from Ant to Gradle. [TODO: This is only partially done; jar
building, testing and javadoc works.]
\ No newline at end of file
+- Migrated buiding from Ant to Gradle. [TODO: This is only partially done; jar
building, testing and javadoc works.]
+- `DefaultObjectWrapper` now has a configuration setting, `extensions`, to add
`DefaultObjectWrapperExtension`-s, which
+ meant to be used for wrapping application-specific objects specially. Along
with this, `DefaultObjectWrapper` now has
+ two protected methods to customze the wrapping logic,
`wrapSpecialObject(Object)` and `wrapGenericObject(Object)`; the
+ last replaces the `handleUnknownType(Object)` method from FM2.
`DefaultObjectWrapperExtension`-s are applied before or
+ after `wrapSpecialObject`, depending on what
`DefaultObjectWrapperExtension.getPhase()` returns. See the JavaDoc of
+ `DefaultObjectWrapper.wrap(Object)` for more on wrapping phases.
+- `DefaultObjectWrapper` doesn't wrap W3C DOM nodes (XML) specially anymore,
as DOM wrapping was factored out to a
+ separate jar (freemarker-dom) as part of modularizing FreeMarker. To ensure
that DOM nodes are wrapped specially as
+ in FM2, the `extensions` setting of the `DefaultObjectWrapper` has to be so
that it contains
+ `DOMDefaultObjectWrapperExtension.INSTANCE`. For example:
+
+ cfgBuilder.objectWrapper(
+ new DefaultObjectWrapper.Builder(Configuration.VERSION_3_0_0)
+ .extensions(DOMDefaultObjectWrapperExtension.INSTANCE)
+ .build())
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/build.gradle
----------------------------------------------------------------------
diff --git a/freemarker-core-test/build.gradle
b/freemarker-core-test/build.gradle
index 1edfe8f..6ba033c 100644
--- a/freemarker-core-test/build.gradle
+++ b/freemarker-core-test/build.gradle
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
description = """\
The unit tests of freemarker-core. These tests used to be in freemarker-core,
but to avoid depenency loop \
through freemarker-test-utils, they had to be moved into a separate project."""
@@ -5,13 +24,6 @@ through freemarker-test-utils, they had to be moved into a
separate project."""
dependencies {
compile project(":freemarker-core")
compile project(":freemarker-test-utils")
-
- testRuntime "jaxen:jaxen:1.0-FCS"
- testRuntime "saxpath:saxpath:1.0-FCS"
- testRuntime("xalan:xalan:2.7.0") {
- // xml-apis is part of Java SE since version 1.4:
- exclude group: "xml-apis", module: "xml-apis"
- }
}
// We have nothing to put into the jar, as we have test classes only
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/java/org/apache/freemarker/core/TypeErrorMessagesTest.java
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TypeErrorMessagesTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TypeErrorMessagesTest.java
index 749d057..96c671d 100644
---
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TypeErrorMessagesTest.java
+++
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TypeErrorMessagesTest.java
@@ -19,31 +19,11 @@
package org.apache.freemarker.core;
-import java.io.StringReader;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
import org.apache.freemarker.test.TemplateTest;
import org.junit.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
public class TypeErrorMessagesTest extends TemplateTest {
- static final Document doc;
- static {
- try {
- DocumentBuilder docBuilder;
- docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- doc = docBuilder.parse(new InputSource(new StringReader(
- "<a><b>123</b><c a='true'>1</c><c a='false'>2</c></a>")));
- } catch (Exception e) {
- throw new RuntimeException("Failed to build data-model", e);
- }
- }
-
@Test
public void testNumericalBinaryOperator() {
assertErrorContains("${n - s}", "\"-\"", "right-hand", "number",
"string");
@@ -68,38 +48,9 @@ public class TypeErrorMessagesTest extends TemplateTest {
"string", "method", "obj.something(params)");
}
- @Test
- public void testXMLTypeMismarches() throws Exception {
- assertErrorContains("${doc.a.c}",
- "used as string", "query result", "2", "multiple matches");
- assertErrorContains("${doc.a.c?boolean}",
- "used as string", "query result", "2", "multiple matches");
- assertErrorContains("${doc.a.d}",
- "used as string", "query result", "0", "no matches");
- assertErrorContains("${doc.a.d?boolean}",
- "used as string", "query result", "0", "no matches");
-
- assertErrorContains("${doc.a.c.@a}",
- "used as string", "query result", "2", "multiple matches");
- assertErrorContains("${doc.a.d.@b}",
- "used as string", "query result", "x", "no matches");
-
- assertErrorContains("${doc.a.b * 2}",
- "used as number", "text", "explicit conversion");
- assertErrorContains("<#if doc.a.b></#if>",
- "used as number", "text", "explicit conversion");
-
- assertErrorContains("${doc.a.d?nodeName}",
- "used as node", "query result", "0", "no matches");
- assertErrorContains("${doc.a.c?nodeName}",
- "used as node", "query result", "2", "multiple matches");
- }
-
@Override
protected Object createDataModel() {
- Map<String, Object> dataModel = createCommonTestValuesDataModel();
- dataModel.put("doc", doc);
- return dataModel;
+ return createCommonTestValuesDataModel();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
index 6e9ae25..221b7b3 100644
---
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
+++
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
@@ -24,7 +24,6 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
-import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
@@ -41,10 +40,6 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
import org.apache.freemarker.core.Configuration;
import org.apache.freemarker.core.Template;
import org.apache.freemarker.core.TemplateException;
@@ -62,7 +57,6 @@ import org.apache.freemarker.core.model.TemplateModel;
import org.apache.freemarker.core.model.TemplateModelException;
import org.apache.freemarker.core.model.TemplateModelIterator;
import org.apache.freemarker.core.model.TemplateModelWithAPISupport;
-import org.apache.freemarker.core.model.TemplateNodeModel;
import org.apache.freemarker.core.model.TemplateNumberModel;
import org.apache.freemarker.core.model.TemplateScalarModel;
import org.apache.freemarker.core.model.TemplateSequenceModel;
@@ -70,9 +64,6 @@ import org.apache.freemarker.core.model.WrapperTemplateModel;
import org.apache.freemarker.core.model.WrappingTemplateModel;
import org.apache.freemarker.test.TestConfigurationBuilder;
import org.junit.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -689,16 +680,6 @@ public class DefaultObjectWrapperTest {
}
@Test
- public void assertCanWrapDOM() throws SAXException, IOException,
ParserConfigurationException,
- TemplateModelException {
- DocumentBuilder db =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- InputSource is = new InputSource();
- is.setCharacterStream(new StringReader("<doc><sub a='1' /></doc>"));
- Document doc = db.parse(is);
- assertTrue(OW.wrap(doc) instanceof TemplateNodeModel);
- }
-
- @Test
public void testExposureLevel() throws Exception {
TestBean bean = new TestBean();
@@ -857,12 +838,12 @@ public class DefaultObjectWrapperTest {
}
@Override
- protected TemplateModel handleNonBasicTypes(final Object obj) throws
TemplateModelException {
+ protected TemplateModel wrapGenericObject(final Object obj) throws
TemplateModelException {
if (obj instanceof Tupple) {
return new TuppleAdapter((Tupple<?, ?>) obj, this);
}
- return super.handleNonBasicTypes(obj);
+ return super.wrapGenericObject(obj);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
index b49c213..dde5c2f 100644
---
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
+++
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
@@ -15,9 +15,6 @@ import java.util.Set;
import java.util.TimeZone;
import java.util.TreeSet;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
import org.apache.freemarker.core.ASTPrinter;
import org.apache.freemarker.core.Configuration;
import org.apache.freemarker.core.Template;
@@ -44,10 +41,7 @@ import
org.apache.freemarker.core.templatesuite.models.TestBoolean;
import org.apache.freemarker.core.templatesuite.models.TestMethod;
import org.apache.freemarker.core.templatesuite.models.TestNode;
import org.apache.freemarker.core.templatesuite.models.VarArgTestModel;
-import org.apache.freemarker.dom.NodeModel;
import org.apache.freemarker.test.TemplateTestSuite;
-import org.apache.freemarker.test.XMLLoader;
-import org.xml.sax.InputSource;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -155,10 +149,6 @@ public class CoreTemplateTestSuite extends
TemplateTestSuite {
mMixed.put("s2", "string2");
mMixed.put("s2n", null);
dataModel.put("mMixed", mMixed);
- } else if (simpleTestName.equals("default-xmlns")) {
- InputSource is = new
InputSource(getClass().getResourceAsStream("models/defaultxmlns1.xml"));
- NodeModel nm = XMLLoader.toModel(is);
- dataModel.put("doc", nm);
} else if (simpleTestName.equals("multimodels")) {
dataModel.put("test", "selftest");
dataModel.put("self", "self");
@@ -184,33 +174,6 @@ public class CoreTemplateTestSuite extends
TemplateTestSuite {
dataModel.put("x", Integer.valueOf(4));
dataModel.put("z", Integer.valueOf(4));
confB.setSharedVariable("y", Integer.valueOf(7));
- } else if (simpleTestName.equals("xml-fragment")) {
- DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
- f.setNamespaceAware(true);
- DocumentBuilder db = f.newDocumentBuilder();
- org.w3c.dom.Document doc = db.parse(new
InputSource(getClass().getResourceAsStream("models/xmlfragment.xml")));
- NodeModel.simplify(doc);
- dataModel.put("node",
NodeModel.wrap(doc.getDocumentElement().getFirstChild().getFirstChild()));
- } else if (simpleTestName.equals("xmlns1")) {
- InputSource is = new
InputSource(getClass().getResourceAsStream("models/xmlns.xml"));
- NodeModel nm = XMLLoader.toModel(is);
- dataModel.put("doc", nm);
- } else if (simpleTestName.equals("xmlns2")) {
- InputSource is = new
InputSource(getClass().getResourceAsStream("models/xmlns2.xml"));
- NodeModel nm = XMLLoader.toModel(is);
- dataModel.put("doc", nm);
- } else if (simpleTestName.equals("xmlns3") ||
simpleTestName.equals("xmlns4")) {
- InputSource is = new
InputSource(getClass().getResourceAsStream("models/xmlns3.xml"));
- NodeModel nm = XMLLoader.toModel(is);
- dataModel.put("doc", nm);
- } else if (simpleTestName.equals("xmlns5")) {
- InputSource is = new
InputSource(getClass().getResourceAsStream("models/defaultxmlns1.xml"));
- NodeModel nm = XMLLoader.toModel(is);
- dataModel.put("doc", nm);
- } else if (simpleTestName.equals("xml-ns_prefix-scope")) {
- InputSource is = new
InputSource(getClass().getResourceAsStream("models/xml-ns_prefix-scope.xml"));
- NodeModel nm = XMLLoader.toModel(is);
- dataModel.put("doc", nm);
} else if (simpleTestName.startsWith("sequence-builtins")) {
Set<String> abcSet = new TreeSet<>();
abcSet.add("a");
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java
deleted file mode 100644
index 56a15eb..0000000
---
a/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.freemarker.dom;
-
-import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.freemarker.core.TemplateException;
-import org.apache.freemarker.test.TemplateTest;
-import org.apache.freemarker.test.XMLLoader;
-import org.junit.Before;
-import org.junit.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class DOMSiblingTest extends TemplateTest {
-
- @Before
- public void setUp() throws SAXException, IOException,
ParserConfigurationException {
- InputSource is = new
InputSource(getClass().getResourceAsStream("DOMSiblingTest.xml"));
- addToDataModel("doc", XMLLoader.toModel(is));
- }
-
- @Test
- public void testBlankPreviousSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person.name?previousSibling}", "\n ");
- assertOutput("${doc.person.name?previous_sibling}", "\n ");
- }
-
- @Test
- public void testNonBlankPreviousSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person.address?previousSibling}", "12th August");
- }
-
- @Test
- public void testBlankNextSibling() throws IOException, TemplateException {
- assertOutput("${doc.person.name?nextSibling}", "\n ");
- assertOutput("${doc.person.name?next_sibling}", "\n ");
- }
-
- @Test
- public void testNonBlankNextSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person.dob?nextSibling}", "Chennai, India");
- }
-
- @Test
- public void testNullPreviousSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person?previousSibling?? ?c}", "false");
- }
-
- @Test
- public void testSignificantPreviousSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person.name.@@previous_sibling_element}", "male");
- }
-
- @Test
- public void testSignificantNextSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person.name.@@next_sibling_element}", "12th
August");
- }
-
- @Test
- public void testNullSignificantPreviousSibling() throws IOException,
TemplateException {
- assertOutput("${doc.person.phone.@@next_sibling_element?size}", "0");
- }
-
- @Test
- public void testSkippingCommentNode() throws IOException,
TemplateException {
- assertOutput("${doc.person.profession.@@previous_sibling_element}",
"Chennai, India");
- }
-
- @Test
- public void testSkippingEmptyCDataNode() throws IOException,
TemplateException {
- assertOutput("${doc.person.hobby.@@previous_sibling_element}",
"Software Engineer");
- }
-
- @Test
- public void testValidCDataNode() throws IOException, TemplateException {
- assertOutput("${doc.person.phone.@@previous_sibling_element?size}",
"0");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSimplifiersTest.java
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSimplifiersTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSimplifiersTest.java
deleted file mode 100644
index f135873..0000000
---
a/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMSimplifiersTest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.freemarker.dom;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.freemarker.test.XMLLoader;
-import org.junit.Test;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-import org.xml.sax.SAXException;
-
-public class DOMSimplifiersTest {
-
- private static final String COMMON_TEST_XML
- = "<!DOCTYPE a
[]><?p?><a>x<![CDATA[y]]><!--c--><?p?>z<?p?><b><!--c--></b><c></c>"
- + "<d>a<e>c</e>b<!--c--><!--c--><!--c--><?p?><?p?><?p?></d>"
- + "<f><![CDATA[1]]>2</f></a><!--c-->";
-
- private static final String TEXT_MERGE_CONTENT =
- "<a>"
- + "a<!--c--><s/>"
- + "<!--c-->a<s/>"
- + "a<!--c-->b<s/>"
- + "<!--c-->a<!--c-->b<!--c--><s/>"
- + "a<b>b</b>c<s/>"
- + "a<b>b</b><!--c-->c<s/>"
- + "a<!--c-->1<b>b<!--c--></b>c<!--c-->1<s/>"
- + "a<!--c-->1<b>b<!--c-->c</b>d<!--c-->1<s/>"
- + "a<!--c-->1<b>b<!--c-->c</b>d<!--c-->1<s/>"
- +
"a<!--c-->1<b>b<!--c-->1<e>c<!--c-->1</e>d<!--c-->1</b>e<!--c-->1<s/>"
- + "</a>";
- private static final String TEXT_MERGE_EXPECTED =
- "<a>"
- + "%a<s/>"
- + "%a<s/>"
- + "%ab<s/>"
- + "%ab<s/>"
- + "%a<b>%b</b>%c<s/>"
- + "%a<b>%b</b>%c<s/>"
- + "%a1<b>%b</b>%c1<s/>"
- + "%a1<b>%bc</b>%d1<s/>"
- + "%a1<b>%bc</b>%d1<s/>"
- + "%a1<b>%b1<e>%c1</e>%d1</b>%e1<s/>"
- + "</a>";
-
- @Test
- public void testTest() throws Exception {
- String expected = "<!DOCTYPE
...><?p?><a>%x<![CDATA[y]]><!--c--><?p?>%z<?p?><b><!--c--></b><c/>"
- +
"<d>%a<e>%c</e>%b<!--c--><!--c--><!--c--><?p?><?p?><?p?></d>"
- + "<f><![CDATA[1]]>%2</f></a><!--c-->";
- assertEquals(expected, toString(XMLLoader.toDOM(COMMON_TEST_XML)));
- }
-
- @Test
- public void testMergeAdjacentText() throws Exception {
- Document dom = XMLLoader.toDOM(COMMON_TEST_XML);
- NodeModel.mergeAdjacentText(dom);
- assertEquals(
- "<!DOCTYPE
...><?p?><a>%xy<!--c--><?p?>%z<?p?><b><!--c--></b><c/>"
- + "<d>%a<e>%c</e>%b<!--c--><!--c--><!--c--><?p?><?p?><?p?></d>"
- + "<f><![CDATA[12]]></f></a><!--c-->",
- toString(dom));
- }
-
- @Test
- public void testRemoveComments() throws Exception {
- Document dom = XMLLoader.toDOM(COMMON_TEST_XML);
- NodeModel.removeComments(dom);
- assertEquals(
- "<!DOCTYPE ...><?p?><a>%x<![CDATA[y]]><?p?>%z<?p?><b/><c/>"
- + "<d>%a<e>%c</e>%b<?p?><?p?><?p?></d>"
- + "<f><![CDATA[1]]>%2</f></a>",
- toString(dom));
- }
-
- @Test
- public void testRemovePIs() throws Exception {
- Document dom = XMLLoader.toDOM(COMMON_TEST_XML);
- NodeModel.removePIs(dom);
- assertEquals(
- "<!DOCTYPE ...><a>%x<![CDATA[y]]><!--c-->%z<b><!--c--></b><c/>"
- + "<d>%a<e>%c</e>%b<!--c--><!--c--><!--c--></d>"
- + "<f><![CDATA[1]]>%2</f></a><!--c-->",
- toString(dom));
- }
-
- @Test
- public void testSimplify() throws Exception {
- testSimplify(
- "<!DOCTYPE ...><a>%xyz<b/><c/>"
- + "<d>%a<e>%c</e>%b</d><f><![CDATA[12]]></f></a>",
- COMMON_TEST_XML);
- }
-
- @Test
- public void testSimplify2() throws Exception {
- testSimplify(TEXT_MERGE_EXPECTED, TEXT_MERGE_CONTENT);
- }
-
- @Test
- public void testSimplify3() throws Exception {
- testSimplify("<a/>", "<a/>");
- }
-
- private void testSimplify(String expected, String content)
- throws SAXException, IOException, ParserConfigurationException {
- {
- Document dom = XMLLoader.toDOM(content);
- NodeModel.simplify(dom);
- assertEquals(expected, toString(dom));
- }
-
- // Must be equivalent:
- {
- Document dom = XMLLoader.toDOM(content);
- NodeModel.removeComments(dom);
- NodeModel.removePIs(dom);
- NodeModel.mergeAdjacentText(dom);
- assertEquals(expected, toString(dom));
- }
-
- // Must be equivalent:
- {
- Document dom = XMLLoader.toDOM(content);
- NodeModel.removeComments(dom);
- NodeModel.removePIs(dom);
- NodeModel.simplify(dom);
- assertEquals(expected, toString(dom));
- }
- }
-
- private String toString(Document doc) {
- StringBuilder sb = new StringBuilder();
- toString(doc, sb);
- return sb.toString();
- }
-
- private void toString(Node node, StringBuilder sb) {
- if (node instanceof Document) {
- childrenToString(node, sb);
- } else if (node instanceof Element) {
- if (node.hasChildNodes()) {
- sb.append("<").append(node.getNodeName()).append(">");
- childrenToString(node, sb);
- sb.append("</").append(node.getNodeName()).append(">");
- } else {
- sb.append("<").append(node.getNodeName()).append("/>");
- }
- } else if (node instanceof Text) {
- if (node instanceof CDATASection) {
-
sb.append("<![CDATA[").append(node.getNodeValue()).append("]]>");
- } else {
- sb.append("%").append(node.getNodeValue());
- }
- } else if (node instanceof Comment) {
- sb.append("<!--").append(node.getNodeValue()).append("-->");
- } else if (node instanceof ProcessingInstruction) {
- sb.append("<?").append(node.getNodeName()).append("?>");
- } else if (node instanceof DocumentType) {
- sb.append("<!DOCTYPE ...>");
- } else {
- throw new IllegalStateException("Unhandled node type: " +
node.getClass().getName());
- }
- }
-
- private void childrenToString(Node node, StringBuilder sb) {
- Node child = node.getFirstChild();
- while (child != null) {
- toString(child, sb);
- child = child.getNextSibling();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMTest.java
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMTest.java
b/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMTest.java
deleted file mode 100644
index 847f503..0000000
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/dom/DOMTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.freemarker.dom;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.freemarker.core.TemplateException;
-import org.apache.freemarker.test.TemplateTest;
-import org.apache.freemarker.test.XMLLoader;
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class DOMTest extends TemplateTest {
-
- @Test
- public void xpathDetectionBugfix() throws Exception {
- addDocToDataModel("<root><a>A</a><b>B</b><c>C</c></root>");
- assertOutput("${doc.root.b['following-sibling::c']}", "C");
- assertOutput("${doc.root.b['following-sibling::*']}", "C");
- }
-
- @Test
- public void xmlnsPrefixes() throws Exception {
- addDocToDataModel("<root xmlns='http://example.com/ns1'
xmlns:ns2='http://example.com/ns2'>"
- + "<a>A</a><ns2:b>B</ns2:b><c a1='1' ns2:a2='2'/></root>");
-
- String ftlHeader = "<#ftl ns_prefixes={'D':'http://example.com/ns1',
'n2':'http://example.com/ns2'}>";
-
- // @@markup:
- assertOutput("${doc.@@markup}",
- "<a:root xmlns:a=\"http://example.com/ns1\"
xmlns:b=\"http://example.com/ns2\">"
- + "<a:a>A</a:a><b:b>B</b:b><a:c a1=\"1\" b:a2=\"2\" />"
- + "</a:root>");
- assertOutput(ftlHeader
- + "${doc.@@markup}",
- "<root xmlns=\"http://example.com/ns1\"
xmlns:n2=\"http://example.com/ns2\">"
- + "<a>A</a><n2:b>B</n2:b><c a1=\"1\" n2:a2=\"2\" /></root>");
- assertOutput("<#ftl ns_prefixes={'D':'http://example.com/ns1'}>"
- + "${doc.@@markup}",
- "<root xmlns=\"http://example.com/ns1\"
xmlns:a=\"http://example.com/ns2\">"
- + "<a>A</a><a:b>B</a:b><c a1=\"1\" a:a2=\"2\" /></root>");
-
- // When there's no matching prefix declared via the #ftl header,
return null for qname:
- assertOutput("${doc?children[0].@@qname!'null'}", "null");
- assertOutput("${doc?children[0]?children[1].@@qname!'null'}", "null");
- assertOutput("${doc?children[0]?children[2]['@*'][1].@@qname!'null'}",
"null");
-
- // When we have prefix declared in the #ftl header:
- assertOutput(ftlHeader + "${doc?children[0].@@qname}", "root");
- assertOutput(ftlHeader + "${doc?children[0]?children[1].@@qname}",
"n2:b");
- assertOutput(ftlHeader + "${doc?children[0]?children[2].@@qname}",
"c");
- assertOutput(ftlHeader +
"${doc?children[0]?children[2]['@*'][0].@@qname}", "a1");
- assertOutput(ftlHeader +
"${doc?children[0]?children[2]['@*'][1].@@qname}", "n2:a2");
- // Unfortunately these include the xmlns attributes, but that would be
non-BC to fix now:
- assertThat(getOutput(ftlHeader + "${doc?children[0].@@start_tag}"),
startsWith("<root"));
- assertThat(getOutput(ftlHeader +
"${doc?children[0]?children[1].@@start_tag}"), startsWith("<n2:b"));
- }
-
- @Test
- public void namespaceUnaware() throws Exception {
-
addNSUnawareDocToDataModel("<root><x:a>A</x:a><:>B</:><xyz::c>C</xyz::c></root>");
- assertOutput("${doc.root['x:a']}", "A");
- assertOutput("${doc.root[':']}", "B");
- try {
- assertOutput("${doc.root['xyz::c']}", "C");
- fail();
- } catch (TemplateException e) {
- assertThat(e.getMessage(), containsString("xyz"));
- }
- }
-
- private void addDocToDataModel(String xml) throws SAXException,
IOException, ParserConfigurationException {
- addToDataModel("doc", XMLLoader.toModel(new InputSource(new
StringReader(xml))));
- }
-
- private void addDocToDataModelNoSimplification(String xml) throws
SAXException, IOException, ParserConfigurationException {
- addToDataModel("doc", XMLLoader.toModel(new InputSource(new
StringReader(xml)), false));
- }
-
- private void addNSUnawareDocToDataModel(String xml) throws
ParserConfigurationException, SAXException, IOException {
- DocumentBuilderFactory newFactory =
DocumentBuilderFactory.newInstance();
- newFactory.setNamespaceAware(false);
- DocumentBuilder builder = newFactory.newDocumentBuilder();
- Document doc = builder.parse(new InputSource(new StringReader(xml)));
- addToDataModel("doc", doc);
- }
-
- @Test
- public void testInvalidAtAtKeyErrors() throws Exception {
- addDocToDataModel("<r><multipleMatches /><multipleMatches /></r>");
- assertErrorContains("${doc.r.@@invalid_key}", "Unsupported @@ key",
"@invalid_key");
- assertErrorContains("${doc.@@start_tag}", "@@start_tag", "not
supported", "document");
- assertErrorContains("${doc.@@}", "\"@@\"", "not supported",
"document");
- assertErrorContains("${doc.r.noMatch.@@invalid_key}", "Unsupported @@
key", "@invalid_key");
- assertErrorContains("${doc.r.multipleMatches.@@invalid_key}",
"Unsupported @@ key", "@invalid_key");
- assertErrorContains("${doc.r.noMatch.@@attributes_markup}", "single
XML node", "@@attributes_markup");
- assertErrorContains("${doc.r.multipleMatches.@@attributes_markup}",
"single XML node", "@@attributes_markup");
- }
-
- @Test
- public void testAtAtSiblingElement() throws Exception {
- addDocToDataModel("<r><a/><b/></r>");
- assertOutput("${doc.r.@@previous_sibling_element?size}", "0");
- assertOutput("${doc.r.@@next_sibling_element?size}", "0");
- assertOutput("${doc.r.a.@@previous_sibling_element?size}", "0");
- assertOutput("${doc.r.a.@@next_sibling_element.@@qname}", "b");
- assertOutput("${doc.r.b.@@previous_sibling_element.@@qname}", "a");
- assertOutput("${doc.r.b.@@next_sibling_element?size}", "0");
-
- addDocToDataModel("<r>\r\n\t <a/>\r\n\t <b/>\r\n\t </r>");
- assertOutput("${doc.r.@@previous_sibling_element?size}", "0");
- assertOutput("${doc.r.@@next_sibling_element?size}", "0");
- assertOutput("${doc.r.a.@@previous_sibling_element?size}", "0");
- assertOutput("${doc.r.a.@@next_sibling_element.@@qname}", "b");
- assertOutput("${doc.r.b.@@previous_sibling_element.@@qname}", "a");
- assertOutput("${doc.r.b.@@next_sibling_element?size}", "0");
-
- addDocToDataModel("<r>t<a/>t<b/>t</r>");
- assertOutput("${doc.r.a.@@previous_sibling_element?size}", "0");
- assertOutput("${doc.r.a.@@next_sibling_element?size}", "0");
- assertOutput("${doc.r.b.@@previous_sibling_element?size}", "0");
- assertOutput("${doc.r.b.@@next_sibling_element?size}", "0");
-
- addDocToDataModelNoSimplification("<r><a/> <!--
--><?pi?> <b/></r>");
- assertOutput("${doc.r.a.@@next_sibling_element.@@qname}", "b");
- assertOutput("${doc.r.b.@@previous_sibling_element.@@qname}", "a");
-
- addDocToDataModelNoSimplification("<r><a/> <!-- -->t<!-- -->
<b/></r>");
- assertOutput("${doc.r.a.@@next_sibling_element?size}", "0");
- assertOutput("${doc.r.b.@@previous_sibling_element?size}", "0");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/default-xmlns.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/default-xmlns.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/default-xmlns.txt
deleted file mode 100644
index 3a52c46..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/default-xmlns.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-No NS = No NS
-x NS = x NS
-y NS = y NS
-x NS = x NS
-
-true
-
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-fragment.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-fragment.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-fragment.txt
deleted file mode 100644
index cb0da5f..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-fragment.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-b = b
-@document = @document
-@document = @document
-
-C<>&"']]> = C<>&"']]>
-
-<root xmlns:n="http://x"><a><b><n:c>C<>&"']]></n:c></b></a></root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-ns_prefix-scope.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-ns_prefix-scope.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-ns_prefix-scope.txt
deleted file mode 100644
index bf8e6bd..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml-ns_prefix-scope.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-//e: e in NS namespace-test, e in NS namespace-test
-//n:e: e in NS foo, e in NS foo
-//bar:e: e in NS bar, e in NS bar
-
-Included:
-//n:e: e in NS foo, e in NS foo
-//n:e: e in NS foo, e in NS foo
-
-Imported:
-//n:e: e in NS bar, e in NS bar
-//n:e: e in NS bar, e in NS bar
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml.txt
deleted file mode 100644
index 718bba1..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xml.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- <?firstPi customKey="something"?>
- firstPi
- customKey="something"
- <?secondPi secondPiData?>
- secondPi
- secondPiData
-2
-p
- customKey="something"
-
-<ns1:e11 xmlns:ns1="http://www.foo.com/ns1/">text1</ns1:e11><ns1:e11
xmlns:ns1="http://www.foo.com/ns1/">text2</ns1:e11>
-<ns1:e12
xmlns:ns1="http://www.foo.com/ns1/"><![CDATA[cdata-section1]]></ns1:e12><ns1:e12
xmlns:ns1="http://www.foo.com/ns1/"><![CDATA[cdata-section2<&]]></ns1:e12>
-<ns1:e1 xmlns:ns1="http://www.foo.com/ns1/" a1="v1" a2="v2">
- <ns1:e11>text1</ns1:e11>
- <ns1:e12><![CDATA[cdata-section1]]></ns1:e12>
- </ns1:e1>
-<ns1:e11 xmlns:ns1="http://www.foo.com/ns1/">text1</ns1:e11><ns1:e11
xmlns:ns1="http://www.foo.com/ns1/">text2</ns1:e11>
-a1
-v2
-rootroot
-root
- root
- e1
- e11
- e12
- e2
- e11
- e12
- root
- root
- e1
- root
- e1
- e11
- root
- e1
- e12
- root
- e2
- root
- e2
- e11
- root
- e2
- e12
-cdata-section2<&
-cdata-section2<&
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns1.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns1.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns1.txt
deleted file mode 100644
index 69af553..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns1.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-<book xmlns="http://example.com/eBook">
- <title>Test Book</title>
- <chapter>
- <title>Ch1</title>
- <para>p1.1</para>
- <para>p1.2</para>
- <para>p1.3</para>
- </chapter>
- <chapter>
- <title>Ch2</title>
- <para>p2.1</para>
- <para>p2.2</para>
- </chapter>
-</book>
-
- <html>
- <head>
- <title>Test Book</title>
- </head>
- <body>
- <h1>Test Book</h1>
-
-
- <h2>Ch1</h2>
-
-
- <p>p1.1
-
- <p>p1.2
-
- <p>p1.3
-
-
- <h2>Ch2</h2>
-
-
- <p>p2.1
-
- <p>p2.2
-
-
- </body>
- </html>
-
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns3.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns3.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns3.txt
deleted file mode 100644
index f028f0a..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns3.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- <html>
- <head>
- <title>Test Book</title>
- </head>
- <body>
- <h1>Test Book</h1>
-
-
- <h2>Ch1</h2>
-
-
- <p>p1.1
-
- <p>p1.2
-
- <p>p1.3
-
-
- <h2>Ch2</h2>
-
-
- <p>p2.1
-
- <p>p2.2
-
-
- </body>
- </html>
-
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns4.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns4.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns4.txt
deleted file mode 100644
index f028f0a..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns4.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- <html>
- <head>
- <title>Test Book</title>
- </head>
- <body>
- <h1>Test Book</h1>
-
-
- <h2>Ch1</h2>
-
-
- <p>p1.1
-
- <p>p1.2
-
- <p>p1.3
-
-
- <h2>Ch2</h2>
-
-
- <p>p2.1
-
- <p>p2.2
-
-
- </body>
- </html>
-
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns5.txt
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns5.txt
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns5.txt
deleted file mode 100644
index 6e42b09..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/xmlns5.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-No NS = No NS
-x NS = x NS
-y NS = y NS
-x NS = x NS
-No NS = No NS
-- = -
-- = -
-- = -
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/defaultxmlns1.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/defaultxmlns1.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/defaultxmlns1.xml
deleted file mode 100644
index ed289bb..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/defaultxmlns1.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<root xmlns:x="http://x.com" xmlns:y="http://y.com">
- <t1>No NS</t1>
- <x:t2>x NS</x:t2>
- <y:t3>y NS</y:t3>
- <t4 xmlns="http://x.com">x NS</t4>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml-ns_prefix-scope.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml-ns_prefix-scope.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml-ns_prefix-scope.xml
deleted file mode 100644
index 934acac..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml-ns_prefix-scope.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<root xmlns="http://freemarker.org/test/namespace-test"
- xmlns:foo="http://freemarker.org/test/foo"
- xmlns:bar="http://freemarker.org/test/bar">
- <e>e in NS namespace-test</e>
- <foo:e>e in NS foo</foo:e>
- <bar:e>e in NS bar</bar:e>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml.xml
deleted file mode 100644
index abf7e96..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xml.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<?firstPi customKey="something"?>
-<?secondPi secondPiData?>
-<ns1:root xmlns:ns1="http://www.foo.com/ns1/">
- <ns1:e1 a1="v1" a2="v2">
- <ns1:e11>text1</ns1:e11>
- <ns1:e12><![CDATA[cdata-section1]]></ns1:e12>
- </ns1:e1>
- <ns1:e2>
- <ns1:e11>text2</ns1:e11>
- <ns1:e12><![CDATA[cdata-section2<&]]></ns1:e12>
- </ns1:e2>
-</ns1:root>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlfragment.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlfragment.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlfragment.xml
deleted file mode 100644
index b5578b6..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlfragment.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<root><a><b><c xmlns="http://x">C<>&"']]></c></b></a></root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns.xml
deleted file mode 100644
index 6f6453e..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<book xmlns="http://example.com/eBook">
- <title>Test Book</title>
- <chapter>
- <title>Ch1</title>
- <para>p1.1</para>
- <para>p1.2</para>
- <para>p1.3</para>
- </chapter>
- <chapter>
- <title>Ch2</title>
- <para>p2.1</para>
- <para>p2.2</para>
- </chapter>
-</book>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns2.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns2.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns2.xml
deleted file mode 100644
index c8bfc9f..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns2.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<eb:book xmlns:eb="http://example.com/eBook">
- <eb:title>Test Book</eb:title>
- <eb:chapter>
- <eb:title>Ch1</eb:title>
- <eb:para>p1.1</eb:para>
- <eb:para>p1.2</eb:para>
- <eb:para>p1.3</eb:para>
- </eb:chapter>
- <eb:chapter>
- <eb:title>Ch2</eb:title>
- <eb:para>p2.1</eb:para>
- <eb:para>p2.2</eb:para>
- </eb:chapter>
-</eb:book>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns3.xml
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns3.xml
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns3.xml
deleted file mode 100644
index 8502ead..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/models/xmlns3.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<book xmlns:x="http://x" xmlns:y="http://y">
- <x:title>Test Book</x:title>
- <chapter>
- <y:title>Ch1</y:title>
- <para>p1.1</para>
- <para>p1.2</para>
- <para>p1.3</para>
- </chapter>
- <x:chapter>
- <y:title>Ch2</y:title>
- <x:para>p2.1</x:para>
- <y:para>p2.2</y:para>
- </x:chapter>
-</book>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
deleted file mode 100644
index 4f01835..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/default-xmlns.ftl
+++ /dev/null
@@ -1,28 +0,0 @@
-<#ftl ns_prefixes={"D" : "http://x.com", "y" : "http://y.com"}>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<#assign r = doc.*[0]>
-${r["N:t1"]?default('-')} = No NS
-${r["t2"]?default('-')} = x NS
-${r["y:t3"]?default('-')} = y NS
-${r["./D:t4"]?default('-')} = x NS
-
-<#assign bool = doc["true()"]>
-${bool?string}
-
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-fragment.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-fragment.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-fragment.ftl
deleted file mode 100644
index 226215b..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-fragment.ftl
+++ /dev/null
@@ -1,26 +0,0 @@
-<#ftl ns_prefixes = {"n" : "http://x"}>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-${node?node_name} = b
-${node?root?node_name} = @document
-${node['/']?node_name} = @document
-
-${node['n:c']} = C<>&"']]>
-
-${node?root.@@markup}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-lib.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-lib.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-lib.ftl
deleted file mode 100644
index 0f0bde2..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-lib.ftl
+++ /dev/null
@@ -1,23 +0,0 @@
-<#ftl ns_prefixes={ "n": "http://freemarker.org/test/bar", "D":
"http://freemarker.org/test/namespace-test" }>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<#global libResult>//n:e: ${doc['//n:e']}, ${doc.root['n:e']}</#global>
-<#macro m>
-//n:e: ${doc['//n:e']}, ${doc.root['n:e']}
-</#macro>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-main.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-main.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-main.ftl
deleted file mode 100644
index 5b7ce24..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml-ns_prefix-scope-main.ftl
+++ /dev/null
@@ -1,36 +0,0 @@
-<#ftl ns_prefixes={
- "D": "http://freemarker.org/test/namespace-test",
- "n": "http://freemarker.org/test/foo",
- "bar": "http://freemarker.org/test/bar"
-}>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-//e: ${doc['//D:e']}, ${doc.root.e}
-//n:e: ${doc['//n:e']}, ${doc.root['n:e']}
-//bar:e: ${doc['//bar:e']}, ${doc.root['bar:e']}
-
-Included:
-<#include "xml-ns_prefix-scope-lib.ftl">
-${libResult}
-<@m />
-
-Imported:
-<#import "xml-ns_prefix-scope-lib.ftl" as lib>
-${libResult}
-<@lib.m />
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml.ftl
deleted file mode 100644
index b85fc03..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xml.ftl
+++ /dev/null
@@ -1,47 +0,0 @@
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<#-- test processing instructions -->
-<#global PIs = doc._content._ftype("p")>
-<#list PIs as pi>
- ${pi}
- ${pi["@target"]._text}
- ${pi["@data"]._text}
-</#list>
-${PIs?size}
-<#global firstPi = PIs[0]>
-${firstPi._type}
-${firstPi["@customKey"]}
-${doc._registerNamespace("ns", "http://www.foo.com/ns1/")}
-${doc._descendant["ns:e11"]}
-${doc._descendant["ns:e12"]}
-<#global docRoot = doc["ns:root"]>
-${docRoot["ns:e1"]}
-${doc("//ns:e11")}
-${docRoot["ns:e1"]["@a1"]._name}
-${docRoot["ns:e1"]["@a2"]._text}
-${docRoot._children._parent._name}
-${docRoot._children._parent._unique._name}
-<#list doc._descendant as d>
- ${d._name}
-</#list>
-<#list doc._descendant._ancestorOrSelf as d>
- ${d._name}
-</#list>
-${docRoot["ns:e2"]["ns:e12"]._text}
-${docRoot["ns:e2"]["ns:e12"]._plaintext}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns1.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns1.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns1.ftl
deleted file mode 100644
index 8aa893e..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns1.ftl
+++ /dev/null
@@ -1,53 +0,0 @@
-<#ftl ns_prefixes = {"D" : "http://example.com/eBook"}>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-${doc.@@markup}
-
-<#recurse doc >
-
-<#macro book>
- <html>
- <head>
- <title><#recurse .node.title></title>
- </head>
- <body>
- <h1><#recurse .node.title></h1>
- <#recurse>
- </body>
- </html>
-</#macro>
-
-<#macro chapter>
- <h2><#recurse .node.title></h2>
- <#recurse>
-</#macro>
-
-<#macro para>
- <p><#recurse>
-</#macro>
-
-<#macro title>
- <#--
- We have handled this element imperatively,
- so we do nothing here.
- -->
-</#macro>
-
-<#macro @text>${.node?html}</#macro>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns3.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns3.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns3.ftl
deleted file mode 100644
index c84ec69..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns3.ftl
+++ /dev/null
@@ -1,70 +0,0 @@
-<#ftl ns_prefixes = {"x" : "http://x", "y" : "http://y"}>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<#recurse doc >
-
-<#macro book>
- <html>
- <head>
- <title><#recurse .node["x:title"]></title>
- </head>
- <body>
- <h1><#recurse .node["x:title"]></h1>
- <#recurse>
- </body>
- </html>
-</#macro>
-
-<#macro chapter>
- <h2><#recurse .node["y:title"]></h2>
- <#recurse>
-</#macro>
-
-<#macro "x:chapter">
- <h2><#recurse .node["y:title"]></h2>
- <#recurse>
-</#macro>
-
-<#macro para>
- <p><#recurse>
-</#macro>
-
-<#macro "x:para">
- <p><#recurse>
-</#macro>
-
-<#macro "y:para">
- <p><#recurse>
-</#macro>
-
-<#macro "x:title">
- <#--
- We have handled this element imperatively,
- so we do nothing here.
- -->
-</#macro>
-
-<#macro "y:title">
- <#--
- We have handled this element imperatively,
- so we do nothing here.
- -->
-</#macro>
-
-<#macro @text>${.node?html}</#macro>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/be556897/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns4.ftl
----------------------------------------------------------------------
diff --git
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns4.ftl
b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns4.ftl
deleted file mode 100644
index e97bfc0..0000000
---
a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/xmlns4.ftl
+++ /dev/null
@@ -1,70 +0,0 @@
-<#ftl ns_prefixes = {"x" : "http://x", "y" : "http://y"}>
-<#--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<#recurse doc >
-
-<#macro book>
- <html>
- <head>
- <title><#recurse .node["x:title"]></title>
- </head>
- <body>
- <h1><#recurse .node["x:title"]></h1>
- <#recurse>
- </body>
- </html>
-</#macro>
-
-<#macro chapter>
- <h2><#recurse .node["y:title"]></h2>
- <#recurse>
-</#macro>
-
-<#macro 'x:chapter'>
- <h2><#recurse .node["y:title"]></h2>
- <#recurse>
-</#macro>
-
-<#macro para>
- <p><#recurse>
-</#macro>
-
-<#macro 'x:para'>
- <p><#recurse>
-</#macro>
-
-<#macro 'y:para'>
- <p><#recurse>
-</#macro>
-
-<#macro "x:title">
- <#--
- We have handled this element imperatively,
- so we do nothing here.
- -->
-</#macro>
-
-<#macro "y:title">
- <#--
- We have handled this element imperatively,
- so we do nothing here.
- -->
-</#macro>
-
-<#macro @text>${.node?html}</#macro>
\ No newline at end of file