List Info

Thread: XML::XPath and removing a node/leaf




XML::XPath and removing a node/leaf
user name
2006-01-13 14:18:12
Hi there,
I have been looking through the perldoc for XML::XPath to
see how toremove a node but there seems to be no method te
do this. Does anyonehave a recipe for how to do this, or a
link to somewhere thatdescribes how to?Google is not being
very helpful on the matter... :-/
TIA,
--Anders Karlsson <trudheimgmail.com>
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
XML::XPath and removing a node/leaf
user name
2006-01-15 09:30:32
You might look for XML:OM::XPat
h in CPAN. You can use DOM for 
adding/removing elements and xpath for fetching them.


>From: Anders Karlsson <trudheimgmail.com>
>To: perl-xmllistserv.ActiveState.com
>Subject: XML::XPath and removing a node/leaf
>Date: Fri, 13 Jan 2006 14:18:12 +0000
>
>Hi there,
>I have been looking through the perldoc for XML::XPath
to see how toremove 
>a node but there seems to be no method te do this. Does
anyonehave a recipe 
>for how to do this, or a link to somewhere thatdescribes
how to?Google is 
>not being very helpful on the matter... :-/
>TIA,
>--Anders Karlsson <trudheimgmail.com>
>_______________________________________________
>Perl-XML mailing list
>Perl-XMLlistserv.ActiveState.com
>To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
XML::XPath and removing a node/leaf
user name
2006-01-15 12:09:06
Hi Anders,

* Anders Karlsson <trudheimgmail.com> [2006-01-13
15:45]:
>I have been looking through the perldoc for XML::XPath
to see
>how toremove a node but there seems to be no method te
do this.
>Does anyonehave a recipe for how to do this, or a link
to
>somewhere thatdescribes how to?Google is not being very
helpful
>on the matter... :-/ TIA,

you can’t do that with XPath. XPath is purely for locating
(sets
of) nodes. You need a supporting API to *do* something with
the
nodes. In general, using XPath implies using the DOM
(wretched as
it is) to manipulate the tree.

I suggest XML::LibXML – it’s based on libxml2, which is
very
complete in its standards support, is blazing fast, and has
small
memory footprint. No pure-Perl module can hold a candle to
it.
And the Perl bindings are perlish, inasmuch as any DOM API
can be
perlish.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/&g
t;
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
XML::XPath and removing a node/leaf
user name
2006-01-16 11:27:34
Hiya,

> Hi Anders,
>
> * Anders Karlsson <trudheimgmail.com> [2006-01-13
15:45]:
> >I have been looking through the perldoc for
XML::XPath to see
> >how toremove a node but there seems to be no method
te do this.
> >Does anyonehave a recipe for how to do this, or a
link to
> >somewhere thatdescribes how to?Google is not being
very helpful
> >on the matter... :-/ TIA,
>
> you cant do that with XPath. XPath is purely for
locating (sets
> of) nodes. You need a supporting API to *do* something
with the
> nodes. In general, using XPath implies using the DOM
(wretched as
> it is) to manipulate the tree.

I was looking for the same thing recently, and found some
undocumented
methods in the tests. I.e.

removeChild( $node )
removeAttribute( $attrName )

c.f. http://search.cpan.org/src/MSERGEANT/XML-XPath-1.1
3/t/remove.t

There is a lot of support in XML::XPath for creating and
appending nodes,
which is probably why I expected to find removal there too.
Next time
however, in light of these comments that seem in retrospect
correct, I 
think I'll look elsewhere.

Regards,
David
_______________________________________________
Perl-XML mailing list
Perl-XMLlistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )