Re: inserting spaces between nodes in XML::XPath
"Jenda Krynicky" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
From: Walter Lewis <[email protected]> > I have a need to pass data from an XML document to an index engine. I'm > using XML::XPath. > > The call is in the form (where $div is populated with a get_nodelist): > my $fulltext = $div->string_value; > > This works generally well. The challenge comes from: > <div> > bunch of stuff > <table> > <row> > <cell>text</cell><cell>text</cell> > </row> > </table> > more stuff > </div> > with the table contents returning as texttext. > > Given that I don't want to manipulate all the tables in all the > documents that may ever be touched by this transformation, what are my > options for wrapping white-space around the contents of the <cell> > elements to keep them from blending into the next value? You might instead use XML::Rules to transform the XML into plain text. You may specify that the default rule is to wrap the content with whitespace and merge it into the content of the parent tag. And then specify different rules for some tags. Jenda ===== [email protected] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs