[ "" ] [ "<foo/>" string>xml children>string ] unit-test
+[ "bar qux" ] [ "<foo>bar <baz>qux</baz></foo>" string>xml deep-children>string ] unit-test
+
[ "blah" ] [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tag-named "attr" attr ] unit-test
[ { "blah" } ] [ "<foo attr='blah'/>" string>xml-chunk "foo" deep-tags-named [ "attr" attr ] map ] unit-test
! Copyright (C) 2005, 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel namespaces sequences words io assocs
-quotations strings parser lexer arrays xml.data
+quotations strings parser lexer arrays xml.data make
splitting vectors sequences.deep combinators fry memoize ;
IN: xml.traversal
[ concat ]
} cond ;
+: deep-children>string ( tag -- string )
+ children>> [
+ [ dup tag? [ deep-children>string ] when % ] each
+ ] "" make ;
+
: children-tags ( tag -- sequence )
children>> [ tag? ] filter ;