Am Sonntag, 12. Dezember 2004 20:57 schrieb Maarten Coene: Hi Maarten, the problem is, that the selectNodes method returns a list, which doesn't represent the treestructure of the xml document. So i cannot copy a ceartain parent node, when the child nodes are matching the request, and insert it and all its childnodes into a new document. Or am i wrong?
> Hi Johannes, > > perhaps you could write an XPath query that selects the elements you > want, copy the query-result and add that copy to a new document. > > regards, > Maarten > > Johannes Franz schreef: > >Hi there, > >i would like to write a program which searches for example the infile > > below for all Year Tags which contain 1982 and author tags which contain > > Blablub.. Then it should create a new xmlfile outfile and write all > > booknodes with the matching childnodes into this file, which contains the > > same treestructure. To explain, what i mean i added a small example, what > > i have in mind. My question is: Do you think it is an good idea to do > > this with the dom4j library? Perhaps you have tipps, how i should tackle > > this problem. > > > >java program -parentnode /Catalog/book -seachnodes > > Year:1982,Author:Blablub -in infile.xml -out outfilefile.xml > > > > > >infile.xml > ><Catalog> > > <Book> > > <Year>1982</Year> > > <Author>Blablub</Author> > > </Book> > > > > <Book> > > <Year>1985</Year> > > <Author>Blablub</Author> > > </Book> > > > > <Book> > > <Year>1982</Year> > > <Author>Blablub</Author> > > </Book> > > > > <Book> > > <Year>1982</Year> > > <Author>BlubBlab</Author> > > </Book> > ></Catalog> > > > >outfile.xml > ><Catalog> > > <Book> > > <Year>1982</Year> > > <Author>Blablub</Author> > > </Book> > > > > <Book> > > <Year>1982</Year> > > <Author>Blablub</Author> > > </Book> > ></Catalog> > > > > > >------------------------------------------------------- > >SF email is sponsored by - The IT Product Guide > >Read honest & candid reviews on hundreds of IT Products from real users. > >Discover which products truly live up to the hype. Start reading now. > >http://productguide.itmanagersjournal.com/ > >_______________________________________________ > >dom4j-user mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/dom4j-user > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user