This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xpath question
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] xpath question
- From: "Robert Koberg" <rob at koberg dot com>
- Date: Fri, 27 Jul 2001 04:14:29 -0700
- References: <002701c1167a$553c7050$0100007f@PCUKMKA>
- Reply-To: xsl-list at lists dot mulberrytech dot com
I think he is talking about:
import org.apache.xpath.XPathAPI;
The code is very different. Here are the basics:
try {
// bring in an XML file with an uri, InputStream or ???
InputSource in = new InputSource(this_config);
DocumentBuilderFactory dfactory =
DocumentBuilderFactory.newInstance();
//dfactory.setNamespaceAware(true);
Document doc = dfactory.newDocumentBuilder().parse(in);
Node site_root = XPathAPI.selectSingleNode(doc,
"/config/folder");
// custom method to work on the node matched
matchFolder(context, site_root);
doc = null;
} catch (Exception e) {
System.out.println(e);
}
----- Original Message -----
From: "Michael Kay" <mhkay@iclway.co.uk>
To: <xsl-list@lists.mulberrytech.com>
Sent: Friday, July 27, 2001 1:21 AM
Subject: RE: [xsl] xpath question
> > >Hi list,
> > > I want to view & update the node of a dom tree
> > using xpath api and
> > >i have a problem the below code gives me a null value.
>
> What XPath API?
> You get a null value when you call a method on a class called "get".
> This class isn't part of any standard I know of (and it's a very odd name
> for a Java class). Find out who wrote it and complain to them.
>
> Mike Kay
> Software AG
>
>
> > >public static void main(String[] args)
> > > {
> > > try{
> > > get gt=new get();
> > > DOMParser parser = new DOMParser();
> > > parser.parse("add.xml");
> > > org.w3c.dom.Document doc = parser.getDocument();
> > > Node res=gt.findAddress("Earl Spencer",doc);
> > > System.out.println(res.getNodeValue());
> > > }
> > > catch(Exception e){}
> > > }
> > >
> > > Forgive me if i have done any thing wrong cause i am
> > using XPATH and
> > >DOM api's for the first time i am using xalan-1.2.2 to do this.
> > > I actually want to update a node value using an xpath
> > >expression.
> > >
> > >Thanks in Advance
> > >Spencer
> > >
> >
> > --
> > ======================================================================
> > B. Tommie Usdin mailto:btusdin@mulberrytech.com
> > Mulberry Technologies, Inc.
> > http://www.mulberrytech.com
> > 17 West Jefferson Street Phone: 301/315-9631
> > Suite 207 Direct Line: 301/315-9634
> > Rockville, MD 20850 Fax: 301/315-8285
> > ----------------------------------------------------------------------
> > Mulberry Technologies: A Consultancy Specializing in SGML
> > and XML
> > ======================================================================
> >
> > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list