You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@apache.org on 2001/05/17 23:24:33 UTC

cvs commit: xml-soap/java/src/org/apache/soap/util/xml XMISerializer.java XMLParserUtils.java XMLParserLiaison.java XercesParserLiaison.java

duftler     01/05/17 14:24:33

  Modified:    java     build.xml
               java/samples/addressbook AddressBook.java PutListings.java
               java/samples/addressbook2 AddressSerializer.java
                        PhoneSerializer.java
               java/samples/ejb ejbtest.java
               java/samples/lemurlabs Fortune.java
               java/samples/mime MimeTestClient.java
               java/samples/provider testprovider.java
               java/samples/stockquote GetQuote.java GetQuoteSMTP.java
                        StockQuoteService.java
               java/samples/weblogic_ejb ejbtest.java
               java/samples/xmethods GetTemp.java
               java/src/org/apache/soap/util/xml XMISerializer.java
                        XMLParserUtils.java
  Removed:     java/src/org/apache/soap/util/xml XMLParserLiaison.java
                        XercesParserLiaison.java
  Log:
  Converted all demos to use JAXP.
  Removed all references to XMLParserLiaison and XercesParserLiaison.
  Removed org.apache.soap.util.xml.XMLParserLiaison and
    org.apache.soap.util.xml.XercesParserLiaison classes.
  
  Revision  Changes    Path
  1.32      +2 -1      xml-soap/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/build.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build.xml	2001/05/16 18:29:24	1.31
  +++ build.xml	2001/05/17 21:23:48	1.32
  @@ -10,7 +10,8 @@
   Prerequisites:
   
      jakarta-ant from http://jakarta.apache.org
  -   xml-xerces from http://xml.apache.org
  +   Any JAXP-compliant XML parser
  +     (xml-xerces from http://xml.apache.org works just fine)
      JavaMail from http://java.sun.com/products/javamail/
      Java Activation Framework
          from http://java.sun.com/products/beans/glasgow/jaf.html
  
  
  
  1.6       +3 -2      xml-soap/java/samples/addressbook/AddressBook.java
  
  Index: AddressBook.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/addressbook/AddressBook.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AddressBook.java	2000/07/20 14:38:52	1.5
  +++ AddressBook.java	2001/05/17 21:23:53	1.6
  @@ -59,6 +59,7 @@
   
   import java.util.*;
   import org.w3c.dom.*;
  +import javax.xml.parsers.*;
   import org.apache.soap.util.xml.*;
   
   /**
  @@ -99,8 +100,8 @@
   
     public Element getAllListings()
     {
  -    XMLParserLiaison xpl = new XercesParserLiaison();
  -    Document doc = xpl.createDocument();
  +    DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
  +    Document doc = xdb.newDocument();
       Element bookEl = doc.createElement("AddressBook");
   
       bookEl.appendChild(doc.createTextNode("\n"));
  
  
  
  1.2       +4 -2      xml-soap/java/samples/addressbook/PutListings.java
  
  Index: PutListings.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/addressbook/PutListings.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PutListings.java	2000/06/02 09:42:31	1.1
  +++ PutListings.java	2001/05/17 21:23:53	1.2
  @@ -61,6 +61,8 @@
   import java.util.*;
   import java.net.*;
   import org.w3c.dom.*;
  +import org.xml.sax.*;
  +import javax.xml.parsers.*;
   import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.encoding.*;
  @@ -87,8 +89,8 @@
       // Process the arguments.
       URL url = new URL(args[0]);
       Reader listingsFile = new FileReader(args[1]);
  -    XMLParserLiaison xpl = new XercesParserLiaison();
  -    Document doc = xpl.read("- Listings File -", listingsFile);
  +    DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
  +    Document doc = xdb.parse(new InputSource(listingsFile));
       Element root = doc.getDocumentElement();
   
       // Build the call.
  
  
  
  1.2       +0 -2      xml-soap/java/samples/addressbook2/AddressSerializer.java
  
  Index: AddressSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/addressbook2/AddressSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AddressSerializer.java	2001/03/07 04:56:36	1.1
  +++ AddressSerializer.java	2001/05/17 21:23:58	1.2
  @@ -10,8 +10,6 @@
   
   public class AddressSerializer implements Serializer, Deserializer
   {
  -  private XMLParserLiaison xpl = new XercesParserLiaison();
  -
     public void marshall(String inScopeEncStyle, Class javaType,
     Object src, Object context, Writer sink,
     NSStack nsStack, XMLJavaMappingRegistry xjmr, SOAPContext ctx)
  
  
  
  1.2       +0 -2      xml-soap/java/samples/addressbook2/PhoneSerializer.java
  
  Index: PhoneSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/addressbook2/PhoneSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PhoneSerializer.java	2001/03/07 04:56:36	1.1
  +++ PhoneSerializer.java	2001/05/17 21:23:59	1.2
  @@ -10,8 +10,6 @@
   
   public class PhoneSerializer implements Serializer, Deserializer
   {
  -  private XMLParserLiaison xpl = new XercesParserLiaison();
  -
     public void marshall(String inScopeEncStyle, Class javaType,
     Object src, Object context, Writer sink,
     NSStack nsStack, XMLJavaMappingRegistry xjmr, SOAPContext ctx)
  
  
  
  1.2       +0 -3      xml-soap/java/samples/ejb/ejbtest.java
  
  Index: ejbtest.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/ejb/ejbtest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ejbtest.java	2000/11/07 00:34:57	1.1
  +++ ejbtest.java	2001/05/17 21:24:02	1.2
  @@ -60,13 +60,10 @@
   import java.io.*;
   import java.net.*;
   import java.util.*;
  -import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.rpc.*;
   
   public class ejbtest {
  -  static XMLParserLiaison xpl = new XercesParserLiaison ();
  -
     public static void main (String[] args) throws Exception {
       if (args.length != 1 ) {
         System.err.println ("Usage: java " + ejbtest.class.getName () +
  
  
  
  1.2       +5 -3      xml-soap/java/samples/lemurlabs/Fortune.java
  
  Index: Fortune.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/lemurlabs/Fortune.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Fortune.java	2001/01/20 03:03:39	1.1
  +++ Fortune.java	2001/05/17 21:24:05	1.2
  @@ -61,6 +61,8 @@
   import java.util.*;
   import java.net.*;
   import org.w3c.dom.*;
  +import org.xml.sax.*;
  +import javax.xml.parsers.*;
   import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.encoding.*;
  @@ -178,7 +180,7 @@
                */
               SOAPMappingRegistry smr = call.getSOAPMappingRegistry();
               SOAPContext reqCtx = call.getSOAPContext();
  -            XMLParserLiaison xpl = new XercesParserLiaison();
  +            DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
   
               Envelope callEnv = call.buildEnvelope();
               StringWriter payloadSW = new StringWriter();
  @@ -190,8 +192,8 @@
   
               SOAPContext respCtx = st.getResponseSOAPContext();
               String payloadStr = Call.getEnvelopeString(st);
  -            Document respDoc = xpl.read("- SOAP RPC Response Envelope -",
  -                                        new StringReader(payloadStr));
  +            Document respDoc =
  +              xdb.parse(new InputSource(new StringReader(payloadStr)));
               Element payload = null;
               if (respDoc != null)
               {
  
  
  
  1.4       +6 -4      xml-soap/java/samples/mime/MimeTestClient.java
  
  Index: MimeTestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/mime/MimeTestClient.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MimeTestClient.java	2001/01/08 12:25:10	1.3
  +++ MimeTestClient.java	2001/05/17 21:24:08	1.4
  @@ -60,6 +60,7 @@
   import java.util.*;
   import java.net.*;
   import org.w3c.dom.*;
  +import org.xml.sax.*;
   import org.apache.soap.util.xml.*;
   import org.apache.soap.util.mime.*;
   import org.apache.soap.*;
  @@ -68,8 +69,9 @@
   import org.apache.soap.encoding.soapenc.*;
   import org.apache.soap.rpc.*;
   import org.apache.soap.messaging.*;
  -import javax.mail.internet.*;
   import javax.activation.*;
  +import javax.mail.internet.*;
  +import javax.xml.parsers.*;
   
   /**
    * MIME attachment test client.
  @@ -205,9 +207,9 @@
               xmlmsg += "\n<s:Body>\n<" + args[1] + " xmlns=\"urn:mimetestprocessor\">";
               xmlmsg += attachments;
               xmlmsg += "\n</" + args[1] + "></s:Body></s:Envelope>";
  -            XMLParserLiaison xpl = new XercesParserLiaison();
  -            Document doc = xpl.read("- SOAP Envelope -",
  -                                    new StringReader(xmlmsg));
  +            DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
  +            Document doc =
  +              xdb.parse(new InputSource(new StringReader(xmlmsg)));
               if (doc == null) {
                   System.err.println("Failed to parse XML");
                   return;
  
  
  
  1.2       +0 -3      xml-soap/java/samples/provider/testprovider.java
  
  Index: testprovider.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/provider/testprovider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testprovider.java	2000/11/08 12:58:19	1.1
  +++ testprovider.java	2001/05/17 21:24:10	1.2
  @@ -3,13 +3,10 @@
   import java.io.*;
   import java.net.*;
   import java.util.*;
  -import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.rpc.*;
   
   public class testprovider {
  -  static XMLParserLiaison xpl = new XercesParserLiaison ();
  -
     public static void main (String[] args) throws Exception {
       if (args.length != 1 ) {
         System.err.println ("Usage: java " + testprovider.class.getName () +
  
  
  
  1.6       +0 -3      xml-soap/java/samples/stockquote/GetQuote.java
  
  Index: GetQuote.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/stockquote/GetQuote.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GetQuote.java	2000/08/17 20:35:50	1.5
  +++ GetQuote.java	2001/05/17 21:24:13	1.6
  @@ -60,7 +60,6 @@
   import java.io.*;
   import java.net.*;
   import java.util.*;
  -import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.rpc.*;
   
  @@ -70,8 +69,6 @@
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    */
   public class GetQuote {
  -  static XMLParserLiaison xpl = new XercesParserLiaison ();
  -
     public static void main (String[] args) throws Exception {
       if (args.length != 2
           && (args.length != 3 || !args[0].startsWith ("-"))) {
  
  
  
  1.6       +0 -3      xml-soap/java/samples/stockquote/GetQuoteSMTP.java
  
  Index: GetQuoteSMTP.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/stockquote/GetQuoteSMTP.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GetQuoteSMTP.java	2000/08/17 20:35:50	1.5
  +++ GetQuoteSMTP.java	2001/05/17 21:24:14	1.6
  @@ -60,7 +60,6 @@
   import java.io.*;
   import java.net.*;
   import java.util.*;
  -import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.transport.*;
   import org.apache.soap.transport.smtp.*;
  @@ -75,8 +74,6 @@
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    */
   public class GetQuoteSMTP {
  -  static XMLParserLiaison xpl = new XercesParserLiaison ();
  -
     public static void main (String[] args) throws Exception {
       if (args.length != 7
           && (args.length != 8 || !args[0].startsWith ("-"))) {
  
  
  
  1.6       +4 -2      xml-soap/java/samples/stockquote/StockQuoteService.java
  
  Index: StockQuoteService.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/stockquote/StockQuoteService.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StockQuoteService.java	2000/08/17 20:35:50	1.5
  +++ StockQuoteService.java	2001/05/17 21:24:15	1.6
  @@ -60,6 +60,8 @@
   import java.net.URL;
   import java.io.*;
   import org.w3c.dom.*;
  +import org.xml.sax.*;
  +import javax.xml.parsers.*;
   import org.apache.soap.util.xml.*;
   
   /**
  @@ -68,7 +70,7 @@
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    */
   public class StockQuoteService {
  -  XMLParserLiaison xpl = new XercesParserLiaison ();
  +  DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
   
     public float getQuote (String symbol) throws Exception {
       // get a real (delayed by 20min) stockquote from 
  @@ -76,7 +78,7 @@
       // below came from the host that the above form posts to ..
       URL url = new URL ("http://www.xmltoday.com/examples/stockquote/getxmlquote.vep?s="+symbol);
       InputStream is = url.openStream ();
  -    Document d = xpl.read ("stock quote", new InputStreamReader (is));
  +    Document d = xdb.parse(is);
       Element e = d.getDocumentElement ();
       NodeList nl = e.getElementsByTagName ("price");
       e = (Element) nl.item (0);
  
  
  
  1.2       +0 -3      xml-soap/java/samples/weblogic_ejb/ejbtest.java
  
  Index: ejbtest.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/weblogic_ejb/ejbtest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ejbtest.java	2001/02/13 00:07:57	1.1
  +++ ejbtest.java	2001/05/17 21:24:21	1.2
  @@ -60,7 +60,6 @@
   import java.io.*;
   import java.net.*;
   import java.util.*;
  -import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.rpc.*;
   
  @@ -74,8 +73,6 @@
    * @since 1.0
    */
   public class ejbtest {
  -  static XMLParserLiaison xpl = new XercesParserLiaison ();
  -
       /**
        * Describe <code>main</code> method here.
        *
  
  
  
  1.3       +5 -3      xml-soap/java/samples/xmethods/GetTemp.java
  
  Index: GetTemp.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/samples/xmethods/GetTemp.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GetTemp.java	2001/04/08 14:30:23	1.2
  +++ GetTemp.java	2001/05/17 21:24:24	1.3
  @@ -61,6 +61,8 @@
   import java.util.*;
   import java.net.*;
   import org.w3c.dom.*;
  +import org.xml.sax.*;
  +import javax.xml.parsers.*;
   import org.apache.soap.util.xml.*;
   import org.apache.soap.*;
   import org.apache.soap.encoding.*;
  @@ -187,7 +189,7 @@
                */
               SOAPMappingRegistry smr = call.getSOAPMappingRegistry();
               SOAPContext reqCtx = call.getSOAPContext();
  -            XMLParserLiaison xpl = new XercesParserLiaison();
  +            DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
   
               Envelope callEnv = call.buildEnvelope();
               StringWriter payloadSW = new StringWriter();
  @@ -199,8 +201,8 @@
   
               SOAPContext respCtx = st.getResponseSOAPContext();
               String payloadStr = Call.getEnvelopeString(st);
  -            Document respDoc = xpl.read("- SOAP RPC Response Envelope -",
  -                                        new StringReader(payloadStr));
  +            Document respDoc =
  +              xdb.parse(new InputSource(new StringReader(payloadStr)));
               Element payload = null;
               if (respDoc != null)
               {
  
  
  
  1.8       +0 -5      xml-soap/java/src/org/apache/soap/util/xml/XMISerializer.java
  
  Index: XMISerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/XMISerializer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMISerializer.java	2001/04/22 01:25:58	1.7
  +++ XMISerializer.java	2001/05/17 21:24:27	1.8
  @@ -71,7 +71,6 @@
   public class XMISerializer implements Serializer
   {
     public static int CONV_BSIZE=0x400;
  -  private static XercesParserLiaison xpl = null;
   
     public void marshall(String inScopeEncStyle, Class javaType, Object src,
                          Object context, Writer sink, NSStack nsStack,
  @@ -86,10 +85,6 @@
       // ignoring context
   
       // special case for Strings - otherwise treated as uuids by the serializer
  -
  -    if( xpl == null )
  -      xpl = new  XercesParserLiaison();
  -
       if (src == null)
       {
         sink.write("<null type=\"" + javaType.getName() + "\"/>");
  
  
  
  1.4       +1 -0      xml-soap/java/src/org/apache/soap/util/xml/XMLParserUtils.java
  
  Index: XMLParserUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/XMLParserUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLParserUtils.java	2001/05/17 18:26:15	1.3
  +++ XMLParserUtils.java	2001/05/17 21:24:29	1.4
  @@ -69,6 +69,7 @@
    * Provides methods to set and use JAXP compatible XML parsers.
    *
    * @author Ruth Bergman (ruth@alum.mit.edu)
  + * @author Matthew J. Duftler (duftler@us.ibm.com)
    */
   public class XMLParserUtils {
     private static DocumentBuilderFactory dbf = null;