/**
    * This presumes that o is a Castor generated value object.
    */
  private Node getDom(Object o) throws MarshalException, ValidationException  {
      Document doc = new org.apache.xerces.dom.DocumentImpl();
      Element ele = doc.createElement("tempEle");
      doc.insertBefore(ele,null);
     
      Marshaller m = new Marshaller((Node)ele);
      m.marshal(o);
      return (Node)ele;
  }
-----Original Message-----
From: Pillai, Girish [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 10:38 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] XPath usage

Hi Erik,
 
You mentioned that I could marshall a Castor generated object into DOM.
How do you do that - could you provide a few lines of code or pointers - greatly appreciated.
 
-girish.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 11, 2002 11:02 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] XPath usage

XPath only works on java if you use a tool -- like JXPath at http://jakarta.apache.org/commons/jxpath/.
I haven't seen people on this maillist talk about this.
 
You can always marshal a Castor generated object to DOM and then use XPath on node.
 
You wrote:
>> Currently out of the generated classes, I do a small method call which incloves a string-walkthrough to get to the
>>actual target, and then do subsequent processing.
 
would you elaborate a bit? 
-----Original Message-----
From: Pillai, Girish [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 11, 2002 10:39 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] XPath usage

Is there a way to elegently get to the targets defined by an XPath in the schema? Does Castor directly support
XPath linkages like DOM? Also if some one could point to code sinppets that illustrate XPath target extraction out
of Castor generated Java classes that would be really cool. I searched all of Castor web site and in google but could
not find any for XPath usage in castor.
 
Currently out of the generated classes, I do a small method call which incloves a string-walkthrough to get to the
actual target, and then do subsequent processing.
 
Thanks,
Girish.
 

Reply via email to