You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2003/06/02 15:16:22 UTC
cvs commit: xml-axis/java/test/utils TestXMLUtils.java
gdaniels 2003/06/02 06:16:22
Modified: java/test/utils TestXMLUtils.java
Log:
Add test to make sure xml:lang is getting
correctly parsed.
Revision Changes Path
1.18 +23 -1 xml-axis/java/test/utils/TestXMLUtils.java
Index: TestXMLUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/utils/TestXMLUtils.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- TestXMLUtils.java 19 Nov 2002 18:48:58 -0000 1.17
+++ TestXMLUtils.java 2 Jun 2003 13:16:22 -0000 1.18
@@ -6,6 +6,9 @@
import org.apache.axis.encoding.DeserializationContextImpl;
import org.apache.axis.test.AxisTestBase;
import org.apache.axis.utils.XMLUtils;
+import org.apache.axis.message.PrefixedQName;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -13,12 +16,14 @@
import javax.xml.parsers.SAXParser;
import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPBodyElement;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PipedOutputStream;
import java.io.Reader;
import java.io.StringReader;
+import java.util.Iterator;
public class TestXMLUtils extends AxisTestBase
{
@@ -349,10 +354,16 @@
"xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" > " +
"<SOAP-ENV:Body>\n" +
"<echo:Echo xmlns:echo=\"EchoService\">\n" +
- "<symbol>IBM</symbol>\n" +
+ "<symbol xml:lang=\"en\">IBM</symbol>\n" +
"</echo:Echo>\n" +
"</SOAP-ENV:Body></SOAP-ENV:Envelope>\n";
+ /**
+ * Confirm we can parse a SOAP Envelope, and make sure that the
+ * xml:lang attribute is handled OK while we're at it.
+ *
+ * @throws Exception
+ */
public void testSAXXXE3() throws Exception
{
StringReader strReader3 = new StringReader(msg2);
@@ -360,6 +371,17 @@
new InputSource(strReader3), null, org.apache.axis.Message.REQUEST);
dser.parse();
SOAPEnvelope env = dser.getEnvelope();
+ SOAPBodyElement body = (SOAPBodyElement)env.getBody().getChildElements().next();
+ assertNotNull(body);
+ MessageElement child = (MessageElement)body.getChildElements().next();
+ assertNotNull(child);
+ Iterator i = child.getAllAttributes();
+ assertNotNull(i);
+ PrefixedQName attr = (PrefixedQName)i.next();
+ assertNotNull(attr);
+ assertEquals("Prefix for attribute was not 'xml'", attr.getPrefix(), "xml");
+ assertEquals("Namespace for attribute was not correct", attr.getURI(),
+ Constants.NS_URI_XML);
}
public static void main(String[] args) throws Exception