home
NEWS       BLOGS       FORUMS       NEWSLETTERS       RESEARCH       EVENTS       DIGITAL LIBRARY       CAREERS  
Network Computing Network Computing Powered by InformationWeek Business Technology Network

IMMERSE YOURSELF:

SOA

  |

Data Center

  |

802.11n

  |

Data Privacy

  |
APO  |

Virtualization

  |

NAC

  |

Security

  |

Network Mgmt

  |

Enterprise Apps

  |

Storage & Servers



Netdesign Manual

Part 3

Java XML Programmers Reference

Chapter 11: XML Tools for Information Appliances


October 8, 2001


Brought to you by:





Check It Out!

WML TroubleTicketViewer Application

Our last step is to build an application that uses the translet and source XML to generate WML.

You should be able to compile this code with the ant build.xml file available at the Wrox Press web site along with all source code (see Appendix A). Some of this code we've already seen.

import org.apache.xalan.xsltc.*;
import org.apache.xalan.xsltc.dom.DOMImpl;
import org.apache.xalan.xsltc.runtime.TextOutput;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import java.io.FileReader;
public class TroubleTicketViewer {
public TroubleTicketViewer(String inputfile)
throws Exception { //load and create the translet Class cls = Class.forName("TroubleTicket"); Translet xlet = (Translet)cls.newInstance(); DOMImpl dom = new DOMImpl(); //will contain the parsed source XML //create SAX 2.0 parser & get the XMLReader
uses object it SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); //Set the DOM's builder as the XMLReader's SAX 2.0
content handler reader.setContentHandler(dom.getBuilder()); //parse reader.parse(new InputSource(new FileReader(inputfile)));
Now that we've parsed the source XML and have it in DOM, let's tell the translet to do the translation. We'll have the translet put the translated document into another DOMImpl object, wmlDOM, although we could have passed it a SAX 1.0 handler to receive callbacks instead.

DOMImpl wmlDOM = new DOMImpl(); //implements

sax.DocumentHandler

TextOutput txtOutput; //implements

TransletOutputHandler

txtOutput = new TextOutput(wmlDOM.getBuilder());

//pass the translet the source XML and a handler

xlet.transform(dom, txtOutput);



Finally, let's output the WML to stdout:

wmlDOM.print(1, 1); //print the root and its children

}

public static void main(String[] args) throws Exception

{

TroubleTicketViewer ttv = new

TroubleTicketViewer(args[0]);

}

}

Run the application:

> java TroubleTicketViewer TroubleTicket.xml



You should get this WML output. It's not pretty, but it's what we expect:

<wml><card

title="Ticket:T746284"

id="T746284"><p><b>Installation failed</b>

<br></br>

<br></br>

Int'l Steel<br></br>

Ann McKinsey<br></br>

303-781-7777<br></br>

SteelPlant2001</p>

</card>

</wml>

The Future

As XSLTC begins to benefit from the open source development cycle at Apache, expect new initiatives for transformation in the information appliance arena. Translets are ideally placed to foster a viable peer-to-peer environment on small devices, bringing with them the power of universal transformation to the growing support for XML on these appliances. Keep an eye on the xalan-dev@xml.apache.org mailing list!

SOAP On Lightweight Clients

The potential for SOAP on lightweight clients is big. SOAP is notoriously slow and resource-intensive compared to RPC, CORBA, and JNI calls, but with more powerful information appliances becoming available each day, this hopefully won't be an issue soon. Simple and relatively infrequent calls, such as requests for weather or stock data from HTTP SOAP servers, are certainly feasible with today's information appliances.

There are currently two lightweight Java SOAP libraries that are worth mentioning:

  • KVM kSOAP


  • nanoSOAP, implementing only SOAP 1.0 and, unfortunately, no longer supported


Coming Up Next: Setting Up the Environment


PAGE: 1 | 2 | 3 | 4 | 5 | 6 | FIRST PAGE
 





Ready to take that job and shove it?

Function:

Keyword(s):

State:
SPONSOR
RECENT JOB POSTINGS
CAREER NEWS
Go beyond Google and get vertical. These specialized search sites will help you find the business information you need -- fast.

Ari Balogh was named to the post of chief technology officer as the companys for a "realignment" of employees.










InformationWeek U.S. IT Salary Survey 2008
Salaries for business technology professionals are falling. Here's what you need to know in order to make good hiring decisions and personal career choices. Download Today
 
ROLLING RIGHT ALONG
Follow key Network Computing Reviews from conception to completion. This Week: Holistic APM.



Network Computing Reports Emerging Enterprise Podcast Series: Secrets to Success








TechSearch


Microsite of the Week


Powerful Information at Your Fingertips



InformationWeek Business Technology Network
InformationWeekInformationWeek 500InformationWeek 500 ConferenceInformationWeek AnalyticsInformationWeek CIO
InformationWeek EventsInformationWeek ReportsInformationWeek MagazinebMightyByte and SwitchDark Reading
Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingNo JitterPlug Into The Cloud
space
Techweb Events Network
InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0 ConferenceMobile Business ExpoSoftware ConferenceCSI - Computer Security Institute
Black HatGTECEnergy CampMashup CampStartup Camp
space
Light Reading Communications Network
Light ReadingLight Reading EuropeUnstrungLight Reading's Cable Digital NewsConstantinopleInternet EvolutionPyramid Research
Heavy ReadingLight Reading Live!Light Reading InsiderEthernet ExpoOptical ExpoTeleco TVTower Technology Summit
space
Financial Technology Network
Advanced TradingBank Systems & TechnologyInsurance & TechnologyWall Street & TechnologyAccelerating Wall StreetBank Systems & Technology Executive SummitBuyside Trading SummitInsurance & Technology Executive Summit
space
Microsoft Technology Network
MSDN MagazineTechNetThe Architecture Journal
space


App Infrastructure   |   Messaging & Collaboration   |   Network & Systems Mgmt   |   Network Infrastructure   |   Security  |   Storage & Servers   |   Wireless   |   Enterprise Apps
About Us  |  Contact Us  |  Site Map  |  Technology Marketing Solutions  |  Advertising Contacts  |   Briefing Centers
Copyright © 2008  United Business Media LLC  |  Privacy Statement  |  Terms of Service  |  Your California Privacy Rights