Author: hlship
Date: Tue Nov 4 16:00:13 2008
New Revision: 711473
URL: http://svn.apache.org/viewvc?rev=711473&view=rev
Log:
TAP5-263: Tapestry should produce XML-style output (not SGML) even for the
text/html content type, for best compatibility with browsers
Added:
tapestry/tapestry5/trunk/src/site/apt/guide/content-type.apt
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/AbstractMarkupModel.java
Modified:
tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt
tapestry/tapestry5/trunk/src/site/site.xml
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/DefaultMarkupModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/Document.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/EndTagStyle.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/MarkupModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/XMLMarkupModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterFactoryImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/OutputTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/dom/DOMTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/MarkupWriterImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/document_with_root_element_and_attributes.txt
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/nested_elements.txt
Modified: tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt Tue Nov 4 16:00:13
2008
@@ -71,12 +71,28 @@
If such a class exists, it is added to the IoC Registry. It is not an error
for your application to not have a module, though
any non-trivial application will have a module.
-
+
+ An application module will often override some of Tapestry's default, or
"factory", symbols, by contributing overrides
+ to the ApplicationDefaults service configuration. For example:
+
+----
+public class AppModule
+{
+ public static void
contributeApplicationDefaults(MappedConfiguration<String,String> configuration)
+ {
+ configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,fr,de");
+ configuration.add(SymbolConstants.FILE_CHECK_INTERVAL, "10 m");
+ }
+}
+----
+
* Configuration Symbols
Tapestry may also be configured via
{{{../../tapestry-ioc/symbols.html}symbols}}. A certain number of built-in
services
(some of which are not even public) are configured via symbols. These
symbols can be overridden
- by contributing to the ApplicationDefaults service configuration, or on the
command line
+ by contributing to the ApplicationDefaults service configuration, or by
placing a
+ \<context-param\> element into the application's web.xml,
+ or on the command line
by defining JVM System Properties with the -D command line option.
These symbols are always defined in terms of strings, that are coerced to
the appropriate type (a number,
Added: tapestry/tapestry5/trunk/src/site/apt/guide/content-type.apt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/guide/content-type.apt?rev=711473&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/guide/content-type.apt (added)
+++ tapestry/tapestry5/trunk/src/site/apt/guide/content-type.apt Tue Nov 4
16:00:13 2008
@@ -0,0 +1,49 @@
+ ---
+ Content Type and Markup Output
+ ---
+
+Content Type and Markup Output
+
+ Tapestry reads {{{templates.html}well-formed XML template files}} and
renders its output as XML, with minor caveats:
+
+ * The \<?xml\?> XML declaration is omitted.
+
+ * Certain elements will render as an open and close tag, even if the body is
empty:
+
+ * script
+
+ * div
+
+ * span
+
+ * p
+
+ * textarea
+
+ * select
+
+ []
+
+ * \<![CDATA[]\> sections are <<not>> used
+
+ []
+
+ This is all to ensure that the markup stream, while (almost) well formed, is
still properly understood by browsers
+ expecting ordinary HTML.
+
+ In fact, Tapestry may decide to render a purely XML document; it depends on
the content type of the response.
+ The default content type for pages is "text/html" ... this triggers
specialized XML rendering.
+
+ A page may declare its content type using the
{{{../apidocs/org/apache/tapestry5/annotations/ContentType.html}ContentType}}
+ class annotation. Content types other than "text/html" will render as
well-formed XML documents, including the
+ XML declaration, and more standard behavior for empty elements.
+
+Input/Output Character Set
+
+ The character set (aka character encoding) used when writing output and when
parsing requests is normally "utf-8".
+ All pages use the same encoding, which can be set using the
+ <<<tapestry.charset>>>
+ {{{conf.html}configuration setting}}.
+
+
+
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/src/site/site.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/site.xml?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/trunk/src/site/site.xml Tue Nov 4 16:00:13 2008
@@ -81,6 +81,7 @@
<item name="Component Rendering" href="guide/rendering.html"/>
<item name="Component Templates" href="guide/templates.html"/>
<item name="Configuration" href="guide/conf.html"/>
+ <item name="Content Type and Markup"
href="guide/content-type.html"/>
<item name="CSS" href="guide/css.html"/>
<item name="DOM" href="guide/dom.html"/>
<item name="Environmental Services" href="guide/env.html"/>
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/AbstractMarkupModel.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/AbstractMarkupModel.java?rev=711473&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/AbstractMarkupModel.java
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/AbstractMarkupModel.java
Tue Nov 4 16:00:13 2008
@@ -0,0 +1,73 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.dom;
+
+public abstract class AbstractMarkupModel implements MarkupModel
+{
+ /**
+ * Passes all characters but '<', '>' and '&' through unchanged.
+ */
+ public void encode(String content, StringBuilder buffer)
+ {
+ encode(content, false, buffer);
+ }
+
+ public String encode(String content)
+ {
+ StringBuilder buffer = new StringBuilder(content.length() * 2);
+
+ encode(content, false, buffer);
+
+ return buffer.toString();
+ }
+
+ public void encodeQuoted(String content, StringBuilder buffer)
+ {
+ encode(content, true, buffer);
+ }
+
+ private void encode(String content, boolean encodeQuotes, StringBuilder
buffer)
+ {
+ char[] array = content.toCharArray();
+
+ for (char ch : array)
+ {
+ switch (ch)
+ {
+ case '<':
+ buffer.append("<");
+ continue;
+
+ case '>':
+ buffer.append(">");
+ continue;
+
+ case '&':
+ buffer.append("&");
+ continue;
+
+ case '"':
+ if (encodeQuotes)
+ {
+ buffer.append(""");
+ continue;
+ }
+
+ default:
+ buffer.append(ch);
+ }
+ }
+ }
+}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/DefaultMarkupModel.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/DefaultMarkupModel.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/DefaultMarkupModel.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/DefaultMarkupModel.java
Tue Nov 4 16:00:13 2008
@@ -19,76 +19,24 @@
import java.util.Set;
/**
- * Default implementation of [EMAIL PROTECTED]
org.apache.tapestry5.dom.MarkupModel} that is appropriate for traditional HTML
- * markup. This conforms to the SGML HTML definition, including some things
that are not well formed XML-style markup.
- * Assumes that all tags are lower-case.
+ * Default implementation of [EMAIL PROTECTED]
org.apache.tapestry5.dom.MarkupModel} that is appropriate for traditional
(X)HTML
+ * markup. Assumes that all tags are lower-case. A certain set of tags will
always be expanded (with seperate begin and
+ * end tags) even if their content is empty: script, div, span, p, textarea,
select; this is for compatibility with web
+ * browsers, especially when the content type of a response indicates HTML,
not true XML.
*/
-public class DefaultMarkupModel implements MarkupModel
+public class DefaultMarkupModel extends AbstractMarkupModel
{
- private final Set<String> EMPTY_ELEMENTS =
CollectionFactory.newSet("base", "br", "col", "frame", "hr", "img",
-
"input", "link",
-
"meta", "option", "param");
-
/**
- * Passes all characters but '<', '>' and '&' through unchanged.
+ * For these tags, use [EMAIL PROTECTED]
org.apache.tapestry5.dom.EndTagStyle#REQUIRE}.
*/
- public void encode(String content, StringBuilder buffer)
- {
- encode(content, false, buffer);
- }
-
- public String encode(String content)
- {
- StringBuilder buffer = new StringBuilder(content.length() * 2);
-
- encode(content, false, buffer);
-
- return buffer.toString();
- }
-
- public void encodeQuoted(String content, StringBuilder buffer)
- {
- encode(content, true, buffer);
- }
-
- private void encode(String content, boolean encodeQuotes, StringBuilder
buffer)
- {
- char[] array = content.toCharArray();
-
- for (char ch : array)
- {
- switch (ch)
- {
- case '<':
- buffer.append("<");
- continue;
-
- case '>':
- buffer.append(">");
- continue;
-
- case '&':
- buffer.append("&");
- continue;
-
- case '"':
- if (encodeQuotes)
- {
- buffer.append(""");
- continue;
- }
-
- default:
- buffer.append(ch);
- }
- }
- }
+ private final Set<String> REQUIRE_END_TAG =
+ CollectionFactory.newSet("script", "div", "span", "p", "textarea",
"select");
public EndTagStyle getEndTagStyle(String element)
{
- boolean isEmpty = EMPTY_ELEMENTS.contains(element);
+ boolean required = REQUIRE_END_TAG.contains(element);
- return isEmpty ? EndTagStyle.OMIT : EndTagStyle.REQUIRE;
+ return required ? EndTagStyle.REQUIRE : EndTagStyle.ABBREVIATE;
}
/**
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/Document.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/Document.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/Document.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/Document.java
Tue Nov 4 16:00:13 2008
@@ -40,6 +40,8 @@
{
super(null);
+ Defense.notNull(model, "model");
+
this.model = model;
this.encoding = encoding;
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/EndTagStyle.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/EndTagStyle.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/EndTagStyle.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/EndTagStyle.java
Tue Nov 4 16:00:13 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@
/**
* Omit the end tag. Examples for HTML include the input, br and img
elements.
+ *
+ * @deprecated Tapestry always renders well formed XML markup (even when a
DOCTYPE is not present, or the content
+ * type is traditional text/html).
*/
OMIT,
/**
@@ -30,8 +33,9 @@
*/
REQUIRE,
/**
- * Require an end tag, but abbreviate it if the element has no children.
This is the only value used in XML
- * documents.
+ * Require an end tag, but abbreviate it if the element has no children.
This is the only value that should be used
+ * in XML documents, but [EMAIL PROTECTED]
org.apache.tapestry5.dom.DefaultMarkupModel} forces certain tags to use [EMAIL
PROTECTED]
+ * #REQUIRE} for semi-obscure browser compatibility issues.
*/
ABBREVIATE
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/MarkupModel.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/MarkupModel.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/MarkupModel.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/MarkupModel.java
Tue Nov 4 16:00:13 2008
@@ -24,8 +24,8 @@
public interface MarkupModel
{
/**
- * Encodes the characters into the buffer, converting control characters
(such as '<') into corresponding
- * entities (such as &lt;).
+ * Encodes the characters, converting control characters (such as '<')
into corresponding entities (such as
+ * &lt;).
*
* @param content to be filtered
* @return the filtered content
@@ -51,7 +51,7 @@
* Returns true if the document markup is XML, which is used to determine
the need for an XML declaration at the
* start of the document, and whether CDATA sections are supported.
*
- * @return true for XML output, false for HTML (SGML) output
+ * @return true for XML output, false for HTML output
*/
boolean isXML();
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/XMLMarkupModel.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/XMLMarkupModel.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/XMLMarkupModel.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/dom/XMLMarkupModel.java
Tue Nov 4 16:00:13 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,13 +17,11 @@
/**
* Markup model used when generating any form of XML markup.
*/
-public final class XMLMarkupModel extends DefaultMarkupModel
+public final class XMLMarkupModel extends AbstractMarkupModel
{
-
/**
* Always returns ABBREVIATE.
*/
- @Override
public EndTagStyle getEndTagStyle(String element)
{
return EndTagStyle.ABBREVIATE;
@@ -32,7 +30,6 @@
/**
* Returns true.
*/
- @Override
public boolean isXML()
{
return true;
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterFactoryImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterFactoryImpl.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterFactoryImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterFactoryImpl.java
Tue Nov 4 16:00:13 2008
@@ -48,6 +48,7 @@
return newMarkupWriter(contentType, true);
}
+ @SuppressWarnings({"UnusedDeclaration"})
private MarkupWriter newMarkupWriter(ContentType contentType, boolean
partial)
{
boolean isHTML =
contentType.getMimeType().equalsIgnoreCase("text/html");
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterImpl.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/MarkupWriterImpl.java
Tue Nov 4 16:00:13 2008
@@ -35,6 +35,9 @@
private List<MarkupWriterListener> listeners;
+ /**
+ * Creates a new instance of the MarkupWriter with a [EMAIL PROTECTED]
org.apache.tapestry5.dom.DefaultMarkupModel}.
+ */
public MarkupWriterImpl()
{
this(new DefaultMarkupModel());
@@ -123,7 +126,6 @@
current.attribute(name, value.toString());
}
-
}
private void ensureCurrentElement()
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/OutputTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/OutputTest.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/OutputTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/OutputTest.java
Tue Nov 4 16:00:13 2008
@@ -124,7 +124,7 @@
verify();
- assertEquals(writer.toString(), "<root></root>");
+ assertEquals(writer.toString(), "<root/>");
}
@Test
@@ -189,6 +189,6 @@
verify();
- assertEquals(writer.toString(), "<root></root>");
+ assertEquals(writer.toString(), "<root/>");
}
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/dom/DOMTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/dom/DOMTest.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/dom/DOMTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/dom/DOMTest.java
Tue Nov 4 16:00:13 2008
@@ -30,7 +30,7 @@
d.newRootElement("empty");
- assertEquals(d.toString(), "<empty></empty>");
+ assertEquals(d.toString(), "<empty/>");
}
@Test
@@ -169,7 +169,7 @@
e.attribute("foo", "bar");
- final String expected = "<root foo=\"bar\"></root>";
+ final String expected = "<root foo=\"bar\"/>";
assertEquals(d.toString(), expected);
@@ -229,7 +229,7 @@
e.element("foo", "alpha", "legion");
- assertEquals(d.toString(), "<root><foo
alpha=\"legion\"></foo></root>");
+ assertEquals(d.toString(), "<root><foo alpha=\"legion\"/></root>");
}
@Test
@@ -482,13 +482,13 @@
mobile.text("On the move");
assertEquals(d.toString(),
-
"<doc><placeholder></placeholder><target></target><source><mobile>On the
move</mobile></source></doc>");
+ "<doc><placeholder/><target/><source><mobile>On the
move</mobile></source></doc>");
mobile.moveBefore(target);
assertEquals(d.toString(),
- "<doc><placeholder></placeholder><mobile>On the
move</mobile><target></target><source></source></doc>");
+ "<doc><placeholder/><mobile>On the
move</mobile><target/><source/></doc>");
}
@Test
@@ -505,13 +505,13 @@
mobile.text("On the move");
assertEquals(d.toString(),
-
"<doc><placeholder></placeholder><target></target><source><mobile>On the
move</mobile></source></doc>");
+ "<doc><placeholder/><target/><source><mobile>On the
move</mobile></source></doc>");
mobile.moveAfter(target);
assertEquals(d.toString(),
-
"<doc><placeholder></placeholder><target></target><mobile>On the
move</mobile><source></source></doc>");
+ "<doc><placeholder/><target/><mobile>On the
move</mobile><source/></doc>");
}
@Test
@@ -528,12 +528,12 @@
mobile.text("On the move");
assertEquals(d.toString(),
-
"<doc><target><placeholder></placeholder></target><source><mobile>On the
move</mobile></source></doc>");
+ "<doc><target><placeholder/></target><source><mobile>On
the move</mobile></source></doc>");
mobile.moveToTop(target);
assertEquals(d.toString(),
- "<doc><target><mobile>On the
move</mobile><placeholder></placeholder></target><source></source></doc>");
+ "<doc><target><mobile>On the
move</mobile><placeholder/></target><source/></doc>");
}
@Test
@@ -550,12 +550,12 @@
mobile.text("On the move");
assertEquals(d.toString(),
-
"<doc><target><placeholder></placeholder></target><source><mobile>On the
move</mobile></source></doc>");
+ "<doc><target><placeholder/></target><source><mobile>On
the move</mobile></source></doc>");
mobile.moveToBottom(target);
assertEquals(d.toString(),
- "<doc><target><placeholder></placeholder><mobile>On the
move</mobile></target><source></source></doc>");
+ "<doc><target><placeholder/><mobile>On the
move</mobile></target><source/></doc>");
}
@Test
@@ -574,12 +574,12 @@
mobile.text("On the move");
assertEquals(d.toString(),
- "<doc><before></before><source><mobile>On the
move</mobile><grok></grok></source><after></after></doc>");
+ "<doc><before/><source><mobile>On the
move</mobile><grok/></source><after/></doc>");
source.removeChildren();
assertEquals(d.toString(),
-
"<doc><before></before><source></source><after></after></doc>");
+ "<doc><before/><source/><after/></doc>");
}
@Test
@@ -594,12 +594,12 @@
source.element("grok");
assertEquals(d.toString(),
- "<doc><source><mobile>On the
move</mobile><grok></grok></source></doc>");
+ "<doc><source><mobile>On the
move</mobile><grok/></source></doc>");
source.pop();
assertEquals(d.toString(),
- "<doc><mobile>On the move</mobile><grok></grok></doc>");
+ "<doc><mobile>On the move</mobile><grok/></doc>");
}
@Test
@@ -640,11 +640,11 @@
Node text = mobile.text("On the move");
assertEquals(d.toString(),
-
"<doc><target><placeholder></placeholder></target><source><mobile>On the
move</mobile></source></doc>");
+ "<doc><target><placeholder/></target><source><mobile>On
the move</mobile></source></doc>");
text.wrap("em", "class", "bold");
assertEquals(d.toString(),
-
"<doc><target><placeholder></placeholder></target><source><mobile><em
class=\"bold\">On the move</em></mobile></source></doc>");
+ "<doc><target><placeholder/></target><source><mobile><em
class=\"bold\">On the move</em></mobile></source></doc>");
}
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/MarkupWriterImplTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/MarkupWriterImplTest.java?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/MarkupWriterImplTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/MarkupWriterImplTest.java
Tue Nov 4 16:00:13 2008
@@ -142,7 +142,7 @@
// img is a tag with an end tag style of omit, so no close tag is
written.
- assertEquals(w.toString(), "<img height=\"20\" src=\"foo.png\"
width=\"20\">");
+ assertEquals(w.toString(), "<img height=\"20\" src=\"foo.png\"
width=\"20\"/>");
}
@Test
@@ -154,7 +154,7 @@
w.attributes("foo", "bar", "gnip", "gnop");
- assertEquals(w.toString(), "<root foo=\"bar\" gnip=\"gnop\"></root>");
+ assertEquals(w.toString(), "<root foo=\"bar\" gnip=\"gnop\"/>");
}
@Test
@@ -179,7 +179,6 @@
w.end();
assertEquals(w.toString(), "<root><!-- <&> --></root>");
-
}
@Test
@@ -205,7 +204,7 @@
w.write(null);
w.end();
- assertEquals(w.toString(), "<root></root>");
+ assertEquals(w.toString(), "<root/>");
}
@Test
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/document_with_root_element_and_attributes.txt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/document_with_root_element_and_attributes.txt?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/document_with_root_element_and_attributes.txt
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/document_with_root_element_and_attributes.txt
Tue Nov 4 16:00:13 2008
@@ -1 +1 @@
-<has-attributes barney="rubble" fred="flintstone"></has-attributes>
\ No newline at end of file
+<has-attributes barney="rubble" fred="flintstone"/>
\ No newline at end of file
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/nested_elements.txt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/nested_elements.txt?rev=711473&r1=711472&r2=711473&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/nested_elements.txt
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/dom/nested_elements.txt
Tue Nov 4 16:00:13 2008
@@ -1 +1 @@
-<population><person first-name="Fred" last-name="Flintstone"></person><person
first-name="Barney" last-name="Rubble"></person></population>
\ No newline at end of file
+<population><person first-name="Fred" last-name="Flintstone"/><person
first-name="Barney" last-name="Rubble"/></population>
\ No newline at end of file