aslom 02/10/10 01:58:00
Modified: doc changes.html
src/java/samples Roundtrip.java
src/java/tests/org/xmlpull/v1/tests TestMisc.java
TestSerializeWithNs.java
Log:
added test for ROUNDTRIP of start tag that contains attribute value entity
reference
Revision Changes Path
1.38 +12 -0 xmlpull-api-v1/doc/changes.html
Index: changes.html
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/doc/changes.html,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -t -w -r1.37 -r1.38
--- changes.html 2002/09/09 01:36:41 1.37
+++ changes.html 2002/10/10 06:57:59 1.38
@@ -26,10 +26,22 @@
and
<a href="http://xmlpull.org/v1/doc/features.html#xmldecl-content">XMLDECL
CONTENT</a>.
+<li>XmlSeriaizer is now required ot throw exception when user tries to
+write startTag() in default namespace ("") and default namesapce is bound
+to non-empty string, added test to check for it
+
+<li>added patch by Holger Krug to SAX2 Driver to allow modification in sub
classes
+of how Attributes in startElement() are kept. Added also
AttributesCachingDriver
+that extends SAX2 Driver and creates a new copy of Attributes for each
startElement()
+so provided Attributes will not change during parsing and can be kept
indefinitely.
+
<li>changed tests to reflect changed handling of XMLDecl
and added tests to check for optional XMLDecl properties
<li>more tests to check for CDATA end-of-line normalization
+
+<li>changed tests to require support for ROUNDTRIP==false
+and additional checks for EOL nomralization of tokens
</ul>
1.8 +4 -3 xmlpull-api-v1/src/java/samples/Roundtrip.java
Index: Roundtrip.java
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/samples/Roundtrip.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -t -w -r1.7 -r1.8
--- Roundtrip.java 2002/09/09 02:05:11 1.7
+++ Roundtrip.java 2002/10/10 06:57:59 1.8
@@ -9,9 +9,10 @@
import org.xmlpull.v1.XmlSerializer;
-/** WARNING: This sample is NOT part of the XmlPull API. This class is just
- contained to help evaluating the serializer interface, which is
- also NOT part of the XmlPull API (yet) */
+/**
+ * This sample demonstrates how to roundtrip XML document
+ * (roundtrip is not exact but infoset level)
+ */
public class Roundtrip {
//private static final String FEATURE_XML_ROUNDTRIP=
1.14 +27 -0
xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestMisc.java
Index: TestMisc.java
===================================================================
RCS file:
/l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestMisc.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -t -w -r1.13 -r1.14
--- TestMisc.java 2002/09/09 04:17:51 1.13
+++ TestMisc.java 2002/10/10 06:58:00 1.14
@@ -368,6 +368,33 @@
}
+ public void testRoundtripNext() throws Exception {
+ // check that entiy reference is reported in start tag as unexpanded
when roundtrip is enabled
+ final String SAMPLE_XML =
+ "<foo attr=\"baz & bar\"/>";
+
+ XmlPullParser pp = factory.newPullParser();
+ assertEquals(true,
pp.getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES));
+ pp.setInput(new StringReader(SAMPLE_XML));
+
+ try {
+ pp.setFeature(FEATURE_XML_ROUNDTRIP, true);
+ } catch(Exception ex) {
+ }
+ // did we succeeded?
+ boolean roundtripSupported = pp.getFeature(FEATURE_XML_ROUNDTRIP);
+
+
+ pp.next();
+ String attrValue = pp.getAttributeValue(pp.NO_NAMESPACE, "attr");
+ assertEquals("baz & bar", attrValue);
+ if(roundtripSupported) {
+ String text = pp.getText();
+ assertEquals(SAMPLE_XML, text);
+ }
+
+ }
+
public static void main (String[] args) {
junit.textui.TestRunner.run (new TestSuite(TestMisc.class));
}
1.11 +1 -1
xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerializeWithNs.java
Index: TestSerializeWithNs.java
===================================================================
RCS file:
/l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerializeWithNs.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -t -w -r1.10 -r1.11
--- TestSerializeWithNs.java 2002/10/04 17:48:45 1.10
+++ TestSerializeWithNs.java 2002/10/10 06:58:00 1.11
@@ -18,7 +18,7 @@
import org.xmlpull.v1.XmlSerializer;
/**
- * Simple test to verify serializer (with no namespaces)
+ * Simple test to verify serializer (with namespaces)
*
* @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander
Slominski</a>
*/
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|