|
From: Karthikeyan M. <km...@li...> - 2004-07-27 16:36:49
|
The solution depends on the use case. I used to use regular expressions in combination with the xpath expressions to handle form posts. Supposing that you are getting the information as: <formfieldname> => <field-value> firstname1 => x1 firstname2 => x2 lastname1 => y1 lastname2 => y2 I had a regular expression of the form firstname(\d+) and get the number from it and use it in my "/user/person["+<matched-value>>+"]/firstname" If you have a different use case, then you can use a counter to set the number correct. The translet itself is quite stateless. You need to give it enough information to figure it out that the following sequence all belongs to the same person element: "/user/person/firstname" "/user/person/lastname" "/user/person/ssn" Alternatively, if you getting data bursts, you can have two DOMs and create nodes in the one dom and detach and attach it to the other dom after each pass. In that case you need to have only one set of XPaths without any numbers in it. hope that helps, -karthik Manoj K Jain wrote: >Hi Karthikeyan > > I am facing a problem inserting repeated nodes in the xml using >XPATH, I just want to ask that whether I can use xpath to create >repeated nodes in the XML file without mentioning the number with the >repeating node in the XPATH as our xml is dynamic and it can contain >repeated any number of times . Could you please give me some information >on this. > >Regards, >Manoj Jain > > >-----Original Message----- >From: Karthikeyan M. [mailto:km...@li...] >Sent: Saturday, July 17, 2004 12:21 AM >To: Manoj K Jain >Cc: tra...@li... >Subject: Re: Query > >Hi Manoj, > > Seems like the version of xalan you have may be different. Can you >please tell me the version of the xalan that you are using? >-karthik >--- Manoj K Jain <man...@in...> wrote: > > Hi > > > > I was just testing your code but I faced this problem > > > > >Exception in thread "main" java.lang.NoSuchMethodError > > at > > org.translet.processor.XPathProcessorImpl.processXPath(XPathProcessor > > Impl.java:69) > > at > > org.translet.processor.Translator.translate(Translator.java:127) > > at > > DataTranslator.translate(DataTranslator.java:41) > > at DataTranslator.main(DataTranslator.java:52) > > > > > > Could you please give me the possible solution of this > problem.. > > > > > > Regards, > > Manoj > > > > > > |