Subject: Re: [xsl] reading xml data into a java program From: Mike Brown <mike@xxxxxxxx> Date: Wed, 31 Jul 2002 15:55:33 -0600 (MDT) |
Brian Hickey wrote: > Hello all > > I haven't used java before to manipulate, or even read > from an xml file, but I need to do this now. I would > appreciate if someone could tell me how I should go > about this, point me to good links that demonstrate > this, or maybe send me some sample code that would get > me up and running. > I know I need to install a suitable parser also, like > xerces, or xalan, but I'm not sure which one is the > best. Xerces is an XML parser. A parser reads an XML file or stream and reports to an application what the important parts of its contents are. It does this via SAX (event-based; the application provides methods to handle each item in the XML; takes some getting used to) or DOM (the parser creates a memory-intensive document object that models a node tree, where each node has methods and attributes that the application can use to learn about, and sometimes manipulate, the important parts of the XML contents; this is an easier API for programmers but very inefficient for large documents). You should get the JAXP (Java API for XML Processing) spec from sun.com; it will help quite a bit. Most Java based XML parsers these days implement JAXP, and come with additional sample code. Xalan is an XSLT processor, an application that gets its input from an XML parser. Saxon is another good one in Java, and for many is the reference standard. Saxon comes with its own XML parser (a modified version of an old one called Aelfred) which is rather helpful. Both Xalan and Saxon come with sample code and demos. A Google search for java xml tutorial will get you going, as well. You can get by without knowing a lick about XML parsing, though, if everything you need to do can be taken care of within XSLT. For this I would recommend using a command-line tool like Instant Saxon or just running 'java com.icl.saxon.StyleSheet' after making sure the saxon.jar and its parent directory are in your classpath. You just give it the additional arguments of the XML input and XSLT stylesheet and out plops your output. Once your stylesheet works, you can worry about invoking the transformation from code using JAXP interfaces. - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] reading xml data into a j, James Fuller | Thread | [xsl] Expression Logic Problem, Renick, Garrel |
Re: [xsl] Expression Logic Problem, Joerg Heinicke | Date | Re: [xsl] Expression Logic Problem, Robert S. Koberg |
Month |