One last question: Is it possible, to do the selection directly with XPath... What i am doing now, is something like this: -create a copy of the document -create a List with selectNodes() -method which contains for example the nodes Year -iterate through this list and check with if and getText() if the <Year>-tag contains 1982. if not, remove the parent tag <Book>
But this seems not very elegant. So is it possible to get a list, which only contains the <year> tags which contain 1982 directly per xpath or do i have to do the if-checks? > > >>> > > >>>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 > > > > ------------------------------------------------------- > > 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