Class FilterTagChildrenVisitor<T>


  • public class FilterTagChildrenVisitor<T>
    extends XmlVisitor<T>
    Filter the children to only those matching the supplied predicate.
    • Field Detail

      • childTest

        public java.util.function.Predicate<Content> childTest
    • Constructor Detail

      • FilterTagChildrenVisitor

        public FilterTagChildrenVisitor()
    • Method Detail

      • filterChildren

        public static Xml.Tag filterChildren​(Xml.Tag parent,
                                             java.util.function.Predicate<Content> childTest)
        Filter the children of a tag to only those that match the supplied predicate.
        Parameters:
        parent - the tag whose direct child elements are to be filtered by 'childTest'
        childTest - the predicate used to evaluate the direct child elements of 'parent'.
        Returns:
        'parent' with its children that matched 'childTest'
      • filterChildren

        public static Xml.Tag filterChildren​(Xml.Tag parentScope,
                                             Xml.Tag parent,
                                             java.util.function.Predicate<Content> childTest)
        Filter the children of a tag to only those that match the supplied predicate.
        Parameters:
        parentScope - a tag which contains 'parent' as a direct or transitive child element.
        parent - the tag whose direct child elements are to be filtered by 'childTest'
        childTest - the predicate used to evaluate the direct child elements of 'parent'.
        Returns:
        'parentScope` which somewhere contains 'parent' with its children that matched 'childTest'
      • filterTagChildren

        public static Xml.Tag filterTagChildren​(Xml.Tag parent,
                                                java.util.function.Predicate<Xml.Tag> childTest)
        Filter the children of a tag to only those that match the supplied predicate. Non-tag children, such as comments, are untouched.
        Parameters:
        parent - the tag whose direct child elements are to be filtered by 'childTest'
        childTest - the predicate used to evaluate the direct child elements of 'parent'.
        Returns:
        'parent' with its children that matched 'childTest'
      • filterTagChildren

        public static Xml.Tag filterTagChildren​(Xml.Tag parentScope,
                                                Xml.Tag parent,
                                                java.util.function.Predicate<Xml.Tag> childTest)
        Filter the children of a tag to only those that match the supplied predicate. Non-tag children, such as comments, are untouched.
        Parameters:
        parentScope - a tag which contains 'parent' as a direct or transitive child element.
        parent - the tag whose direct child elements are to be filtered by 'childTest'
        childTest - the predicate used to evaluate the direct child elements of 'parent'.
        Returns:
        'parentScope` which somewhere contains 'parent' with its children that matched 'childTest'