Michael, you might try something like...
java.lang.String xmlString = getWeather(); SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.setValidating(dtdValidate || xsdValidate); SAXParser saxParser = spf.newSAXParser(); XMLReader xmlReader = saxParser.getXMLReader(); final SAXParseFTSE tHandler = new SAXParseFTSE (Debug); xmlReader.setContentHandler(tHandler); xmlReader.setErrorHandler(tHandler); ByteArrayInputStream bais = new ByteArrayInputStream (xmlString.getBytes()); xmlReader.parse( new InputSource(bais) ); bais.close(); You may have to pre-process your XML string for ampersands and quotes before throwing it at the parser. Rey. ----- Original Message ----- From: [EMAIL PROTECTED] Date: Wed, 18 Jun 2003 13:51:57 -0400 To: [EMAIL PROTECTED] Subject: Handling complex response type > > > > > Hi, > > Through the help of the axis-user mailing list, I've been able to create a > Java client that invokes the Unisys Weather web service and returns the > weather. (I've included a link below.) The method I'm calling, > GetWeatherText, returns all of the weather details, including at ten-day > forecast, as one long string: > > <?xml version="1.0" encoding="utf-8" ?> > <string xmlns="http://www.unisys.com/WebServices/">Weather for Livonia, MI > (48150) at 5 PM EDT 17 JUN 03. Sunrise at 5:56 AM. Sunset at 9:12 PM. > Forecast for TONIGHT is MOSTLY CLOUDY DURING THE EARLY EVENING...THEN > BECOMING PARTLY CLOUDY. SCATTERED SHOWERS WITH AN ISOLATED > THUNDERSTORM...ENDING AROUND 10 PM...FOLLOWED BY AREAS OF FOG DEVELOPING > AFTER 3 AM. LOWS 57 TO 61. LIGHT AND VARIABLE WINDS. CHANCE OF RAIN 30 > PERCENT....</string> > > The Unisys Weather web service has an alternate method, GetWeather, that > returns all of the above data as a complex type object. I've gone ahead > and used WSDL2Java to generate a client stub that I've used to call > GetWeather and then invoke the methods of the response object to in a new > Java application that returns select pieces of the above data to the user. > This all works fine, but I'm a bit concerned about hard-coding what I want > to extract from the returned object. If my users want a piece of weather > data added to or removed from the response they receive, I would need to > update and recompile the Java client code. > > I would prefer being able to process the result using a stylesheet, which > can be updated without recompiling any code. Is there a way that I can > have the xml of the response returned in a Stream, StringBuffer or String > that I could then use Xalan to style in whatever way I choose? > > > Thanks, > > Michael Sobczak > NuTechs, Inc. > 6785 Telegraph Road, Suite 350 > Bloomfield Hills, MI 48301 > pager: (248) 316-6524 > > PS: Unisys Weather web service: > http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?wsdl > -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup CareerBuilder.com has over 400,000 jobs. Be smarter about your job search http://corp.mail.com/careers