libxml Validation
Port build from safelibs/port-libxml at commit 72bce85d9642 (release build-72bce85d9642)
Tests
Python libxml2 binding smoke Original / libxml / python-binding-smoke Passed
libxml reader C API behavior Original / libxml / reader-c-api-behavior Passed
Schema and XInclude checks Original / libxml / schema-xinclude-checks Passed
xmlcatalog lookup behavior Original / libxml / xmlcatalog-lookup Passed
xmllint parse and format Original / libxml / xmllint-parse-format Passed
lxml attrib items list Original / libxml / usage-python3-lxml-attrib-items-list Passed
Iterates the attribute mapping with python3-lxml's attrib.items and verifies the emitted attribute name-value pairs.
lxml attribute set Original / libxml / usage-python3-lxml-attribute-set Passed
lxml attribute update Original / libxml / usage-python3-lxml-attribute-update Passed
Updates an XML attribute through lxml and verifies the serialized output contains the new attribute value.
lxml BytesIO parse Original / libxml / usage-python3-lxml-bytesio-parse Passed
lxml C14N exclusive canonicalization Original / libxml / usage-python3-lxml-c14n-exclusive Passed
Canonicalizes XML through lxml etree.canonicalize with exclusive=True and verifies that unused namespace declarations are stripped from the canonical form while the in-scope namespace remains.
lxml canonicalize c14n Original / libxml / usage-python3-lxml-canonicalize-c14n Passed
Canonicalizes XML with python3-lxml's etree.canonicalize and verifies the attributes are reordered alphabetically.
lxml CDATA node Original / libxml / usage-python3-lxml-cdata-node Passed
lxml CDATA serialize Original / libxml / usage-python3-lxml-cdata-serialize Passed
lxml cleanup_namespaces with keep_ns_prefixes Original / libxml / usage-python3-lxml-cleanup-namespaces-keep-prefixes Passed
Calls etree.cleanup_namespaces in-place with the keep_ns_prefixes argument to retain a specified unused namespace declaration on the root, while still pruning a different unused declaration. Verifies the post-cleanup serialization keeps the kept prefix and drops the other.
lxml cleanup_namespaces removes unused namespaces Original / libxml / usage-python3-lxml-cleanup-namespaces Passed
Builds an XML tree with several namespace declarations on the root, only one of which is actually used by a child, then runs etree.cleanup_namespaces and verifies the unused declarations are stripped from the serialized output while the used namespace is preserved.
lxml etree.Comment insertion at index Original / libxml / usage-python3-lxml-comment-insert-position Passed
Creates a Comment node through etree.Comment(text), inserts it at a specific child index of a parent element using insert(), and verifies the serialized tree places the comment exactly between the targeted siblings without disturbing surrounding nodes.
lxml comment node Original / libxml / usage-python3-lxml-comment-node Passed
Creates an XML comment node through lxml and verifies the serialized output preserves the comment text.
lxml CSSSelector deep nested Original / libxml / usage-python3-lxml-cssselect-deep-nested Passed
Builds a CSSSelector and matches deeply nested elements through descendant selectors, verifying the exact match count and text values returned for a multi-level XML tree.
lxml custom URI resolver for entity Original / libxml / usage-python3-lxml-custom-resolver-r7 Passed
Registers a Resolver subclass on an etree.XMLParser that intercepts an external entity reference using a custom URI scheme and supplies in-memory replacement bytes via resolver.resolve_string(), then parses a document declaring that entity and verifies the parsed text matches the resolver's reply, exercising the libxml2 external entity loader hook.
lxml deepcopy text Original / libxml / usage-python3-lxml-deepcopy-text Passed
Deep-copies an XML tree with python3-lxml and verifies that mutating the clone leaves the original element text intact.
lxml DTD validation Original / libxml / usage-python3-lxml-dtd-validate Passed
lxml PythonElementClassLookup custom class Original / libxml / usage-python3-lxml-element-class-lookup Passed
Registers an etree.PythonElementClassLookup subclass on an XMLParser that returns a custom Element subclass for a specific tag, parses a document with the parser, and verifies the chosen elements are instances of the custom class while siblings remain plain etree elements.
lxml element maker Original / libxml / usage-python3-lxml-element-maker Passed
lxml etree.Element and SubElement programmatic build Original / libxml / usage-python3-lxml-element-subelement-build Passed
Builds an XML tree programmatically with lxml.etree.Element and SubElement, sets attributes via the constructor and the .set API, and verifies the serialized form, child count, and attribute ordering as exposed by lxml.
lxml ElementInclude include resolution Original / libxml / usage-python3-lxml-elementinclude-include Passed
Stages a parent XML document with an xi:include referencing a sibling fragment, resolves the include through lxml.ElementInclude.include rather than tree.xinclude(), and verifies that the included element appears in the resolved tree with its text and attributes preserved.
lxml ElementPath findall count Original / libxml / usage-python3-lxml-elementpath-findall-count Passed
Uses lxml ElementPath findall on a tree and verifies the exact element count and the joined text values returned by find/findtext on the same path.
lxml elementpath findtext Original / libxml / usage-python3-lxml-elementpath-findtext Passed
python3-lxml fromstring attribute Original / libxml / usage-python3-lxml-fromstring-attribute Passed
lxml fromstring bytes Original / libxml / usage-python3-lxml-fromstring-bytes Passed
lxml fromstring with custom XMLParser settings Original / libxml / usage-python3-lxml-fromstring-custom-parser Passed
Parses XML through etree.fromstring using a custom XMLParser configured with remove_blank_text and remove_comments and verifies that whitespace-only text nodes and comments are stripped from the resulting tree.
lxml Element.getparent traversal up to root Original / libxml / usage-python3-lxml-getparent-chain-r8 Passed
Looks up a deeply nested element via XPath and walks Element.getparent() repeatedly to recover the full ancestor tag chain ending at the root, verifying the exact ordered tag sequence including a namespaced ancestor.
lxml getpath second item Original / libxml / usage-python3-lxml-getpath-second-item Passed
Locates the second item through python3-lxml and verifies that ElementTree.getpath reports the expected absolute path.
lxml getroottree tag Original / libxml / usage-python3-lxml-getroottree-tag Passed
Walks back to the document root with python3-lxml's getroottree and verifies the root element tag name.
lxml.html HtmlElement cssselect Original / libxml / usage-python3-lxml-html-cssselect Passed
Parses HTML with lxml.html and uses HtmlElement.cssselect to pick elements by tag and class, verifying the exact list of matched text content from a small fixture.
lxml html.fromstring body access Original / libxml / usage-python3-lxml-html-fromstring-body Passed
Parses an HTML fragment with lxml.html.fromstring, accesses the implicitly-created body element via the .body attribute, and verifies the tag, child count, and selected text content of the parsed document.
lxml html.fromstring head access Original / libxml / usage-python3-lxml-html-fromstring-head Passed
Parses an HTML document with lxml.html.fromstring, accesses the .head attribute on the resulting document, and verifies the head's tag name, child element tags, and the title text content extracted via the head subelement.
lxml HTML parse Original / libxml / usage-python3-lxml-html-parse Passed
lxml HTMLParser recover Original / libxml / usage-python3-lxml-htmlparser-recover Passed
Parses malformed HTML with lxml.etree.HTMLParser in recovery mode and verifies the recovered tree contains the expected tag set with exact element counts.
lxml HTMLParser table structure Original / libxml / usage-python3-lxml-htmlparser-table Passed
Parses an HTML fragment containing a table with a thead and tbody through lxml.etree.HTMLParser, then verifies that the parser auto-completes the document structure and that the row, cell, and text counts in the resulting tree match the input layout.
lxml parser huge_tree toggle Original / libxml / usage-python3-lxml-huge-tree-disabled-r7 Passed
Builds an XML document with deeply nested elements that would exceed libxml2's default parser limits, parses it once with huge_tree=False to confirm normal-depth content is accepted, then parses with huge_tree=True to confirm the toggle is plumbed through to libxml2 by accepting the same content without raising.
python3-lxml item id join Original / libxml / usage-python3-lxml-item-id-join Passed
lxml etree.iter with multiple tag filter Original / libxml / usage-python3-lxml-iter-multi-tags Passed
Builds a mixed XML tree containing item, note, and meta elements, then calls Element.iter with a tuple of tag names and verifies the returned iterator yields elements of exactly the requested kinds in document order while skipping unrelated tags.
lxml iterancestors traversal Original / libxml / usage-python3-lxml-iterancestors-chain Passed
Builds a four-level nested XML tree, locates the deepest element via XPath, and walks up the ancestor chain through Element.iterancestors verifying both the unfiltered ancestor sequence and a tag-filtered traversal that yields only matching ancestors in upward order.
lxml iterfind count Original / libxml / usage-python3-lxml-iterfind-count Passed
lxml iterparse start and end events Original / libxml / usage-python3-lxml-iterparse-start-end-events Passed
Parses XML via lxml.etree.iterparse subscribed to both start and end events and verifies the exact ordered event stream of (event,tag) tuples produced for a small fixture.
lxml iterparse tag filter with element clear Original / libxml / usage-python3-lxml-iterparse-tag-filter-r8 Passed
Drives lxml.etree.iterparse with a tag= filter that selects only end events for <item>, calls Element.clear() after each match to release children, and verifies the collected id attributes plus that the root retains zero children after the streaming pass.
lxml iterparse Original / libxml / usage-python3-lxml-iterparse Passed
lxml itertext join Original / libxml / usage-python3-lxml-itertext-join Passed
python3-lxml itertext Original / libxml / usage-python3-lxml-itertext Passed
lxml iterwalk start and end events Original / libxml / usage-python3-lxml-iterwalk-events Passed
Walks an in-memory etree with etree.iterwalk subscribing to start and end events, collects the ordered sequence of (event, tag) pairs, and verifies the expected nesting order including a nested element appearing between its parent's start and end events.
lxml iterwalk with tag filter Original / libxml / usage-python3-lxml-iterwalk-tag-filter Passed
Walks an etree with etree.iterwalk filtered to a specific tag, verifies the iterator yields only elements with that tag in document order, and confirms elements with other tag names are skipped.
lxml Element.makeelement with namespace map Original / libxml / usage-python3-lxml-makeelement-namespaced-r8 Passed
Creates a child element via Element.makeelement using an explicit nsmap that introduces a new prefix, attaches it to a root carrying a different default namespace, and verifies the serialized output emits both prefix declarations and uses Clark notation for the new element's tag in element.tag readout.
lxml namespaced attribute Original / libxml / usage-python3-lxml-namespace-attribute Passed
lxml namespace XPath Original / libxml / usage-python3-lxml-namespace-xpath Passed
lxml namespace map lookup Original / libxml / usage-python3-lxml-nsmap-lookup Passed
Runs a namespace-aware lookup through python3-lxml and verifies the selected namespaced text node.
lxml objectify array-like children access Original / libxml / usage-python3-lxml-objectify-array-children Passed
Reads an XML document through lxml.objectify and verifies the array-like access pattern over repeated children, including indexed access, len() of a repeated element, and iteration order across all siblings sharing a tag.
lxml objectify attribute Original / libxml / usage-python3-lxml-objectify-attribute-batch11 Passed
lxml etree.parse with no_network parser Original / libxml / usage-python3-lxml-parse-no-network Passed
Parses an on-disk XML file via etree.parse using an XMLParser configured with no_network=True, asserts the parser's no_network flag is honored, and verifies the resulting tree has the expected root tag and child count without making any network access.
lxml etree.parse with recover=True from file Original / libxml / usage-python3-lxml-parse-recover-from-file Passed
Writes a tiny malformed XML document to disk, parses it through etree.parse using an XMLParser configured with recover=True, and verifies the recovered tree exposes the partial content without raising while the parser's error_log records the recovered errors.
lxml parse UTF-8 non-ASCII payload Original / libxml / usage-python3-lxml-parse-utf8-non-ascii Passed
Parses an XML document containing non-ASCII UTF-8 text (Greek, Cyrillic, and CJK characters) and an XML declaration encoding=UTF-8 through lxml.etree.parse, then verifies that text content round-trips byte-for-byte and the XPath string() of each element returns the expected non-ASCII payload.
python3-lxml parse xml Original / libxml / usage-python3-lxml-parse-xml Passed
lxml etree.PI factory and insertion Original / libxml / usage-python3-lxml-pi-factory-insertion Passed
Creates a processing instruction node through the etree.PI(target, text) factory, inserts it as the first child of an element via insert(), and verifies the serialized output places the PI at the expected position with the correct target and content.
lxml pretty print Original / libxml / usage-python3-lxml-pretty-print Passed
lxml processing instruction Original / libxml / usage-python3-lxml-processing-instruction-batch11 Passed
lxml QName localname Original / libxml / usage-python3-lxml-qname-localname Passed
lxml QName tag access via element creation Original / libxml / usage-python3-lxml-qname-tag-text Passed
Constructs an element using lxml.etree.QName with both a namespace URI and a localname, verifies the element tag is rendered in Clark notation, then reads the QName.text representation and the parsed namespace and localname back out, exercising lxml QName tag-access semantics.
lxml Element addnext and addprevious insert siblings Original / libxml / usage-python3-lxml-r10-addnext-addprevious Passed
Builds a sibling chain via Element.addnext() and Element.addprevious() relative to a pivot element, then asserts the resulting child order is exactly previous, pivot, next.
lxml Element.replace swaps a child in place preserving order Original / libxml / usage-python3-lxml-r10-element-replace-child Passed
Parses a parent with three children, calls Element.replace() to swap the middle child for a freshly built element, and asserts the new tag appears at the original position with siblings intact.
lxml.html.iterlinks enumerates href and src URLs Original / libxml / usage-python3-lxml-r10-html-iterlinks-href-src Passed
Parses an HTML fragment with anchor and image tags, walks lxml.html.iterlinks() and asserts both the href URL on the <a> tag and the src URL on the <img> tag are reported with their attribute names.
lxml etree.tostring writes XML decl with standalone='yes' Original / libxml / usage-python3-lxml-r10-tostring-standalone-decl Passed
Serializes an ElementTree with xml_declaration=True and standalone=True, and asserts the emitted prolog includes encoding='UTF-8' and standalone='yes'.
lxml etree.tostring with method='text' returns concatenated text Original / libxml / usage-python3-lxml-r10-tostring-text-method Passed
Builds a small element tree with mixed text and tail content, serializes it with method='text', and asserts that markup is stripped and only the concatenated character data remains.
cssselect.GenericTranslator emits the documented XPath translation Original / libxml / usage-python3-lxml-r11-cssselect-translator-xpath Passed
Asks cssselect.GenericTranslator().css_to_xpath to translate "div.foo > a" and asserts the resulting XPath uses the descendant-or-self axis with the documented class normalization predicate that selects child a elements of div.foo.
lxml etree.fromstringlist joins arbitrary chunk boundaries into one tree Original / libxml / usage-python3-lxml-r11-fromstringlist-rejoins Passed
Splits a complete XML document into chunks that intentionally cross tag boundaries, parses with etree.fromstringlist, and asserts the resulting root element name and child text values match the original document.
lxml.html.fragment_fromstring with create_parent wraps multiple top-level fragments Original / libxml / usage-python3-lxml-r11-html-fragment-create-parent Passed
Calls lxml.html.fragment_fromstring on two sibling HTML elements with create_parent='div' and asserts the synthetic wrapper carries the requested tag plus both children with their original text content preserved.
lxml XMLParser resolve_entities=False keeps internal entity references unexpanded Original / libxml / usage-python3-lxml-r11-resolve-entities-disabled Passed
Parses a doctype-with-internal-entity document using etree.XMLParser(resolve_entities=False), serializes the result, and asserts the entity reference token survives instead of being replaced with its expansion.
lxml etree.strip_elements drops subtree but with_tail=False preserves between-text Original / libxml / usage-python3-lxml-r11-strip-elements-no-tail Passed
Calls etree.strip_elements with with_tail=False to remove a repeated child element while keeping the surrounding character data and inter-element text intact, asserting the resulting serialized form.
lxml etree.strip_tags removes wrappers but preserves contained text Original / libxml / usage-python3-lxml-r11-strip-tags-keeps-text Passed
Builds a small element tree containing repeated inline wrappers, calls etree.strip_tags to remove the wrapper element name, and asserts the serialized result keeps the surrounding plus inline text concatenated and drops the inline tags.
lxml.etree.iterparse end-event handler can elem.clear() each item without losing root tag Original / libxml / usage-python3-lxml-r12-iterparse-clear-frees-memory Passed
Streams a small XML document with iterparse, calls clear() on each end-event element, and asserts every item tag was visited and the root tag is still recoverable from the parser, exercising the documented streaming-with-clear pattern.
lxml etree.tostring with xml_declaration=True emits the prolog with the requested encoding Original / libxml / usage-python3-lxml-r12-tostring-xml-declaration Passed
Calls etree.tostring on a small element with xml_declaration=True and encoding='UTF-8', and asserts the serialized output begins with the canonical "<?xml version='1.0' encoding='UTF-8'?>" prolog followed by the element body.
lxml ElementTree.xinclude resolves a parse=xml href into the parent tree Original / libxml / usage-python3-lxml-r12-xinclude-xpointer-element Passed
Builds a host XML document that XIncludes an external file with parse="xml", runs ElementTree.xinclude(), and asserts the included root element is grafted into the host tree replacing the xinclude marker, with its child text content preserved.
lxml XPath returns native Python bool for boolean()-wrapped expressions Original / libxml / usage-python3-lxml-r12-xpath-boolean-result Passed
Evaluates two XPath expressions wrapped with boolean() against a tiny tree and asserts the results are returned as Python's True / False (not as a string or int), confirming lxml maps XPath xs:boolean to bool.
lxml XSLT with xsl:output method='text' emits the concatenated text without markup Original / libxml / usage-python3-lxml-r12-xslt-output-method-text Passed
Compiles an XSLT 1.0 stylesheet that declares xsl:output method='text', applies it to a tiny element tree, and asserts the resulting bytes contain only the concatenated value-of output with no XML angle brackets.
lxml.cssselect.CSSSelector matches attribute-equals selectors against an XML tree Original / libxml / usage-python3-lxml-r13-cssselect-attribute-equals Passed
Builds a small XML fragment of mixed-priority items and applies a compiled CSSSelector for "item[priority='high']" via lxml.cssselect, asserts the returned matches contain only the two high-priority items and their text bodies are recovered intact in document order.
lxml ElementTree.getpath returns the canonical XPath for a deeply nested element Original / libxml / usage-python3-lxml-r13-getroottree-getpath Passed
Builds a small tree, locates a specific leaf via xpath, calls getroottree().getpath(elem), and asserts the returned XPath is the exact predicate-indexed path the leaf has in the document and that re-applying the path to the tree yields the same element.
lxml etree.HTMLParser parses missing-close-tag HTML and recovers a usable tree Original / libxml / usage-python3-lxml-r13-htmlparser-malformed-recovery Passed
Feeds malformed HTML with unclosed and reordered tags into etree.HTMLParser via etree.fromstring, asserts the parser returns a tree (no exception), the document root is <html>, the body contains the expected paragraph text, the recovered list items are present in document order, and the recovered tree includes the body element.
lxml.objectify exposes typed pyval accessors for int/float/bool/str leaf elements Original / libxml / usage-python3-lxml-r13-objectify-pyval-typed-access Passed
Parses a small typed document with lxml.objectify, asserts each leaf's pyval is the correct native Python type (int, float, bool, str), and verifies arithmetic on the int/float pyvals matches the expected sum so the typed access path is fully exercised.
lxml etree.QName builds a Clark-notation tag and round-trips namespace and localname Original / libxml / usage-python3-lxml-r13-qname-roundtrip-build Passed
Constructs an etree.QName from a namespace URI and local name, uses it to build an Element and SubElement tree, and asserts the produced tags carry the expected Clark notation, the QName's namespace and localname properties match the inputs, and the serialized XML uses an "ns0" or explicit declared prefix for the namespace.
lxml ElementTree.write(method='c14n') emits canonical XML with sorted attributes Original / libxml / usage-python3-lxml-r14-elementtree-write-c14n Passed
Builds a tree whose root carries attributes in non-alphabetical order, calls tree.write(file, method='c14n'), and asserts the on-disk canonicalized output reorders attributes alphabetically and omits the XML declaration, matching W3C C14N expectations.
lxml etree.dump writes the indented serialization of an Element to stdout Original / libxml / usage-python3-lxml-r14-etree-dump-writes-stdout Passed
Calls etree.dump on a small Element with nested children, redirects the python process stdout to a file, and asserts the captured output is the indented XML representation of the element with the parent and child tags both present.
lxml etree.fromstring + xpath namespaces map resolves prefixed element queries Original / libxml / usage-python3-lxml-r14-fromstring-namespaces-xpath Passed
Parses an XML document carrying a non-default namespace, runs xpath with an explicit namespaces map mapping a local prefix to the namespace URI, and asserts the query returns the expected element text under both the prefixed and Clark-notation traversal paths.
lxml.html.fromstring().text_content() flattens nested element text into a single string Original / libxml / usage-python3-lxml-r14-html-text-content Passed
Parses an HTML fragment with nested inline elements via lxml.html.fromstring, calls .text_content() on the root, and asserts the returned string is the concatenation of every descendant text node in document order with no element markup remaining.
lxml etree.iselement returns True for Element objects and False for non-elements Original / libxml / usage-python3-lxml-r14-iselement-detection Passed
Calls etree.iselement on an Element, an ElementTree, a string, and None, and asserts only the Element returns True. This pins the public type-check predicate behavior used by libraries that bridge lxml objects.
lxml etree.XMLParser(remove_blank_text=True) drops whitespace-only text nodes during parsing Original / libxml / usage-python3-lxml-r14-xmlparser-remove-blank-text Passed
Parses an indented document with etree.XMLParser(remove_blank_text=True), serializes the tree back, and asserts the output is the compact form (no whitespace text nodes between elements). Compares against a default-parser parse of the same input which preserves the indentation.
lxml Element.clear() drops children, attributes, and text but preserves the element tag Original / libxml / usage-python3-lxml-r15-element-clear-keeps-tag Passed
Builds an Element with text, attributes, and child nodes, calls clear() on it, and asserts the tag is unchanged while text becomes None, the attribute map is empty, and the children list has length 0.
lxml Element.replace swaps a child element and drops the replaced node's tail text Original / libxml / usage-python3-lxml-r15-element-replace-drops-tail Passed
Builds a parent with two children where the first child carries tail text, calls parent.replace(old, new), and asserts the new element occupies the old position, the new element's tail is empty (the replaced node's tail is dropped), and the serialized output reflects the swap with the trailing tail removed.
lxml Element.iterancestors yields the parent chain in walk-up order and accepts a tag filter Original / libxml / usage-python3-lxml-r15-iterancestors-tag-filter Passed
Walks a deeply nested document and asserts iterancestors() with no argument yields tags in inner-to-outer order, while iterancestors('b') only yields the ancestors whose tag equals "b". Pins the lxml ancestor traversal contract used by selector libraries.
lxml etree.QName decomposes a Clark-notation tag into namespace and localname Original / libxml / usage-python3-lxml-r15-qname-from-tag Passed
Constructs an etree.QName from a namespace and localname, asserts its .text returns the Clark-notation form "{ns}local", that .localname and .namespace round-trip the inputs, and that QName(element) on a parsed namespaced element recovers the same Clark form.
lxml etree.tostring(with_tail=False) drops the trailing tail text of the serialized element Original / libxml / usage-python3-lxml-r15-tostring-with-tail-toggle Passed
Parses a document where a child element carries tail text, serializes the child with etree.tostring twice (with_tail=True default and with_tail=False), and asserts the default form preserves the tail string while with_tail=False produces the element-only serialization.
lxml etree.XMLParser.feed accepts the document in chunks and returns the root via close() Original / libxml / usage-python3-lxml-r15-xmlparser-feed-incremental Passed
Drives an etree.XMLParser by feeding the document in five disjoint byte slices via parser.feed(), then calls parser.close() and asserts the returned Element has the expected root tag, child count, and serialized form, demonstrating incremental parsing.
lxml Element.attrib.update bulk-applies a dict and overwrites existing keys Original / libxml / usage-python3-lxml-r16-attrib-update-bulk-overwrite Passed
Builds an element with two initial attributes, calls attrib.update with a dict that overwrites one and introduces two new keys, and asserts the resulting attribute map contains the union with the overwritten value taking precedence, exercising the MutableMapping-style update contract.
lxml etree.Comment and etree.ProcessingInstruction nodes appended to a tree survive tostring round-trip Original / libxml / usage-python3-lxml-r16-comment-and-pi-roundtrip Passed
Appends an etree.Comment and an etree.ProcessingInstruction to an element, serializes via tostring, parses the result, and asserts the comment text and PI target/data come back identically — confirming both node types survive a serialize/parse cycle.
lxml CSSSelector matches .class and #id selectors against parsed HTML Original / libxml / usage-python3-lxml-r16-cssselect-class-and-id-selector Passed
Parses an HTML fragment with lxml.html.fromstring, compiles a 'div.note' and a '#main' CSSSelector, and asserts each selector returns the expected element count and the matched element's text content — exercising the cssselect translation layer on top of libxml2.
lxml.html.fragment_fromstring with create_parent wraps mixed text and inline children under the requested tag Original / libxml / usage-python3-lxml-r16-html-fragment-fromstring-create-parent Passed
Calls lxml.html.fragment_fromstring on a fragment containing both text and inline elements with create_parent='section', and asserts the returned element has tag 'section', preserves the leading text content, and lists the expected child tags in source order.
lxml Element.iter(tag) yields only elements matching the supplied local-name filter Original / libxml / usage-python3-lxml-r16-iter-tag-filter-count Passed
Builds a tree with interleaved <a> and <b> children, asserts list(doc.iter('a')) has length 3, list(doc.iter('b')) has length 2, and list(doc.iter()) (unfiltered) has length 6 including the root — covering the iter tag-filter contract.
lxml etree.XMLSchema accepts a valid instance and rejects one missing a required element Original / libxml / usage-python3-lxml-r16-xmlschema-rejects-invalid-then-validates-valid Passed
Compiles an XSD that requires an <id> child of <person>, asserts validate(valid_doc) returns True and validate(invalid_doc) returns False with error_log non-empty, exercising libxml2's XML Schema validator path through lxml.
lxml XSLT inline stylesheet rewrites element to <out value="N"> for each input node Original / libxml / usage-python3-lxml-r16-xslt-attribute-set-output Passed
Compiles a small XSLT 1.0 stylesheet that maps <item><val>N</val></item> to <out value="N"/>, applies it to a three-item document, and asserts the serialized result contains exactly three <out> elements with attribute values 1, 2, 3 in order.
lxml Element .tail text is preserved across a tostring round-trip Original / libxml / usage-python3-lxml-r17-element-tail-roundtrip Passed
Builds two sibling SubElements, sets the tail of the first to ' between ', serializes the tree, and asserts the tail text appears verbatim between the two child tags in the serialized form.
lxml HTMLParser parses a fragment with unclosed inline tags without raising Original / libxml / usage-python3-lxml-r17-html-parser-unclosed-tag-recovery Passed
Feeds an HTML fragment with unclosed <p> tags through lxml.html.fromstring (HTMLParser), and asserts the resulting tree exposes two <p> elements with the expected text content — exercising HTML5-style recovery on malformed input.
lxml etree.iterparse with end events yields one event per closing tag in the stream Original / libxml / usage-python3-lxml-r17-iterparse-end-event-count Passed
Streams a small XML document through etree.iterparse with events=('end',), collects the tag names of each emitted end event, and asserts the count and ordering match the document's closing-tag sequence — exercising libxml2's incremental parser through lxml.
lxml etree.XML with a declared namespace prefix preserves the prefix on serialization Original / libxml / usage-python3-lxml-r17-namespace-prefix-preserved-on-roundtrip Passed
Parses an XML string declaring xmlns:ns0='http://example.org/ns' with an element using that prefix, serializes the tree via tostring, and asserts the output contains the same 'ns0:' prefix and namespace URI — exercising libxml2's namespace bookkeeping through lxml.
lxml etree.parse accepts an io.BytesIO handle and yields the expected root tag Original / libxml / usage-python3-lxml-r17-parse-from-stringio-handle Passed
Wraps a small XML payload in an io.BytesIO, passes it to etree.parse, and asserts the resulting tree's getroot().tag is 'root' and the child <item> count matches the source — exercising lxml's file-like parser path.
lxml etree.SubElement with .text yields the expected serialized shape Original / libxml / usage-python3-lxml-r17-subelement-text-tostring-shape Passed
Builds an Element with two SubElement children carrying text, serializes via etree.tostring with encoding='unicode', and asserts the result contains both child tags with their text bodies in document order — exercising the basic tree construction + serialization path.
lxml etree.XPath compiled expression returns the same results as Element.xpath Original / libxml / usage-python3-lxml-r17-xpath-compiled-vs-adhoc-equiv Passed
Compiles an XPath via etree.XPath once and evaluates it against a tree, then evaluates the same XPath ad-hoc via Element.xpath, and asserts both return the same list of element texts — pinning the compiled-vs-adhoc result equivalence contract.
lxml _Element addnext and addprevious place siblings at the expected positions Original / libxml / usage-python3-lxml-r18-addnext-addprevious-sibling-order Passed
Constructs an element list, uses addnext and addprevious to insert siblings around a middle element, and asserts the resulting in-order tag sequence matches the expected ordering pinned by the API contract.
lxml iterparse with tag filter yields only elements matching the requested tag Original / libxml / usage-python3-lxml-r18-iterparse-tag-filter-counts Passed
Streams an XML payload through etree.iterparse with tag='item' and asserts the iterator yields exactly three end events corresponding to the three <item> elements in the input, ignoring all other tags.
lxml etree.strip_attributes removes the named attribute from all matching elements Original / libxml / usage-python3-lxml-r18-strip-attributes-removes-named-attr Passed
Builds a tree with multiple elements that carry a removable 'tmp' attribute, invokes etree.strip_attributes(tree, 'tmp'), and asserts no element retains the attribute while leaving other attributes intact.
lxml etree.XMLSchema accepts conformant XML and rejects non-conformant XML Original / libxml / usage-python3-lxml-r18-xmlschema-validate-valid-and-invalid Passed
Builds an etree.XMLSchema from an inline XSD and asserts a conformant document validates True while a non-conformant document (extra unexpected element) validates False, exercising the libxml2 XSD path through lxml.
lxml etree.XSLT identity stylesheet preserves the root tag and child count Original / libxml / usage-python3-lxml-r18-xslt-identity-transform-roundtrip Passed
Compiles an XSLT identity stylesheet via lxml.etree.XSLT, applies it to a small input document, and asserts the transformed tree has the same root tag and child element count as the source — exercising the libxslt-backed transform path.
lxml etree.cleanup_namespaces removes an unused namespace declaration from the tree Original / libxml / usage-python3-lxml-r19-cleanup-namespaces-removes-unused-ns Passed
Builds a tree where the root declares two namespaces but only one is actually used, calls etree.cleanup_namespaces(tree), and asserts the serialized output drops the unused namespace while keeping the in-use one.
lxml builder.ElementMaker constructs a nested namespaced element with attributes Original / libxml / usage-python3-lxml-r19-element-maker-builds-namespaced-tree Passed
Uses lxml.builder.ElementMaker with a namespace and nsmap to build a root containing a single child carrying an attribute, then serializes the tree and asserts the namespace declaration and child element both appear with the expected prefix.
lxml etree.tostring with method=html emits non-void elements with explicit close tags Original / libxml / usage-python3-lxml-r19-htmlparser-tostring-method-html-no-self-close Passed
Parses a small HTML fragment via lxml.html.fromstring, serializes the tree with etree.tostring(method='html'), and asserts a non-void element like <p></p> is rendered with an explicit closing tag rather than a self-closing form — pinning libxml2's HTML serializer behavior.
lxml XMLParser remove_blank_text drops indentation-only text between elements Original / libxml / usage-python3-lxml-r19-parser-remove-blank-text-drops-whitespace Passed
Parses an indented XML document with etree.XMLParser(remove_blank_text=True), serializes the result, and asserts the output does not contain whitespace between sibling element tags — locking in the libxml2 blank-text suppression path through lxml.
lxml etree.tostring with xml_declaration=True emits an <?xml version="1.0"?> prolog Original / libxml / usage-python3-lxml-r19-tostring-xml-declaration-emitted Passed
Serializes a small element tree via etree.tostring with xml_declaration=True and encoding='utf-8', then asserts the resulting bytes begin with an XML declaration carrying the version and encoding attributes — pinning lxml's prolog emission contract.
lxml Element.xpath with explicit namespaces dict resolves a custom prefix Original / libxml / usage-python3-lxml-r19-xpath-namespaces-arg-resolves-prefix Passed
Parses an XML document declaring a namespace under prefix 'a', then invokes element.xpath('//a:leaf/text()', namespaces={'a': '...'}) and asserts the returned list equals the two text values 'one' and 'two' — exercising lxml's namespace-aware XPath path.
lxml element.text assignment with ampersand serializes as & via tostring Original / libxml / usage-python3-lxml-r20-element-set-text-roundtrips-through-tostring Passed
Creates an element, assigns text containing an ampersand (e.g. 'A & B'), serializes via etree.tostring, and asserts the resulting bytes contain '&' (escaped) and not a bare '&' — pinning the libxml2 entity-escape contract through lxml's text setter.
lxml iterparse with events=('end',) yields one event per element node in document order Original / libxml / usage-python3-lxml-r20-iterparse-end-events-count-matches-elements Passed
Feeds a three-deep XML document into etree.iterparse with events=('end',), collects the tag of each emitted event in order, and asserts the list equals ['leaf', 'mid', 'root'] — pinning the libxml2 SAX-driven iterparse end-event ordering through lxml.
lxml etree.strip_tags removes the named element while preserving inline text Original / libxml / usage-python3-lxml-r20-strip-tags-removes-named-element Passed
Builds a tree with mixed content '<r>a<b>middle</b>z</r>', calls etree.strip_tags(root, 'b') and asserts the serialized output is '<r>amiddlez</r>' — pinning lxml's strip_tags content-promotion behavior over libxml2's tree manipulation API.
lxml XMLParser remove_comments=True drops <!--..--> nodes from the parsed tree Original / libxml / usage-python3-lxml-r20-xmlparser-remove-comments-drops-comments Passed
Parses an XML document containing a comment node using etree.XMLParser(remove_comments=True), serializes back via tostring, and asserts the resulting output contains no '<!--' substring while still preserving the surrounding elements — pinning the libxml2 parser's comment-stripping path through lxml.
lxml XPath count(//item) returns a Python float equal to the literal child count Original / libxml / usage-python3-lxml-r20-xpath-count-fn-returns-integer-string Passed
Builds a tree with exactly three <item> children, evaluates the XPath count(//item) via tree.xpath, and asserts the returned value is a Python float of 3.0 — pinning libxml2's count() return-type contract through lxml's XPath bindings.
lxml XSLT identity transform preserves the number of leaf elements Original / libxml / usage-python3-lxml-r20-xslt-identity-transform-preserves-leaf-count Passed
Compiles an identity-stylesheet XSLT via etree.XSLT, applies it to a tree containing three <item> children, serializes the result, and asserts re-parsing it yields exactly three <item> nodes — pinning the libxslt-driven identity transform's structural preservation through lxml.
lxml iterparse with events=('comment',) yields exactly the comment nodes in document order Original / libxml / usage-python3-lxml-r21-iterparse-comment-event Passed
Feeds a small document containing two comments interleaved with elements to lxml.etree.iterparse(events=('comment',)) and asserts the iterator yields exactly two ('comment', <node>) tuples whose text content matches the source comments — pinning lxml's libxml2-backed comment event emission.
lxml iterparse with events=('pi',) yields processing-instruction nodes with their targets Original / libxml / usage-python3-lxml-r21-iterparse-pi-event Passed
Parses a document containing two processing instructions through lxml.etree.iterparse(events=('pi',)) and asserts the iterator yields two pi events whose .target values match the source targets in document order — pinning lxml's libxml2 PI event surface.
lxml ElementTree.xinclude() resolves a file-based xi:include into the document tree Original / libxml / usage-python3-lxml-r21-xinclude-resolves-inline-content Passed
Writes two XML files where the parent uses <xi:include href="child.xml"/>, parses and calls ElementTree.xinclude(), then asserts the resulting serialization contains the child's <c> element — pinning lxml's libxml2 XInclude resolution on Ubuntu 24.04.
lxml XSLT accepts a string parameter via XSLT.strparam and emits it in the result Original / libxml / usage-python3-lxml-r21-xslt-string-param-passing Passed
Compiles an XSLT stylesheet that copies a top-level <param> value into the output, invokes the transform with XSLT.strparam('value'), and asserts the serialized output contains exactly that string — pinning lxml/libxslt parameter passing on Ubuntu 24.04.
lxml etree.tostring c14n2 strips comments Original / libxml / usage-python3-lxml-r9-c14n2-strip-comments Passed
Serialises a tree with method=c14n2 and strip_text=False, with_comments=False and asserts the resulting bytes drop the comment node.
lxml RelaxNG validate accepts and rejects Original / libxml / usage-python3-lxml-r9-relaxng-validate Passed
Compiles a RelaxNG schema and verifies it accepts a conforming document and rejects a non-conforming one.
lxml XPath honours namespace prefix mapping Original / libxml / usage-python3-lxml-r9-xpath-namespace-prefix Passed
Parses a document with a default namespace and runs an XPath using a custom prefix mapping, asserting the namespaced element is selected.
lxml XPath position predicate Original / libxml / usage-python3-lxml-r9-xpath-position Passed
Parses an items list and uses an XPath position() predicate to select the second item, asserting the text matches.
lxml XSLT identity transform Original / libxml / usage-python3-lxml-r9-xslt-identity-transform Passed
Compiles an identity XSLT 1.0 stylesheet and applies it to a tree, verifying the serialized result preserves the structure.
lxml recover parser Original / libxml / usage-python3-lxml-recover-parser Passed
lxml RelaxNG validation Original / libxml / usage-python3-lxml-relaxng Passed
lxml remove comments parser Original / libxml / usage-python3-lxml-remove-comments-parser-batch11 Passed
lxml SAX handler integration Original / libxml / usage-python3-lxml-sax-handler-integration Passed
Drives a custom xml.sax.ContentHandler from an in-memory lxml etree using lxml.sax.saxify, asserts the handler observes the expected ordered sequence of startElement / characters / endElement callbacks, and verifies element nesting via depth tracking.
python3-lxml schema xml Original / libxml / usage-python3-lxml-schema-xml Passed
lxml Schematron validation Original / libxml / usage-python3-lxml-schematron-validate Passed
Validates an XML document against an ISO Schematron schema with python3-lxml and verifies a violating document is rejected with an exact failure report message.
lxml normalize-space text Original / libxml / usage-python3-lxml-strip-text Passed
lxml SubElement and ElementTree write_c14n Original / libxml / usage-python3-lxml-subelement-write-c14n Passed
Builds a tree with etree.SubElement and serializes it to disk via ElementTree.write with method="c14n", then verifies the exact canonical bytes including alphabetic attribute ordering.
lxml tostring inclusive vs exclusive C14N Original / libxml / usage-python3-lxml-tostring-c14n-inclusive Passed
Serializes a subtree through etree.tostring with method='c14n' both inclusively and exclusively, then verifies that inclusive C14N retains ancestor-declared but unused namespaces while exclusive C14N drops them.
lxml tostring c14n2 method Original / libxml / usage-python3-lxml-tostring-c14n2 Passed
Serializes an XML tree through etree.tostring with method='c14n2' (the newer Canonical XML 2.0 serializer) and verifies the canonical attribute ordering and namespace handling of the output, distinct from the legacy method='c14n' path.
lxml tostring method html Original / libxml / usage-python3-lxml-tostring-method-html Passed
Parses an XML tree containing self-closing void elements, serializes it via etree.tostring with method='html', and verifies that void tags such as <br> and <img> are emitted in HTML form rather than as XML self-closing tags.
lxml tostring pretty_print exact bytes Original / libxml / usage-python3-lxml-tostring-pretty-bytes Passed
Serializes a small lxml tree with etree.tostring(pretty_print=True) and verifies the exact byte-for-byte output, asserting indentation and newline placement match the documented libxml2 pretty-printer behavior.
lxml tostring pretty Original / libxml / usage-python3-lxml-tostring-pretty Passed
lxml tree write Original / libxml / usage-python3-lxml-tree-write Passed
Writes an XML tree to disk through lxml and verifies the resulting file contains the expected declaration and node text.
lxml TreeBuilder build Original / libxml / usage-python3-lxml-treebuilder-build Passed
Builds a document incrementally with lxml TreeBuilder events and verifies the serialized output and exact attribute set of the constructed root element.
python3-lxml XInclude XML expansion Original / libxml / usage-python3-lxml-xinclude-xml Passed
lxml xmlfile streaming write Original / libxml / usage-python3-lxml-xmlfile-streaming-write Passed
Streams XML to disk with the etree.xmlfile incremental writer using element context managers, then re-parses the written file and verifies the root tag, total child count, and a specific child attribute through python3-lxml.
lxml XMLID map Original / libxml / usage-python3-lxml-xmlid-map Passed
lxml XMLParser remove_blank_text Original / libxml / usage-python3-lxml-xmlparser-remove-blank-text Passed
Parses an indented XML document with lxml.etree.XMLParser(remove_blank_text=True) and verifies that ignorable whitespace text nodes are dropped, leaving exactly the element children expected with no whitespace .text or .tail.
lxml XMLSchema complex XSD validate Original / libxml / usage-python3-lxml-xmlschema-complex-xsd Passed
Loads a multi-element XSD with type restrictions and required attributes, validates a conforming document successfully, then validates a non-conforming document (missing required attribute) and verifies the schema error log surfaces the specific validation failure.
lxml etree.XPath compiled expression reused across documents Original / libxml / usage-python3-lxml-xpath-compiled-reuse-r8 Passed
Compiles an etree.XPath expression with namespace bindings once and applies it to two distinct parsed documents, verifying that the same compiled XPath instance returns the per-document node counts and string values without reparsing the expression.
lxml XPath count() over filtered nodeset Original / libxml / usage-python3-lxml-xpath-count-function-r7 Passed
Compiles an XPath expression that counts item elements whose status attribute equals "ok" and verifies the libxml2 XPath engine returns the exact float count and that an unfiltered count() over the full nodeset returns the total cardinality.
python3-lxml XPath count Original / libxml / usage-python3-lxml-xpath-count Passed
lxml XPathEvalError on malformed expression Original / libxml / usage-python3-lxml-xpath-eval-error-r7 Passed
Submits a syntactically invalid XPath expression to etree.XPath compilation and verifies the libxml2 backend raises XPathSyntaxError, then submits an undefined function reference to a compiled XPath at evaluation time and verifies XPathEvalError is raised, confirming both error classes are surfaced from the C library.
lxml etree.XPath with extensions dict Original / libxml / usage-python3-lxml-xpath-extension-callable Passed
Compiles an etree.XPath expression with a custom extension function passed via the extensions= mapping (rather than via FunctionNamespace), invokes the XPath against an in-memory tree, and verifies the Python callable was called by the libxml2-backed XPath engine and returned the expected aggregated result.
lxml XPath last item text Original / libxml / usage-python3-lxml-xpath-last-item-text Passed
Selects the last item element with python3-lxml's last() XPath function and verifies the trailing item text.
lxml XPath multi-namespace count Original / libxml / usage-python3-lxml-xpath-multi-namespace-count Passed
Evaluates XPath expressions over a document that mixes two distinct namespaces and verifies the exact element counts returned for each namespace prefix binding.
lxml XPath string-length and concat Original / libxml / usage-python3-lxml-xpath-string-length-r7 Passed
Evaluates the XPath string-length() function on a selected element text and combines concat() with normalize-space() to produce a derived string, verifying both libxml2 XPath string functions return their canonical results.
lxml XPath string value Original / libxml / usage-python3-lxml-xpath-string-value Passed
Evaluates a string-valued XPath expression through python3-lxml and verifies the selected text node.
lxml XPath string Original / libxml / usage-python3-lxml-xpath-string Passed
lxml XPath sum weight Original / libxml / usage-python3-lxml-xpath-sum-weight Passed
Sums the weight attribute across item elements with python3-lxml and verifies the aggregated total.
lxml XPath variable Original / libxml / usage-python3-lxml-xpath-variable-batch11 Passed
python3-lxml xpath xml Original / libxml / usage-python3-lxml-xpath-xml Passed
lxml XPathEvaluator namespace bindings Original / libxml / usage-python3-lxml-xpathevaluator-namespaces Passed
Builds an etree.XPathEvaluator with explicit namespace bindings, evaluates several namespace-prefixed expressions against a multi-namespace document, and verifies returned node counts and string values match the expected bindings.
lxml XSLT extension function Original / libxml / usage-python3-lxml-xslt-extension-function Passed
Registers a Python XSLT 1.0 extension function via lxml and verifies the transform output applies the custom function.
lxml XSLT parameter Original / libxml / usage-python3-lxml-xslt-param Passed
lxml XSLT text output Original / libxml / usage-python3-lxml-xslt-text-output-batch11 Passed
python3-lxml xslt xml Original / libxml / usage-python3-lxml-xslt-xml Passed
shared-mime-info alias entry registration Original / libxml / usage-shared-mime-info-alias-resolution-r7 Passed
Stages a synthetic MIME package that declares application/x-validator-canonical with an alias element pointing at application/x-validator-old, runs update-mime-database to parse it through libxml2, and verifies the rebuilt aliases file maps the alias name to the canonical type and that both type names are listed in the types file.
shared-mime-info custom MIME with multiple globs Original / libxml / usage-shared-mime-info-custom-multi-glob Passed
Stages a synthetic MIME package that defines a single application-defined type with three distinct glob patterns (suffix, prefix, and directory wildcard), runs update-mime-database to install it, then verifies that every glob is registered in globs2 and resolves back to the same MIME type, exercising libxml2 SAX parsing of multi-glob mime-type entries.
shared-mime-info derived XML MIME type install and uninstall Original / libxml / usage-shared-mime-info-derived-xml-type-install Passed
Stages a synthetic MIME package that defines an application/xml-derived type with a custom .vex extension, runs update-mime-database to install it, verifies the derived type is registered in globs2 and types and that XMLnamespaces records its root namespace, then removes the package, rebuilds, and verifies the synthetic type is no longer registered, exercising libxml2 SAX parsing through both install and uninstall code paths.
shared-mime-info custom magic priority emitted to magic file Original / libxml / usage-shared-mime-info-magic-priority-custom-r8 Passed
Stages a synthetic MIME package that declares a custom magic match with a non-default priority and a literal byte signature, runs update-mime-database to parse it through libxml2, and verifies the rebuilt magic file emits the priority header for the new type and that types/globs2 also reflect the registration.
shared-mime-info magic priority install Original / libxml / usage-shared-mime-info-magic-priority-r7 Passed
Stages a synthetic MIME package that defines an application/x-validator-magic type with a magic match rule keyed on a fixed leading byte sequence and priority 60, runs update-mime-database to parse it through libxml2, and verifies the rebuilt magic file lists the synthetic type with the declared priority and that the rule appears before lower-priority entries.
shared-mime-info mime cache build Original / libxml / usage-shared-mime-info-mime-cache-build Passed
Runs update-mime-database against the staged freedesktop MIME packages and verifies the rebuilt mime.cache plus globs2 entries for text/plain and application/xml, exercising libxml2 SAX parsing through shared-mime-info.
shared-mime-info installs custom MIME with explicit icon element Original / libxml / usage-shared-mime-info-r10-icon-element-types Passed
Stages a synthetic MIME package that declares an explicit <icon> element on a custom mime-type, runs update-mime-database, and asserts the type is recorded in the generated types file along with a non-empty mime.cache.
shared-mime-info preserves explicit glob weight column in globs2 Original / libxml / usage-shared-mime-info-r11-glob-weight-recorded Passed
Stages a synthetic MIME package whose <glob> declares an explicit weight="80" attribute, runs update-mime-database, and asserts the generated globs2 file lists the weight in the leading numeric column for the custom MIME type.
shared-mime-info records an explicit alias entry in aliases after update-mime-database Original / libxml / usage-shared-mime-info-r12-update-mime-database-aliases Passed
Stages a synthetic MIME package whose mime-type declares an explicit <alias type="..."/> child, runs update-mime-database against the staging tree, and asserts the generated aliases file lists the alias mapped to the canonical custom MIME type.
shared-mime-info preserves localized xml:lang comments through update-mime-database Original / libxml / usage-shared-mime-info-r13-comment-localized Passed
Stages a synthetic MIME package whose mime-type carries both a default-locale comment and a localized xml:lang="fr" comment, runs update-mime-database against the staging tree, and asserts the generated XML output for the custom MIME type retains both the default and the French comment text.
shared-mime-info records every glob pattern declared on a custom MIME type Original / libxml / usage-shared-mime-info-r14-multi-glob-patterns Passed
Stages a synthetic MIME package whose mime-type declares two distinct glob patterns, runs update-mime-database against the staging tree, and asserts the generated globs file lists both patterns mapped to the same canonical MIME type so multi-glob declarations are preserved.
shared-mime-info records a sub-class-of relationship in the subclasses index Original / libxml / usage-shared-mime-info-r15-subclass-default-text-plain Passed
Stages a synthetic MIME package whose mime-type declares <sub-class-of type="text/plain"/>, runs update-mime-database, and asserts the produced subclasses file lists the custom type as a direct subclass of text/plain in the canonical "<child> <parent>" form.
xdg-mime query filetype on a plain XML file resolves to an application/*xml MIME type Original / libxml / usage-shared-mime-info-r16-xdg-mime-query-plain-xml Passed
Writes a minimal well-formed XML document to disk, invokes xdg-mime query filetype on it, and asserts the resolved MIME type ends in 'xml' (e.g. application/xml or text/xml) — exercising the libxml2-backed mime-detection path through shared-mime-info's installed database.
shared-mime-info freedesktop.org.xml package ships an application/xml type entry Original / libxml / usage-shared-mime-info-r18-mime-cache-has-xml-package Passed
Inspects /usr/share/mime/packages/freedesktop.org.xml from the shared-mime-info package and asserts the file contains a mime-type element for application/xml — confirming the libxml-parsed source package is intact and registers the core XML MIME type.
xdg-mime query filetype identifies an SVG document as image/svg+xml Original / libxml / usage-shared-mime-info-r18-xdg-mime-detects-svg-image Passed
Writes a minimal SVG XML document and invokes xdg-mime query filetype (falling back to file --mime-type when xdg-mime is unavailable), then asserts the resolved type is image/svg+xml, exercising shared-mime-info's libxml-driven SVG detection rule.
shared-mime-info package declares xhtml glob and root-XML namespace for application/xhtml+xml Original / libxml / usage-shared-mime-info-r19-package-xhtml-glob-and-root-xml Passed
Inspects /usr/share/mime/packages/freedesktop.org.xml and asserts the application/xhtml+xml mime-type entry declares both the *.xhtml glob and a root-XML element scoped to the XHTML namespace — confirming the libxml-parsed shared-mime-info rules describe XHTML detection.
shared-mime-info package declares svg glob and the SVG root-XML namespace Original / libxml / usage-shared-mime-info-r20-package-svg-glob-and-root-xml Passed
Inspects /usr/share/mime/packages/freedesktop.org.xml and asserts the image/svg+xml mime-type entry declares both the *.svg glob pattern and a root-XML rule namespaced to http://www.w3.org/2000/svg — pinning the libxml-parsed shared-mime-info rules describe SVG detection.
update-mime-database builds a mime.cache from a minimal custom packages directory Original / libxml / usage-shared-mime-info-r21-update-mime-database-builds-cache Passed
Creates an isolated MIME data dir with a single packages/custom.xml declaring a glob/comment pair, runs update-mime-database on it, and asserts the resulting mime.cache binary file is present and non-empty — pinning libxml-driven update-mime-database build on a tiny package set on Ubuntu 24.04.
file --mime-type reports text/plain for a simple .txt input on a shared-mime-info system Original / libxml / usage-shared-mime-info-r21-xdg-mime-query-default-text Passed
Creates a small .txt file and runs file --mime-type, falling back gracefully and asserting the returned MIME type equals text/plain — pinning shared-mime-info's libxml-built text/plain detection rule on Ubuntu 24.04.
shared-mime-info update writes a magic file Original / libxml / usage-shared-mime-info-r9-update-magic-section Passed
Rebuilds the shared-mime-info database from /usr/share/mime/packages into a temp prefix and verifies that mime.cache, magic, and globs are produced.
shared-mime-info RSS and Atom globs Original / libxml / usage-shared-mime-info-rss-atom-globs Passed
Rebuilds the shared-mime-info database and verifies that XML-derived feed types (application/rss+xml and application/atom+xml) appear in the generated globs2 and types files with the expected extensions, exercising libxml2 parsing of MIME packages.
shared-mime-info subclass chain registration Original / libxml / usage-shared-mime-info-subclass-chain-r8 Passed
Stages a synthetic MIME package that declares a custom application/x-validator-config+xml type as a sub-class-of application/xml, runs update-mime-database to parse it through libxml2, and verifies the rebuilt subclasses file records the parent relationship and that types/globs2 also list the new entry.
shared-mime-info SVG magic detect Original / libxml / usage-shared-mime-info-svg-magic-detect Passed
Builds a private MIME database from the system shared-mime-info packages and verifies that a synthetic SVG payload is identified as image/svg+xml via the rebuilt globs2 plus magic data, exercising libxml2 SAX through update-mime-database.
shared-mime-info update-mime-database exit code Original / libxml / usage-shared-mime-info-update-mime-database-exit-code Passed
Builds a private MIME database from the system shared-mime-info packages, asserts update-mime-database exits with status 0, then runs it again pointing at a directory with no packages subdirectory and verifies it exits non-zero, exercising libxml2 SAX through update-mime-database error and success paths.
shared-mime-info xhtml and html globs Original / libxml / usage-shared-mime-info-xhtml-html-globs Passed
Rebuilds the shared-mime-info database from the system MIME packages and verifies that application/xhtml+xml and text/html types appear with their canonical extensions in globs2 plus a text/html magic block, exercising libxml2 SAX through update-mime-database.
xmlstarlet append attribute Original / libxml / usage-xmlstarlet-append-attribute Passed
xmlstarlet appends node Original / libxml / usage-xmlstarlet-append-node Passed
xmlstarlet c14n root Original / libxml / usage-xmlstarlet-c14n-root Passed
Canonicalizes XML with xmlstarlet c14n and verifies the canonical output retains the namespaced note element.
xmlstarlet c14n with comments Original / libxml / usage-xmlstarlet-c14n-with-comments-batch11 Passed
xmlstarlet canonical XML Original / libxml / usage-xmlstarlet-c14n Passed
xmlstarlet concat text Original / libxml / usage-xmlstarlet-concat-text Passed
xmlstarlet concatenates values Original / libxml / usage-xmlstarlet-concat-values Passed
xmlstarlet count nodes Original / libxml / usage-xmlstarlet-count-nodes Passed
xmlstarlet deletes attribute Original / libxml / usage-xmlstarlet-delete-attribute Passed
Deletes an XML attribute with xmlstarlet edit mode and verifies the serialized element no longer carries the attribute.
xmlstarlet deletes node Original / libxml / usage-xmlstarlet-delete-node Passed
xmlstarlet ed delete all comment nodes Original / libxml / usage-xmlstarlet-ed-delete-comments Passed
Runs xmlstarlet ed with a -d expression that selects every XML comment node anywhere in the document and verifies the result preserves all element content and attributes while removing every comment, including comments nested inside child elements.
xmlstarlet edit add attribute Original / libxml / usage-xmlstarlet-edit-add-attribute Passed
Adds an XML attribute with xmlstarlet ed and verifies the new attribute value in the updated document.
xmlstarlet edit append node Original / libxml / usage-xmlstarlet-edit-append-node Passed
Appends a new element with xmlstarlet ed and verifies the inserted node text in the updated document.
xmlstarlet edit delete node Original / libxml / usage-xmlstarlet-edit-delete-node Passed
Deletes an XML node with xmlstarlet edit and verifies the removed text no longer appears in the output.
xmlstarlet ed insert before sibling Original / libxml / usage-xmlstarlet-edit-insert-before Passed
Inserts a new sibling element before an existing node with xmlstarlet ed -i and verifies the resulting child sequence and exact node count match the expected ordering.
xmlstarlet ed -s subnode text + attr combined Original / libxml / usage-xmlstarlet-edit-insert-pi-r7 Passed
Uses xmlstarlet ed to combine a text-typed subnode insertion (-s -t text) with an attribute insertion (-i -t attr) in a single invocation, then verifies the rewritten document contains the expected text content and attribute values via xmlstarlet sel.
xmlstarlet ed -r renames an attribute Original / libxml / usage-xmlstarlet-edit-rename-attribute-r8 Passed
Uses xmlstarlet ed -r against an attribute XPath to rename id to ref on every <item> element, verifying the new attribute name carries the original values, the old name is gone, and elements counted under the new name match the input.
xmlstarlet rename item element Original / libxml / usage-xmlstarlet-edit-rename-item Passed
Renames an element with xmlstarlet ed -r and verifies the new tag is emitted while the original tag no longer appears.
xmlstarlet edit subnode Original / libxml / usage-xmlstarlet-edit-subnode-batch11 Passed
xmlstarlet edit update attribute Original / libxml / usage-xmlstarlet-edit-update-attr Passed
xmlstarlet edit xml Original / libxml / usage-xmlstarlet-edit-xml Passed
xmlstarlet elements list Original / libxml / usage-xmlstarlet-elements-list-batch11 Passed
xmlstarlet escapes text Original / libxml / usage-xmlstarlet-escape-text Passed
xmlstarlet escape unescape round trip Original / libxml / usage-xmlstarlet-escape-unescape-chain Passed
Pipes a string containing XML metacharacters through xmlstarlet esc to produce escaped entities and then through xmlstarlet unesc to recover the original payload, asserting both the intermediate escaped form and that the round-tripped output exactly equals the input.
xmlstarlet fo re-encode UTF-8 to ISO-8859-1 Original / libxml / usage-xmlstarlet-fo-encoding-iso8859 Passed
Pipes a UTF-8 XML document containing Latin-1-representable characters through xmlstarlet fo with -e ISO-8859-1, then verifies the produced declaration advertises ISO-8859-1, the bytes are no longer valid UTF-8 (proving an encoding conversion happened), and the original characters round-trip back to their UTF-8 form when decoded as ISO-8859-1.
xmlstarlet format indent Original / libxml / usage-xmlstarlet-format-indent-batch11 Passed
xmlstarlet format xml Original / libxml / usage-xmlstarlet-format-xml Passed
xmlstarlet inserts attribute Original / libxml / usage-xmlstarlet-insert-attribute Passed
xmlstarlet moves node Original / libxml / usage-xmlstarlet-move-node Passed
Moves an XML node with xmlstarlet edit mode and verifies the relocated node appears under the target element.
xmlstarlet namespace select Original / libxml / usage-xmlstarlet-namespace-select Passed
xmlstarlet omit declaration format Original / libxml / usage-xmlstarlet-omit-decl-format Passed
xmlstarlet pyx output Original / libxml / usage-xmlstarlet-pyx-output Passed
Converts XML to PYX line-oriented form with xmlstarlet pyx and verifies element and text records appear in the output.
xmlstarlet sel -c copies a matched subtree to output Original / libxml / usage-xmlstarlet-r10-sel-copy-of-subtree Passed
Selects with -c (copy) on a single subtree and asserts the emitted XML preserves the element name plus its inner content from the source document.
xmlstarlet sel normalize-space collapses whitespace Original / libxml / usage-xmlstarlet-r10-sel-normalize-space Passed
Applies XPath normalize-space() to a text node padded with leading, trailing, and interior whitespace, and asserts the printed value has whitespace collapsed to single spaces with edges trimmed.
xmlstarlet sel computes XPath string-length on element text Original / libxml / usage-xmlstarlet-r10-sel-string-length-fn Passed
Selects string-length() of a known text node and asserts the printed integer equals the byte-length of the source string.
xmlstarlet sel uses XPath translate to uppercase ASCII text Original / libxml / usage-xmlstarlet-r10-sel-translate-fn Passed
Applies the classic translate() ASCII-uppercase trick to a known mixed-case text value and asserts the output equals the all-uppercase form.
xmlstarlet ed -L deletes a matched node directly in the source file Original / libxml / usage-xmlstarlet-r11-ed-in-place-deletes Passed
Writes a small two-element XML document, runs xmlstarlet ed -L to delete one element by xpath against the file in place, and asserts the on-disk file lost the matched element while keeping the sibling.
xmlstarlet fo -n strips leading whitespace while keeping line breaks Original / libxml / usage-xmlstarlet-r11-fo-no-indent-flat Passed
Pipes a pre-indented document through xmlstarlet fo -n and asserts the emitted output preserves one element per line while removing the leading per-element indentation, distinguishing -n from the default indenting formatter.
xmlstarlet sel -i predicate emits the documented YES/NO marker Original / libxml / usage-xmlstarlet-r11-sel-if-then-emits-marker Passed
Runs xmlstarlet sel with a -t -i predicate that compares count() against the source tree and asserts a documents-with-match input emits "YES" while a documents-without-match input emits "NO" via mirrored if/elif templates.
xmlstarlet ed -m relocates a matched node to a new parent path Original / libxml / usage-xmlstarlet-r12-ed-move-node Passed
Edits a small two-section document with xmlstarlet ed -m to move /root/a/item under /root/b, and asserts /root/a no longer contains an item child while /root/b gains the item with its original text intact.
xmlstarlet sel substring-after() returns the suffix after a separator Original / libxml / usage-xmlstarlet-r12-sel-substring-after-fn Passed
Runs xmlstarlet sel -t -v with the XPath function substring-after(@name, '-') against an attribute that carries a hyphenated value, and asserts the emitted output is exactly the suffix portion of the attribute string.
xmlstarlet tr applies an XSLT 1.0 stylesheet from stdin and emits the rendered output Original / libxml / usage-xmlstarlet-r12-tr-output-pipeline Passed
Pipes an XML document through xmlstarlet tr with a stylesheet that wraps each item value in a <line> element, and asserts the output contains exactly three rendered lines with the original item values preserved.
xmlstarlet val -e rejects a malformed XML document with a non-zero exit code Original / libxml / usage-xmlstarlet-r12-val-rejects-malformed Passed
Pipes a malformed XML document through xmlstarlet val -e, asserts the command exits non-zero, and verifies a well-formed document still validates with exit 0 to confirm the validator is not failing unconditionally.
xmlstarlet ed --inplace -u modifies the file on disk without writing to stdout Original / libxml / usage-xmlstarlet-r13-ed-inplace-update Passed
Writes a small XML document, runs xmlstarlet ed --inplace -u to update an attribute value in place, asserts the on-disk file now carries the new value while the original element structure is preserved and that no extra .bak file is produced when --inplace is used without a backup suffix.
xmlstarlet pyx emits one PYX line per element open, attribute, text, and close Original / libxml / usage-xmlstarlet-r13-pyx-roundtrip-counts Passed
Runs xmlstarlet pyx on a small two-item XML document and asserts the emitted PYX stream contains the expected open-tag "(", attribute "A", text "-", and close-tag ")" line counts that match a hand-derived analysis of the input.
xmlstarlet sel concat() builds a composite string from multiple attribute values Original / libxml / usage-xmlstarlet-r13-sel-concat-attrs-fn Passed
Selects items from a small XML file using xmlstarlet sel with an XPath concat() expression that interleaves attribute values and a literal separator, and asserts the emitted line for each item matches the expected "id=...|tier=..." composite string.
xmlstarlet sel -t -m loop -v -n emits one value per line for each match Original / libxml / usage-xmlstarlet-r13-sel-for-each-newline Passed
Runs xmlstarlet sel with a -m loop over /catalog/item, prints each item text via -v "." and a newline via -n, and asserts the output is exactly four newline-separated values in document order without extra leading or trailing blank lines.
xmlstarlet c14n canonicalizes a document by alphabetizing each element's attributes Original / libxml / usage-xmlstarlet-r14-c14n-sorts-attributes Passed
Runs xmlstarlet c14n on a document whose attributes appear in non-alphabetical order on multiple elements, captures stdout, and asserts the canonicalized output reorders each element's attributes alphabetically (a before b on the root, m before z on the child) and expands self-closing tags into open/close pairs.
xmlstarlet ed --omit-decl emits the edited document without the XML declaration Original / libxml / usage-xmlstarlet-r14-ed-omit-decl-strips-prolog Passed
Edits an XML document with xmlstarlet ed --omit-decl plus an attribute update, captures stdout, and asserts the rewritten document carries the updated value but does NOT begin with the "<?xml" prolog that the same edit emits without --omit-decl.
xmlstarlet val --well-formed accepts well-formed XML and rejects malformed XML Original / libxml / usage-xmlstarlet-r14-val-well-formed-only Passed
Runs xmlstarlet val --well-formed against a well-formed document and asserts a "valid" verdict and exit 0. Repeats with a malformed document where the close tag is mismatched and asserts a non-zero exit code, demonstrating the well-formedness gate.
xmlstarlet ed -r renames every matched element to the supplied tag while preserving children and attributes Original / libxml / usage-xmlstarlet-r15-ed-rename-element Passed
Runs xmlstarlet ed -r against an XPath that matches multiple elements and asserts the rewritten output replaces the old tag with the new tag on every match while keeping each element's text and any attribute values intact.
xmlstarlet sel count(//item[@type='x']) returns the count of attribute-matching elements Original / libxml / usage-xmlstarlet-r15-sel-count-attribute-predicate Passed
Runs xmlstarlet sel with an XPath count() over a predicate that filters elements by an attribute value, and asserts the captured stdout equals the number of matching nodes (here, 2). Pins the XPath count() and predicate semantics through the xmlstarlet sel front-end.
xmlstarlet sel evaluates the XPath substring-before() function on a literal string argument Original / libxml / usage-xmlstarlet-r15-sel-substring-before-fn Passed
Runs xmlstarlet sel -t -v "substring-before('alpha-beta', '-')" against any well-formed input document and asserts the captured stdout is the literal "alpha", pinning the XPath 1.0 substring-before() semantics through xmlstarlet's selection harness.
xmlstarlet fo --indent-spaces 4 formats nested children with four-space indentation Original / libxml / usage-xmlstarlet-r16-fo-indent-spaces-four Passed
Runs xmlstarlet fo --indent-spaces 4 on a compact document with nested elements and asserts the reformatted output indents the <child> line with exactly four leading spaces (and the <grandchild> with exactly eight), confirming the indent-spaces setting takes effect.
xmlstarlet sel -t -v extracts the text value of an XPath-matched element Original / libxml / usage-xmlstarlet-r16-sel-value-of-xpath Passed
Runs xmlstarlet sel -t -v against an XPath that selects a specific <item> by attribute predicate, captures stdout, and asserts the output is exactly that element's text content with no surrounding markup.
xmlstarlet ed -a appends a new element after a target node and survives a re-parse Original / libxml / usage-xmlstarlet-r17-ed-append-attribute-roundtrip Passed
Runs xmlstarlet ed -a to append a new <item> after an existing one in a small XML document, then re-parses the output with xmlstarlet sel to count <item> children and asserts the count grew by one.
xmlstarlet tr applies an identity XSLT and preserves the input document structure Original / libxml / usage-xmlstarlet-r17-tr-inline-xslt-identity Passed
Runs xmlstarlet tr with a minimal identity XSLT stylesheet against a small XML input and asserts the transformed output contains the same root element and child <item> texts as the source, exercising libxslt through the xmlstarlet tr entry point.
xmlstarlet val exits 0 on well-formed input and non-zero on malformed input Original / libxml / usage-xmlstarlet-r17-val-exit-code-valid-vs-invalid Passed
Runs xmlstarlet val on a well-formed XML document (expects exit 0) and on a malformed one with an unclosed tag (expects non-zero exit), exercising the well-formedness validator's exit-code contract.
xmlstarlet c14n canonicalization sorts attributes into deterministic order Original / libxml / usage-xmlstarlet-r18-c14n-canonicalization-stable-order Passed
Feeds an XML element with attributes declared in non-canonical order to xmlstarlet c14n, then verifies the canonicalized output places attribute 'a' before attribute 'b' as required by Canonical XML 1.0.
xmlstarlet ed -u replaces a target node's text content in place Original / libxml / usage-xmlstarlet-r18-ed-update-text-replaces-node-content Passed
Runs xmlstarlet ed -u '//item/text()' to overwrite the text inside an <item> element with a new value, then re-parses the output with xmlstarlet sel and asserts the new value is observed.
xmlstarlet sel -t -v with count XPath returns the element count as an integer Original / libxml / usage-xmlstarlet-r18-sel-count-xpath-returns-integer Passed
Builds a small XML document with five <leaf> children, queries it via xmlstarlet sel -t -v 'count(//leaf)', and asserts the printed value is exactly 5 to pin the XPath count() integer-string emission.
xmlstarlet ed -i with -t attr adds a new attribute to an element via XPath Original / libxml / usage-xmlstarlet-r19-ed-insert-attribute-via-t-a Passed
Runs xmlstarlet ed -i //item -t attr -n status -v active to insert a 'status' attribute on the //item node, then queries the resulting document with xmlstarlet sel and asserts the attribute value reads back as 'active'.
xmlstarlet sel -t -m //item -v . -n prints each item's text on its own line Original / libxml / usage-xmlstarlet-r19-sel-template-match-text-extracts-values Passed
Feeds a small XML document with three <item> children to xmlstarlet sel using a -t -m //item template with -v . and -n separator, then asserts the output contains each item's text in document order, exercising the XPath template iteration path.
xmlstarlet val -w exits non-zero on an XML document with an unclosed tag Original / libxml / usage-xmlstarlet-r19-val-well-formed-rejects-unclosed-tag Passed
Writes an intentionally malformed XML document with an unclosed <a> tag, then runs xmlstarlet val -w which performs a well-formedness check only, and asserts the validator exits with a non-zero status while a separate well-formed sibling document exits zero.
xmlstarlet ed -u replaces an existing attribute's value in-document Original / libxml / usage-xmlstarlet-r20-ed-update-attribute-value Passed
Starts from an XML document with item[@status="old"], runs xmlstarlet ed -u //item/@status -v new and asserts that querying //item/@status on the result reads back 'new', exercising the libxml2-backed attribute update path in xmlstarlet ed.
xmlstarlet sel -t -v 'name(//item[1])' returns the literal string 'item' Original / libxml / usage-xmlstarlet-r20-sel-name-fn-returns-element-name Passed
Runs xmlstarlet sel -t -v with an XPath name() call targeting the first <item> element and asserts the printed output is exactly 'item', exercising the libxml2 XPath name() function through the xmlstarlet select pipeline.
xmlstarlet val -d rejects a document missing a DTD-required attribute with a non-zero exit Original / libxml / usage-xmlstarlet-r20-val-dtd-rejects-missing-required-attribute Passed
Builds a DTD that declares item with a required 'id' attribute and an instance missing that attribute, runs xmlstarlet val -d against it, and asserts the command exits non-zero, exercising the libxml2 DTD-validation rejection path in xmlstarlet val.
xmlstarlet fo --indent-tab emits tab-prefixed nested element lines Original / libxml / usage-xmlstarlet-r21-format-indent-tab-flag Passed
Runs xmlstarlet fo --indent-tab on a flat single-line XML document, then asserts the output contains at least one nested-element line that starts with a tab character — pinning xmlstarlet's libxml2-backed pretty-printer's tab-indent mode on Ubuntu 24.04.
xmlstarlet pyx emits open-paren/close-paren tag lines for each element start/end Original / libxml / usage-xmlstarlet-r21-pyx-output-emits-bracketed-tags Passed
Runs xmlstarlet pyx on a small XML tree and asserts the output contains lines starting with '(' (element open) and ')' (element close) for the root tag — pinning xmlstarlet's libxml2-backed PYX SAX-stream emission on Ubuntu 24.04.
xmlstarlet sel -t -v string(/r) emits the concatenated text content of the root Original / libxml / usage-xmlstarlet-r21-sel-string-fn-emits-text-content Passed
Runs xmlstarlet sel -t -v 'string(/r)' against a document with text spread across two siblings and asserts the result equals the concatenated text content — pinning xmlstarlet's libxml2 XPath string() function on Ubuntu 24.04.
xmlstarlet val -s exits non-zero for a document that violates the XSD's xs:integer typing Original / libxml / usage-xmlstarlet-r21-val-xsd-rejects-violation Passed
Builds an XSD requiring <num> to be xs:integer and an instance with <num>not-a-number</num>, runs xmlstarlet val -s and asserts the validator exits non-zero — pinning xmlstarlet's libxml2 XSD-validation rejection path on Ubuntu 24.04.
xmlstarlet ed updates element text Original / libxml / usage-xmlstarlet-r9-ed-update-value Passed
Uses xmlstarlet ed -u to replace a text node selected by XPath and verifies the new value appears in the output while the old value is gone.
xmlstarlet sel sums attribute values via XPath sum() Original / libxml / usage-xmlstarlet-r9-sel-distinct-values Passed
Selects sum(@n) over a list of numbered items and asserts the printed total matches the arithmetic sum.
xmlstarlet tr applies XSLT stylesheet Original / libxml / usage-xmlstarlet-r9-tr-stylesheet-pipeline Passed
Transforms an items list to plain text via xmlstarlet tr with a small XSLT stylesheet and verifies the concatenated values appear in order.
xmlstarlet val accepts well-formed and rejects broken XML Original / libxml / usage-xmlstarlet-r9-validate-well-formed Passed
Runs xmlstarlet val on a well-formed document expecting exit 0, then on a malformed document expecting non-zero exit and an error message.
xmlstarlet renames node Original / libxml / usage-xmlstarlet-rename-node Passed
xmlstarlet sel template build element Original / libxml / usage-xmlstarlet-sel-build-element Passed
Uses xmlstarlet sel -t with nested -e directives to construct a synthetic XML element wrapping a child element per matched node, and verifies the resulting structure has exactly one wrapper element with the expected child count and per-record attribute bindings.
xmlstarlet sel template copy match Original / libxml / usage-xmlstarlet-sel-copy-match Passed
Uses xmlstarlet sel -t -m //x -c "." to copy each matched element verbatim into the output stream and verifies that the emitted XML contains every original element with its attributes and text intact.
xmlstarlet sel template if/then/else branching Original / libxml / usage-xmlstarlet-sel-if-then-else Passed
Runs xmlstarlet sel with a template that walks /root/item and uses -if, -then, and -else to emit one literal for items above a numeric threshold and another for items below it, then verifies the produced output line for each item matches the expected branch.
xmlstarlet sel -N binds custom namespace prefix for XPath Original / libxml / usage-xmlstarlet-sel-namespace-prefix-r8 Passed
Selects values out of a namespaced document by binding a prefix via xmlstarlet sel -N to the document's namespace URI, demonstrating that the bound prefix on the command line need not match the document's source prefix and that count/string queries return the expected values.
xmlstarlet sel template -m -c -v sequence Original / libxml / usage-xmlstarlet-sel-template-match-mode-r7 Passed
Runs xmlstarlet sel with a -t template that uses -m to iterate item elements, -c to copy a nested element subtree per match, -v to extract an attribute value, and -n for newline separators, and verifies the emitted lines exactly match the expected per-item rendering.
xmlstarlet sel template multi-element Original / libxml / usage-xmlstarlet-sel-template-multi Passed
Uses xmlstarlet sel -t -m to iterate over multiple matching elements and emit one record per match, verifying the exact joined output and the total record count.
xmlstarlet select numeric cast Original / libxml / usage-xmlstarlet-sel-value-numeric-cast Passed
Uses xmlstarlet sel -t -v with the XPath number() function to coerce attribute strings to numbers, computes a sum of weight attributes through sum() and number() in separate templates, and verifies both the cast scalar values and the aggregate result.
xmlstarlet select attribute value Original / libxml / usage-xmlstarlet-select-attribute-value Passed
xmlstarlet select attribute Original / libxml / usage-xmlstarlet-select-attribute Passed
xmlstarlet selects count Original / libxml / usage-xmlstarlet-select-count Passed
xmlstarlet select if Original / libxml / usage-xmlstarlet-select-if-batch11 Passed
xmlstarlet namespaced note select Original / libxml / usage-xmlstarlet-select-namespace-note Passed
xmlstarlet namespaced tag select Original / libxml / usage-xmlstarlet-select-namespaced-tag Passed
Reads a namespaced element with xmlstarlet sel and a registered namespace prefix and verifies the selected text.
xmlstarlet select numeric sum Original / libxml / usage-xmlstarlet-select-sum-value Passed
xmlstarlet select text count Original / libxml / usage-xmlstarlet-select-text-count Passed
xmlstarlet select xml Original / libxml / usage-xmlstarlet-select-xml Passed
xmlstarlet tr XSLT identity transform Original / libxml / usage-xmlstarlet-tr-identity-transform Passed
Runs xmlstarlet tr with an XSLT identity transform that copies every node and attribute from the input document, and verifies that all source elements, attributes, and text content are preserved in the transformed output.
xmlstarlet tr applies XSLT with -s string parameter Original / libxml / usage-xmlstarlet-tr-xslt-with-stringparam-r8 Passed
Runs xmlstarlet tr to apply an XSLT stylesheet that consumes a top-level <xsl:param> populated via -s name=value on the command line, verifying the parameter value is interpolated into the output and the result also reflects the input data.
xmlstarlet transform XML Original / libxml / usage-xmlstarlet-transform-xml Passed
xmlstarlet unesc text roundtrip Original / libxml / usage-xmlstarlet-unescape-text Passed
Escapes a string with xmlstarlet esc, unescapes the result with xmlstarlet unesc, and verifies the recovered text matches the original byte-for-byte.
xmlstarlet update attribute Original / libxml / usage-xmlstarlet-update-attribute Passed
xmlstarlet updates node Original / libxml / usage-xmlstarlet-update-node Passed
xmlstarlet val -e verbose DTD diagnostics Original / libxml / usage-xmlstarlet-validate-dtd-inline-r7 Passed
Runs xmlstarlet val -e (verbose) against an external DTD declaring a required attribute and verifies a conforming document is reported "valid" while a non-conforming document is reported "invalid" with verbose, well-formed diagnostics naming the missing required attribute and a non-zero exit code.
xmlstarlet validate external DTD Original / libxml / usage-xmlstarlet-validate-external-dtd Passed
Validates an XML document against an external DTD file using xmlstarlet val -d, confirming a conforming document is reported valid and that a second document violating the DTD element model is reported invalid with a non-zero exit status.
xmlstarlet val RelaxNG Original / libxml / usage-xmlstarlet-validate-relaxng-schema Passed
Validates a conforming document and rejects a non-conforming document against a RelaxNG schema using xmlstarlet val -r and verifies the per-document validity verdicts.
xmlstarlet validate well-formed Original / libxml / usage-xmlstarlet-validate-well-formed Passed
Runs the xmlstarlet val -w well-formedness check on a document and verifies it reports the file as valid.
xmlstarlet validate xml Original / libxml / usage-xmlstarlet-validate-xml Passed
xmlstarlet val W3C XML Schema Original / libxml / usage-xmlstarlet-validate-xsd-schema-r8 Passed
Validates a conforming document against a W3C XML Schema (XSD) via xmlstarlet val -s and rejects a non-conforming document, verifying the per-document validity verdict text and that the bad case exits non-zero.
CVE-2003-1564 libxml regression Original / libxml / cve-2003-1564 Passed
Asserts that xmllint without --huge rejects a classic billion-laughs document via libxml2's built-in entity-expansion limits, instead of expanding entities to exhaust CPU and memory.
CVE-2007-6284 libxml regression Original / libxml / cve-2007-6284 Passed
Asserts that xmllint terminates within a bounded time on input containing invalid UTF-8 multibyte sequences, instead of looping forever inside xmlCurrentChar.
CVE-2008-3281 libxml regression Original / libxml / cve-2008-3281 Passed
Asserts that libxml2 applies entity-expansion limits to attribute-value substitution as well, rejecting a billion-laughs payload that lives in an attribute instead of element content.
CVE-2009-2414 libxml regression Original / libxml / cve-2009-2414 Passed
Asserts that libxml2 enforces a recursion bound on deeply nested DTD element declarations, surfacing a parse error rather than overflowing the C stack.
CVE-2013-0339 libxml regression Original / libxml / cve-2013-0339 Passed
Asserts that xmllint without --noent does not substitute external file entities, leaving the entity reference unresolved instead of disclosing local file contents.
CVE-2014-0191 libxml regression Original / libxml / cve-2014-0191 Passed
Asserts that xmllint --nonet honors the no-network flag for external parameter entities — a SYSTEM parameter entity pointing at an http:// URL must not be fetched.
CVE-2014-3660 libxml regression Original / libxml / cve-2014-3660 Passed
Asserts that libxml2's entity-expansion limits still apply even when --noent is passed (the post-CVE protection must not be bypassable by entity-substitution mode).
CVE-2016-3627 libxml regression Original / libxml / cve-2016-3627 Passed
Asserts that xmllint --recover does not recurse forever building a self-referential entity in error-tolerant parsing, terminating within the script timeout.
CVE-2016-3705 libxml regression Original / libxml / cve-2016-3705 Passed
Asserts that libxml2 enforces a recursion-depth limit across the entity-related parser helpers, surfacing an error rather than blowing the stack on deeply nested entity references.
CVE-2017-16932 libxml regression Original / libxml / cve-2017-16932 Passed
Asserts that libxml2 enforces a recursion limit on parameter-entity expansion, terminating a self-referential parameter-entity DTD with an error rather than recursing forever.
CVE-2017-18258 libxml regression Original / libxml / cve-2017-18258 Passed
Asserts that libxml2's xz-compressed input path is reachable from xmlReadFile and that a tiny xz file expanding to ~1 million empty elements is fully decompressed and parsed — the parser produces all expected nodes and peak RSS reflects that the decompressed XML actually landed in memory. Pre-fix libxml2 had no lzma memlimit at all and would happily inflate any expansion ratio; this case is the controlled-bomb regression for that attack surface.
CVE-2017-7375 libxml regression Original / libxml / cve-2017-7375 Passed
Asserts that the libxml2 Python bindings do not silently load and inline external entities under default parser flags — a SYSTEM file:// reference must not surface secret content in the parsed tree.
CVE-2018-14404 libxml regression Original / libxml / cve-2018-14404 Passed
Asserts that xmllint --xpath rejects an invalid XPath logical expression with an error rather than crashing on a NULL operand inside libxml2's XPath evaluator.
CVE-2020-7595 libxml regression Original / libxml / cve-2020-7595 Passed
Asserts that libxml2 does not loop forever in xmlStringLenDecodeEntities on truncated entity-bearing input (must terminate with a parse error, bounded by the script timeout).
CVE-2021-3541 libxml regression Original / libxml / cve-2021-3541 Passed
Asserts that libxml2 still applies entity-expansion budgets to a hostile entity graph that previously bypassed exponential-expansion protections by mixing parameter and general entities.
CVE-2024-40896 libxml regression Original / libxml / cve-2024-40896 Passed
Asserts that libxml2 with --nonoent and --nonet does not resolve external SYSTEM entities even when the document declares them — XXE bypass attempts must not surface external file content.
CVE-2025-9714 libxml regression Original / libxml / cve-2025-9714 Passed
Asserts that xmllint enforces XPath recursion-depth bounds across recursive sub-evaluations, returning an error on deeply nested predicates instead of overflowing the stack.
CVE-2026-0989 libxml regression Original / libxml / cve-2026-0989 Passed
Asserts that xmllint --relaxng terminates with an error on a self-referential RelaxNG <include> chain, instead of recursing forever and exhausting the stack.
CVE-2026-0990 libxml regression Original / libxml / cve-2026-0990 Passed
Asserts that xmlcatalog terminates with an error on a self-referential XML catalog delegate chain, instead of recursing forever via nextCatalog/delegateURI traversal.
Python libxml2 binding smoke Port / libxml / python-binding-smoke Passed
libxml reader C API behavior Port / libxml / reader-c-api-behavior Passed
Schema and XInclude checks Port / libxml / schema-xinclude-checks Passed
xmlcatalog lookup behavior Port / libxml / xmlcatalog-lookup Passed
xmllint parse and format Port / libxml / xmllint-parse-format Passed
lxml attrib items list Port / libxml / usage-python3-lxml-attrib-items-list Passed
Iterates the attribute mapping with python3-lxml's attrib.items and verifies the emitted attribute name-value pairs.
lxml attribute set Port / libxml / usage-python3-lxml-attribute-set Passed
lxml attribute update Port / libxml / usage-python3-lxml-attribute-update Passed
Updates an XML attribute through lxml and verifies the serialized output contains the new attribute value.
lxml BytesIO parse Port / libxml / usage-python3-lxml-bytesio-parse Passed
lxml C14N exclusive canonicalization Port / libxml / usage-python3-lxml-c14n-exclusive Passed
Canonicalizes XML through lxml etree.canonicalize with exclusive=True and verifies that unused namespace declarations are stripped from the canonical form while the in-scope namespace remains.
lxml canonicalize c14n Port / libxml / usage-python3-lxml-canonicalize-c14n Passed
Canonicalizes XML with python3-lxml's etree.canonicalize and verifies the attributes are reordered alphabetically.
lxml CDATA node Port / libxml / usage-python3-lxml-cdata-node Passed
lxml CDATA serialize Port / libxml / usage-python3-lxml-cdata-serialize Passed
lxml cleanup_namespaces with keep_ns_prefixes Port / libxml / usage-python3-lxml-cleanup-namespaces-keep-prefixes Passed
Calls etree.cleanup_namespaces in-place with the keep_ns_prefixes argument to retain a specified unused namespace declaration on the root, while still pruning a different unused declaration. Verifies the post-cleanup serialization keeps the kept prefix and drops the other.
lxml cleanup_namespaces removes unused namespaces Port / libxml / usage-python3-lxml-cleanup-namespaces Passed
Builds an XML tree with several namespace declarations on the root, only one of which is actually used by a child, then runs etree.cleanup_namespaces and verifies the unused declarations are stripped from the serialized output while the used namespace is preserved.
lxml etree.Comment insertion at index Port / libxml / usage-python3-lxml-comment-insert-position Passed
Creates a Comment node through etree.Comment(text), inserts it at a specific child index of a parent element using insert(), and verifies the serialized tree places the comment exactly between the targeted siblings without disturbing surrounding nodes.
lxml comment node Port / libxml / usage-python3-lxml-comment-node Passed
Creates an XML comment node through lxml and verifies the serialized output preserves the comment text.
lxml CSSSelector deep nested Port / libxml / usage-python3-lxml-cssselect-deep-nested Passed
Builds a CSSSelector and matches deeply nested elements through descendant selectors, verifying the exact match count and text values returned for a multi-level XML tree.
lxml custom URI resolver for entity Port / libxml / usage-python3-lxml-custom-resolver-r7 Passed
Registers a Resolver subclass on an etree.XMLParser that intercepts an external entity reference using a custom URI scheme and supplies in-memory replacement bytes via resolver.resolve_string(), then parses a document declaring that entity and verifies the parsed text matches the resolver's reply, exercising the libxml2 external entity loader hook.
lxml deepcopy text Port / libxml / usage-python3-lxml-deepcopy-text Passed
Deep-copies an XML tree with python3-lxml and verifies that mutating the clone leaves the original element text intact.
lxml DTD validation Port / libxml / usage-python3-lxml-dtd-validate Passed
lxml PythonElementClassLookup custom class Port / libxml / usage-python3-lxml-element-class-lookup Passed
Registers an etree.PythonElementClassLookup subclass on an XMLParser that returns a custom Element subclass for a specific tag, parses a document with the parser, and verifies the chosen elements are instances of the custom class while siblings remain plain etree elements.
lxml element maker Port / libxml / usage-python3-lxml-element-maker Passed
lxml etree.Element and SubElement programmatic build Port / libxml / usage-python3-lxml-element-subelement-build Passed
Builds an XML tree programmatically with lxml.etree.Element and SubElement, sets attributes via the constructor and the .set API, and verifies the serialized form, child count, and attribute ordering as exposed by lxml.
lxml ElementInclude include resolution Port / libxml / usage-python3-lxml-elementinclude-include Passed
Stages a parent XML document with an xi:include referencing a sibling fragment, resolves the include through lxml.ElementInclude.include rather than tree.xinclude(), and verifies that the included element appears in the resolved tree with its text and attributes preserved.
lxml ElementPath findall count Port / libxml / usage-python3-lxml-elementpath-findall-count Passed
Uses lxml ElementPath findall on a tree and verifies the exact element count and the joined text values returned by find/findtext on the same path.
lxml elementpath findtext Port / libxml / usage-python3-lxml-elementpath-findtext Passed
python3-lxml fromstring attribute Port / libxml / usage-python3-lxml-fromstring-attribute Passed
lxml fromstring bytes Port / libxml / usage-python3-lxml-fromstring-bytes Passed
lxml fromstring with custom XMLParser settings Port / libxml / usage-python3-lxml-fromstring-custom-parser Passed
Parses XML through etree.fromstring using a custom XMLParser configured with remove_blank_text and remove_comments and verifies that whitespace-only text nodes and comments are stripped from the resulting tree.
lxml Element.getparent traversal up to root Port / libxml / usage-python3-lxml-getparent-chain-r8 Passed
Looks up a deeply nested element via XPath and walks Element.getparent() repeatedly to recover the full ancestor tag chain ending at the root, verifying the exact ordered tag sequence including a namespaced ancestor.
lxml getpath second item Port / libxml / usage-python3-lxml-getpath-second-item Passed
Locates the second item through python3-lxml and verifies that ElementTree.getpath reports the expected absolute path.
lxml getroottree tag Port / libxml / usage-python3-lxml-getroottree-tag Passed
Walks back to the document root with python3-lxml's getroottree and verifies the root element tag name.
lxml.html HtmlElement cssselect Port / libxml / usage-python3-lxml-html-cssselect Passed
Parses HTML with lxml.html and uses HtmlElement.cssselect to pick elements by tag and class, verifying the exact list of matched text content from a small fixture.
lxml html.fromstring body access Port / libxml / usage-python3-lxml-html-fromstring-body Passed
Parses an HTML fragment with lxml.html.fromstring, accesses the implicitly-created body element via the .body attribute, and verifies the tag, child count, and selected text content of the parsed document.
lxml html.fromstring head access Port / libxml / usage-python3-lxml-html-fromstring-head Passed
Parses an HTML document with lxml.html.fromstring, accesses the .head attribute on the resulting document, and verifies the head's tag name, child element tags, and the title text content extracted via the head subelement.
lxml HTML parse Port / libxml / usage-python3-lxml-html-parse Passed
lxml HTMLParser recover Port / libxml / usage-python3-lxml-htmlparser-recover Passed
Parses malformed HTML with lxml.etree.HTMLParser in recovery mode and verifies the recovered tree contains the expected tag set with exact element counts.
lxml HTMLParser table structure Port / libxml / usage-python3-lxml-htmlparser-table Passed
Parses an HTML fragment containing a table with a thead and tbody through lxml.etree.HTMLParser, then verifies that the parser auto-completes the document structure and that the row, cell, and text counts in the resulting tree match the input layout.
lxml parser huge_tree toggle Port / libxml / usage-python3-lxml-huge-tree-disabled-r7 Passed
Builds an XML document with deeply nested elements that would exceed libxml2's default parser limits, parses it once with huge_tree=False to confirm normal-depth content is accepted, then parses with huge_tree=True to confirm the toggle is plumbed through to libxml2 by accepting the same content without raising.
python3-lxml item id join Port / libxml / usage-python3-lxml-item-id-join Passed
lxml etree.iter with multiple tag filter Port / libxml / usage-python3-lxml-iter-multi-tags Passed
Builds a mixed XML tree containing item, note, and meta elements, then calls Element.iter with a tuple of tag names and verifies the returned iterator yields elements of exactly the requested kinds in document order while skipping unrelated tags.
lxml iterancestors traversal Port / libxml / usage-python3-lxml-iterancestors-chain Passed
Builds a four-level nested XML tree, locates the deepest element via XPath, and walks up the ancestor chain through Element.iterancestors verifying both the unfiltered ancestor sequence and a tag-filtered traversal that yields only matching ancestors in upward order.
lxml iterfind count Port / libxml / usage-python3-lxml-iterfind-count Passed
lxml iterparse start and end events Port / libxml / usage-python3-lxml-iterparse-start-end-events Passed
Parses XML via lxml.etree.iterparse subscribed to both start and end events and verifies the exact ordered event stream of (event,tag) tuples produced for a small fixture.
lxml iterparse tag filter with element clear Port / libxml / usage-python3-lxml-iterparse-tag-filter-r8 Passed
Drives lxml.etree.iterparse with a tag= filter that selects only end events for <item>, calls Element.clear() after each match to release children, and verifies the collected id attributes plus that the root retains zero children after the streaming pass.
lxml iterparse Port / libxml / usage-python3-lxml-iterparse Passed
lxml itertext join Port / libxml / usage-python3-lxml-itertext-join Passed
python3-lxml itertext Port / libxml / usage-python3-lxml-itertext Passed
lxml iterwalk start and end events Port / libxml / usage-python3-lxml-iterwalk-events Passed
Walks an in-memory etree with etree.iterwalk subscribing to start and end events, collects the ordered sequence of (event, tag) pairs, and verifies the expected nesting order including a nested element appearing between its parent's start and end events.
lxml iterwalk with tag filter Port / libxml / usage-python3-lxml-iterwalk-tag-filter Passed
Walks an etree with etree.iterwalk filtered to a specific tag, verifies the iterator yields only elements with that tag in document order, and confirms elements with other tag names are skipped.
lxml Element.makeelement with namespace map Port / libxml / usage-python3-lxml-makeelement-namespaced-r8 Passed
Creates a child element via Element.makeelement using an explicit nsmap that introduces a new prefix, attaches it to a root carrying a different default namespace, and verifies the serialized output emits both prefix declarations and uses Clark notation for the new element's tag in element.tag readout.
lxml namespaced attribute Port / libxml / usage-python3-lxml-namespace-attribute Passed
lxml namespace XPath Port / libxml / usage-python3-lxml-namespace-xpath Passed
lxml namespace map lookup Port / libxml / usage-python3-lxml-nsmap-lookup Passed
Runs a namespace-aware lookup through python3-lxml and verifies the selected namespaced text node.
lxml objectify array-like children access Port / libxml / usage-python3-lxml-objectify-array-children Passed
Reads an XML document through lxml.objectify and verifies the array-like access pattern over repeated children, including indexed access, len() of a repeated element, and iteration order across all siblings sharing a tag.
lxml objectify attribute Port / libxml / usage-python3-lxml-objectify-attribute-batch11 Passed
lxml etree.parse with no_network parser Port / libxml / usage-python3-lxml-parse-no-network Passed
Parses an on-disk XML file via etree.parse using an XMLParser configured with no_network=True, asserts the parser's no_network flag is honored, and verifies the resulting tree has the expected root tag and child count without making any network access.
lxml etree.parse with recover=True from file Port / libxml / usage-python3-lxml-parse-recover-from-file Passed
Writes a tiny malformed XML document to disk, parses it through etree.parse using an XMLParser configured with recover=True, and verifies the recovered tree exposes the partial content without raising while the parser's error_log records the recovered errors.
lxml parse UTF-8 non-ASCII payload Port / libxml / usage-python3-lxml-parse-utf8-non-ascii Passed
Parses an XML document containing non-ASCII UTF-8 text (Greek, Cyrillic, and CJK characters) and an XML declaration encoding=UTF-8 through lxml.etree.parse, then verifies that text content round-trips byte-for-byte and the XPath string() of each element returns the expected non-ASCII payload.
python3-lxml parse xml Port / libxml / usage-python3-lxml-parse-xml Passed
lxml etree.PI factory and insertion Port / libxml / usage-python3-lxml-pi-factory-insertion Passed
Creates a processing instruction node through the etree.PI(target, text) factory, inserts it as the first child of an element via insert(), and verifies the serialized output places the PI at the expected position with the correct target and content.
lxml pretty print Port / libxml / usage-python3-lxml-pretty-print Passed
lxml processing instruction Port / libxml / usage-python3-lxml-processing-instruction-batch11 Passed
lxml QName localname Port / libxml / usage-python3-lxml-qname-localname Passed
lxml QName tag access via element creation Port / libxml / usage-python3-lxml-qname-tag-text Passed
Constructs an element using lxml.etree.QName with both a namespace URI and a localname, verifies the element tag is rendered in Clark notation, then reads the QName.text representation and the parsed namespace and localname back out, exercising lxml QName tag-access semantics.
lxml Element addnext and addprevious insert siblings Port / libxml / usage-python3-lxml-r10-addnext-addprevious Passed
Builds a sibling chain via Element.addnext() and Element.addprevious() relative to a pivot element, then asserts the resulting child order is exactly previous, pivot, next.
lxml Element.replace swaps a child in place preserving order Port / libxml / usage-python3-lxml-r10-element-replace-child Passed
Parses a parent with three children, calls Element.replace() to swap the middle child for a freshly built element, and asserts the new tag appears at the original position with siblings intact.
lxml.html.iterlinks enumerates href and src URLs Port / libxml / usage-python3-lxml-r10-html-iterlinks-href-src Passed
Parses an HTML fragment with anchor and image tags, walks lxml.html.iterlinks() and asserts both the href URL on the <a> tag and the src URL on the <img> tag are reported with their attribute names.
lxml etree.tostring writes XML decl with standalone='yes' Port / libxml / usage-python3-lxml-r10-tostring-standalone-decl Passed
Serializes an ElementTree with xml_declaration=True and standalone=True, and asserts the emitted prolog includes encoding='UTF-8' and standalone='yes'.
lxml etree.tostring with method='text' returns concatenated text Port / libxml / usage-python3-lxml-r10-tostring-text-method Passed
Builds a small element tree with mixed text and tail content, serializes it with method='text', and asserts that markup is stripped and only the concatenated character data remains.
cssselect.GenericTranslator emits the documented XPath translation Port / libxml / usage-python3-lxml-r11-cssselect-translator-xpath Passed
Asks cssselect.GenericTranslator().css_to_xpath to translate "div.foo > a" and asserts the resulting XPath uses the descendant-or-self axis with the documented class normalization predicate that selects child a elements of div.foo.
lxml etree.fromstringlist joins arbitrary chunk boundaries into one tree Port / libxml / usage-python3-lxml-r11-fromstringlist-rejoins Passed
Splits a complete XML document into chunks that intentionally cross tag boundaries, parses with etree.fromstringlist, and asserts the resulting root element name and child text values match the original document.
lxml.html.fragment_fromstring with create_parent wraps multiple top-level fragments Port / libxml / usage-python3-lxml-r11-html-fragment-create-parent Passed
Calls lxml.html.fragment_fromstring on two sibling HTML elements with create_parent='div' and asserts the synthetic wrapper carries the requested tag plus both children with their original text content preserved.
lxml XMLParser resolve_entities=False keeps internal entity references unexpanded Port / libxml / usage-python3-lxml-r11-resolve-entities-disabled Passed
Parses a doctype-with-internal-entity document using etree.XMLParser(resolve_entities=False), serializes the result, and asserts the entity reference token survives instead of being replaced with its expansion.
lxml etree.strip_elements drops subtree but with_tail=False preserves between-text Port / libxml / usage-python3-lxml-r11-strip-elements-no-tail Passed
Calls etree.strip_elements with with_tail=False to remove a repeated child element while keeping the surrounding character data and inter-element text intact, asserting the resulting serialized form.
lxml etree.strip_tags removes wrappers but preserves contained text Port / libxml / usage-python3-lxml-r11-strip-tags-keeps-text Passed
Builds a small element tree containing repeated inline wrappers, calls etree.strip_tags to remove the wrapper element name, and asserts the serialized result keeps the surrounding plus inline text concatenated and drops the inline tags.
lxml.etree.iterparse end-event handler can elem.clear() each item without losing root tag Port / libxml / usage-python3-lxml-r12-iterparse-clear-frees-memory Passed
Streams a small XML document with iterparse, calls clear() on each end-event element, and asserts every item tag was visited and the root tag is still recoverable from the parser, exercising the documented streaming-with-clear pattern.
lxml etree.tostring with xml_declaration=True emits the prolog with the requested encoding Port / libxml / usage-python3-lxml-r12-tostring-xml-declaration Passed
Calls etree.tostring on a small element with xml_declaration=True and encoding='UTF-8', and asserts the serialized output begins with the canonical "<?xml version='1.0' encoding='UTF-8'?>" prolog followed by the element body.
lxml ElementTree.xinclude resolves a parse=xml href into the parent tree Port / libxml / usage-python3-lxml-r12-xinclude-xpointer-element Passed
Builds a host XML document that XIncludes an external file with parse="xml", runs ElementTree.xinclude(), and asserts the included root element is grafted into the host tree replacing the xinclude marker, with its child text content preserved.
lxml XPath returns native Python bool for boolean()-wrapped expressions Port / libxml / usage-python3-lxml-r12-xpath-boolean-result Passed
Evaluates two XPath expressions wrapped with boolean() against a tiny tree and asserts the results are returned as Python's True / False (not as a string or int), confirming lxml maps XPath xs:boolean to bool.
lxml XSLT with xsl:output method='text' emits the concatenated text without markup Port / libxml / usage-python3-lxml-r12-xslt-output-method-text Passed
Compiles an XSLT 1.0 stylesheet that declares xsl:output method='text', applies it to a tiny element tree, and asserts the resulting bytes contain only the concatenated value-of output with no XML angle brackets.
lxml.cssselect.CSSSelector matches attribute-equals selectors against an XML tree Port / libxml / usage-python3-lxml-r13-cssselect-attribute-equals Passed
Builds a small XML fragment of mixed-priority items and applies a compiled CSSSelector for "item[priority='high']" via lxml.cssselect, asserts the returned matches contain only the two high-priority items and their text bodies are recovered intact in document order.
lxml ElementTree.getpath returns the canonical XPath for a deeply nested element Port / libxml / usage-python3-lxml-r13-getroottree-getpath Passed
Builds a small tree, locates a specific leaf via xpath, calls getroottree().getpath(elem), and asserts the returned XPath is the exact predicate-indexed path the leaf has in the document and that re-applying the path to the tree yields the same element.
lxml etree.HTMLParser parses missing-close-tag HTML and recovers a usable tree Port / libxml / usage-python3-lxml-r13-htmlparser-malformed-recovery Passed
Feeds malformed HTML with unclosed and reordered tags into etree.HTMLParser via etree.fromstring, asserts the parser returns a tree (no exception), the document root is <html>, the body contains the expected paragraph text, the recovered list items are present in document order, and the recovered tree includes the body element.
lxml.objectify exposes typed pyval accessors for int/float/bool/str leaf elements Port / libxml / usage-python3-lxml-r13-objectify-pyval-typed-access Passed
Parses a small typed document with lxml.objectify, asserts each leaf's pyval is the correct native Python type (int, float, bool, str), and verifies arithmetic on the int/float pyvals matches the expected sum so the typed access path is fully exercised.
lxml etree.QName builds a Clark-notation tag and round-trips namespace and localname Port / libxml / usage-python3-lxml-r13-qname-roundtrip-build Passed
Constructs an etree.QName from a namespace URI and local name, uses it to build an Element and SubElement tree, and asserts the produced tags carry the expected Clark notation, the QName's namespace and localname properties match the inputs, and the serialized XML uses an "ns0" or explicit declared prefix for the namespace.
lxml ElementTree.write(method='c14n') emits canonical XML with sorted attributes Port / libxml / usage-python3-lxml-r14-elementtree-write-c14n Passed
Builds a tree whose root carries attributes in non-alphabetical order, calls tree.write(file, method='c14n'), and asserts the on-disk canonicalized output reorders attributes alphabetically and omits the XML declaration, matching W3C C14N expectations.
lxml etree.dump writes the indented serialization of an Element to stdout Port / libxml / usage-python3-lxml-r14-etree-dump-writes-stdout Passed
Calls etree.dump on a small Element with nested children, redirects the python process stdout to a file, and asserts the captured output is the indented XML representation of the element with the parent and child tags both present.
lxml etree.fromstring + xpath namespaces map resolves prefixed element queries Port / libxml / usage-python3-lxml-r14-fromstring-namespaces-xpath Passed
Parses an XML document carrying a non-default namespace, runs xpath with an explicit namespaces map mapping a local prefix to the namespace URI, and asserts the query returns the expected element text under both the prefixed and Clark-notation traversal paths.
lxml.html.fromstring().text_content() flattens nested element text into a single string Port / libxml / usage-python3-lxml-r14-html-text-content Passed
Parses an HTML fragment with nested inline elements via lxml.html.fromstring, calls .text_content() on the root, and asserts the returned string is the concatenation of every descendant text node in document order with no element markup remaining.
lxml etree.iselement returns True for Element objects and False for non-elements Port / libxml / usage-python3-lxml-r14-iselement-detection Passed
Calls etree.iselement on an Element, an ElementTree, a string, and None, and asserts only the Element returns True. This pins the public type-check predicate behavior used by libraries that bridge lxml objects.
lxml etree.XMLParser(remove_blank_text=True) drops whitespace-only text nodes during parsing Port / libxml / usage-python3-lxml-r14-xmlparser-remove-blank-text Passed
Parses an indented document with etree.XMLParser(remove_blank_text=True), serializes the tree back, and asserts the output is the compact form (no whitespace text nodes between elements). Compares against a default-parser parse of the same input which preserves the indentation.
lxml Element.clear() drops children, attributes, and text but preserves the element tag Port / libxml / usage-python3-lxml-r15-element-clear-keeps-tag Passed
Builds an Element with text, attributes, and child nodes, calls clear() on it, and asserts the tag is unchanged while text becomes None, the attribute map is empty, and the children list has length 0.
lxml Element.replace swaps a child element and drops the replaced node's tail text Port / libxml / usage-python3-lxml-r15-element-replace-drops-tail Passed
Builds a parent with two children where the first child carries tail text, calls parent.replace(old, new), and asserts the new element occupies the old position, the new element's tail is empty (the replaced node's tail is dropped), and the serialized output reflects the swap with the trailing tail removed.
lxml Element.iterancestors yields the parent chain in walk-up order and accepts a tag filter Port / libxml / usage-python3-lxml-r15-iterancestors-tag-filter Passed
Walks a deeply nested document and asserts iterancestors() with no argument yields tags in inner-to-outer order, while iterancestors('b') only yields the ancestors whose tag equals "b". Pins the lxml ancestor traversal contract used by selector libraries.
lxml etree.QName decomposes a Clark-notation tag into namespace and localname Port / libxml / usage-python3-lxml-r15-qname-from-tag Passed
Constructs an etree.QName from a namespace and localname, asserts its .text returns the Clark-notation form "{ns}local", that .localname and .namespace round-trip the inputs, and that QName(element) on a parsed namespaced element recovers the same Clark form.
lxml etree.tostring(with_tail=False) drops the trailing tail text of the serialized element Port / libxml / usage-python3-lxml-r15-tostring-with-tail-toggle Passed
Parses a document where a child element carries tail text, serializes the child with etree.tostring twice (with_tail=True default and with_tail=False), and asserts the default form preserves the tail string while with_tail=False produces the element-only serialization.
lxml etree.XMLParser.feed accepts the document in chunks and returns the root via close() Port / libxml / usage-python3-lxml-r15-xmlparser-feed-incremental Passed
Drives an etree.XMLParser by feeding the document in five disjoint byte slices via parser.feed(), then calls parser.close() and asserts the returned Element has the expected root tag, child count, and serialized form, demonstrating incremental parsing.
lxml Element.attrib.update bulk-applies a dict and overwrites existing keys Port / libxml / usage-python3-lxml-r16-attrib-update-bulk-overwrite Passed
Builds an element with two initial attributes, calls attrib.update with a dict that overwrites one and introduces two new keys, and asserts the resulting attribute map contains the union with the overwritten value taking precedence, exercising the MutableMapping-style update contract.
lxml etree.Comment and etree.ProcessingInstruction nodes appended to a tree survive tostring round-trip Port / libxml / usage-python3-lxml-r16-comment-and-pi-roundtrip Passed
Appends an etree.Comment and an etree.ProcessingInstruction to an element, serializes via tostring, parses the result, and asserts the comment text and PI target/data come back identically — confirming both node types survive a serialize/parse cycle.
lxml CSSSelector matches .class and #id selectors against parsed HTML Port / libxml / usage-python3-lxml-r16-cssselect-class-and-id-selector Passed
Parses an HTML fragment with lxml.html.fromstring, compiles a 'div.note' and a '#main' CSSSelector, and asserts each selector returns the expected element count and the matched element's text content — exercising the cssselect translation layer on top of libxml2.
lxml.html.fragment_fromstring with create_parent wraps mixed text and inline children under the requested tag Port / libxml / usage-python3-lxml-r16-html-fragment-fromstring-create-parent Passed
Calls lxml.html.fragment_fromstring on a fragment containing both text and inline elements with create_parent='section', and asserts the returned element has tag 'section', preserves the leading text content, and lists the expected child tags in source order.
lxml Element.iter(tag) yields only elements matching the supplied local-name filter Port / libxml / usage-python3-lxml-r16-iter-tag-filter-count Passed
Builds a tree with interleaved <a> and <b> children, asserts list(doc.iter('a')) has length 3, list(doc.iter('b')) has length 2, and list(doc.iter()) (unfiltered) has length 6 including the root — covering the iter tag-filter contract.
lxml etree.XMLSchema accepts a valid instance and rejects one missing a required element Port / libxml / usage-python3-lxml-r16-xmlschema-rejects-invalid-then-validates-valid Passed
Compiles an XSD that requires an <id> child of <person>, asserts validate(valid_doc) returns True and validate(invalid_doc) returns False with error_log non-empty, exercising libxml2's XML Schema validator path through lxml.
lxml XSLT inline stylesheet rewrites element to <out value="N"> for each input node Port / libxml / usage-python3-lxml-r16-xslt-attribute-set-output Passed
Compiles a small XSLT 1.0 stylesheet that maps <item><val>N</val></item> to <out value="N"/>, applies it to a three-item document, and asserts the serialized result contains exactly three <out> elements with attribute values 1, 2, 3 in order.
lxml Element .tail text is preserved across a tostring round-trip Port / libxml / usage-python3-lxml-r17-element-tail-roundtrip Passed
Builds two sibling SubElements, sets the tail of the first to ' between ', serializes the tree, and asserts the tail text appears verbatim between the two child tags in the serialized form.
lxml HTMLParser parses a fragment with unclosed inline tags without raising Port / libxml / usage-python3-lxml-r17-html-parser-unclosed-tag-recovery Passed
Feeds an HTML fragment with unclosed <p> tags through lxml.html.fromstring (HTMLParser), and asserts the resulting tree exposes two <p> elements with the expected text content — exercising HTML5-style recovery on malformed input.
lxml etree.iterparse with end events yields one event per closing tag in the stream Port / libxml / usage-python3-lxml-r17-iterparse-end-event-count Passed
Streams a small XML document through etree.iterparse with events=('end',), collects the tag names of each emitted end event, and asserts the count and ordering match the document's closing-tag sequence — exercising libxml2's incremental parser through lxml.
lxml etree.XML with a declared namespace prefix preserves the prefix on serialization Port / libxml / usage-python3-lxml-r17-namespace-prefix-preserved-on-roundtrip Passed
Parses an XML string declaring xmlns:ns0='http://example.org/ns' with an element using that prefix, serializes the tree via tostring, and asserts the output contains the same 'ns0:' prefix and namespace URI — exercising libxml2's namespace bookkeeping through lxml.
lxml etree.parse accepts an io.BytesIO handle and yields the expected root tag Port / libxml / usage-python3-lxml-r17-parse-from-stringio-handle Passed
Wraps a small XML payload in an io.BytesIO, passes it to etree.parse, and asserts the resulting tree's getroot().tag is 'root' and the child <item> count matches the source — exercising lxml's file-like parser path.
lxml etree.SubElement with .text yields the expected serialized shape Port / libxml / usage-python3-lxml-r17-subelement-text-tostring-shape Passed
Builds an Element with two SubElement children carrying text, serializes via etree.tostring with encoding='unicode', and asserts the result contains both child tags with their text bodies in document order — exercising the basic tree construction + serialization path.
lxml etree.XPath compiled expression returns the same results as Element.xpath Port / libxml / usage-python3-lxml-r17-xpath-compiled-vs-adhoc-equiv Passed
Compiles an XPath via etree.XPath once and evaluates it against a tree, then evaluates the same XPath ad-hoc via Element.xpath, and asserts both return the same list of element texts — pinning the compiled-vs-adhoc result equivalence contract.
lxml _Element addnext and addprevious place siblings at the expected positions Port / libxml / usage-python3-lxml-r18-addnext-addprevious-sibling-order Passed
Constructs an element list, uses addnext and addprevious to insert siblings around a middle element, and asserts the resulting in-order tag sequence matches the expected ordering pinned by the API contract.
lxml iterparse with tag filter yields only elements matching the requested tag Port / libxml / usage-python3-lxml-r18-iterparse-tag-filter-counts Passed
Streams an XML payload through etree.iterparse with tag='item' and asserts the iterator yields exactly three end events corresponding to the three <item> elements in the input, ignoring all other tags.
lxml etree.strip_attributes removes the named attribute from all matching elements Port / libxml / usage-python3-lxml-r18-strip-attributes-removes-named-attr Passed
Builds a tree with multiple elements that carry a removable 'tmp' attribute, invokes etree.strip_attributes(tree, 'tmp'), and asserts no element retains the attribute while leaving other attributes intact.
lxml etree.XMLSchema accepts conformant XML and rejects non-conformant XML Port / libxml / usage-python3-lxml-r18-xmlschema-validate-valid-and-invalid Passed
Builds an etree.XMLSchema from an inline XSD and asserts a conformant document validates True while a non-conformant document (extra unexpected element) validates False, exercising the libxml2 XSD path through lxml.
lxml etree.XSLT identity stylesheet preserves the root tag and child count Port / libxml / usage-python3-lxml-r18-xslt-identity-transform-roundtrip Passed
Compiles an XSLT identity stylesheet via lxml.etree.XSLT, applies it to a small input document, and asserts the transformed tree has the same root tag and child element count as the source — exercising the libxslt-backed transform path.
lxml etree.cleanup_namespaces removes an unused namespace declaration from the tree Port / libxml / usage-python3-lxml-r19-cleanup-namespaces-removes-unused-ns Passed
Builds a tree where the root declares two namespaces but only one is actually used, calls etree.cleanup_namespaces(tree), and asserts the serialized output drops the unused namespace while keeping the in-use one.
lxml builder.ElementMaker constructs a nested namespaced element with attributes Port / libxml / usage-python3-lxml-r19-element-maker-builds-namespaced-tree Passed
Uses lxml.builder.ElementMaker with a namespace and nsmap to build a root containing a single child carrying an attribute, then serializes the tree and asserts the namespace declaration and child element both appear with the expected prefix.
lxml etree.tostring with method=html emits non-void elements with explicit close tags Port / libxml / usage-python3-lxml-r19-htmlparser-tostring-method-html-no-self-close Passed
Parses a small HTML fragment via lxml.html.fromstring, serializes the tree with etree.tostring(method='html'), and asserts a non-void element like <p></p> is rendered with an explicit closing tag rather than a self-closing form — pinning libxml2's HTML serializer behavior.
lxml XMLParser remove_blank_text drops indentation-only text between elements Port / libxml / usage-python3-lxml-r19-parser-remove-blank-text-drops-whitespace Passed
Parses an indented XML document with etree.XMLParser(remove_blank_text=True), serializes the result, and asserts the output does not contain whitespace between sibling element tags — locking in the libxml2 blank-text suppression path through lxml.
lxml etree.tostring with xml_declaration=True emits an <?xml version="1.0"?> prolog Port / libxml / usage-python3-lxml-r19-tostring-xml-declaration-emitted Passed
Serializes a small element tree via etree.tostring with xml_declaration=True and encoding='utf-8', then asserts the resulting bytes begin with an XML declaration carrying the version and encoding attributes — pinning lxml's prolog emission contract.
lxml Element.xpath with explicit namespaces dict resolves a custom prefix Port / libxml / usage-python3-lxml-r19-xpath-namespaces-arg-resolves-prefix Passed
Parses an XML document declaring a namespace under prefix 'a', then invokes element.xpath('//a:leaf/text()', namespaces={'a': '...'}) and asserts the returned list equals the two text values 'one' and 'two' — exercising lxml's namespace-aware XPath path.
lxml element.text assignment with ampersand serializes as & via tostring Port / libxml / usage-python3-lxml-r20-element-set-text-roundtrips-through-tostring Passed
Creates an element, assigns text containing an ampersand (e.g. 'A & B'), serializes via etree.tostring, and asserts the resulting bytes contain '&' (escaped) and not a bare '&' — pinning the libxml2 entity-escape contract through lxml's text setter.
lxml iterparse with events=('end',) yields one event per element node in document order Port / libxml / usage-python3-lxml-r20-iterparse-end-events-count-matches-elements Passed
Feeds a three-deep XML document into etree.iterparse with events=('end',), collects the tag of each emitted event in order, and asserts the list equals ['leaf', 'mid', 'root'] — pinning the libxml2 SAX-driven iterparse end-event ordering through lxml.
lxml etree.strip_tags removes the named element while preserving inline text Port / libxml / usage-python3-lxml-r20-strip-tags-removes-named-element Passed
Builds a tree with mixed content '<r>a<b>middle</b>z</r>', calls etree.strip_tags(root, 'b') and asserts the serialized output is '<r>amiddlez</r>' — pinning lxml's strip_tags content-promotion behavior over libxml2's tree manipulation API.
lxml XMLParser remove_comments=True drops <!--..--> nodes from the parsed tree Port / libxml / usage-python3-lxml-r20-xmlparser-remove-comments-drops-comments Passed
Parses an XML document containing a comment node using etree.XMLParser(remove_comments=True), serializes back via tostring, and asserts the resulting output contains no '<!--' substring while still preserving the surrounding elements — pinning the libxml2 parser's comment-stripping path through lxml.
lxml XPath count(//item) returns a Python float equal to the literal child count Port / libxml / usage-python3-lxml-r20-xpath-count-fn-returns-integer-string Passed
Builds a tree with exactly three <item> children, evaluates the XPath count(//item) via tree.xpath, and asserts the returned value is a Python float of 3.0 — pinning libxml2's count() return-type contract through lxml's XPath bindings.
lxml XSLT identity transform preserves the number of leaf elements Port / libxml / usage-python3-lxml-r20-xslt-identity-transform-preserves-leaf-count Passed
Compiles an identity-stylesheet XSLT via etree.XSLT, applies it to a tree containing three <item> children, serializes the result, and asserts re-parsing it yields exactly three <item> nodes — pinning the libxslt-driven identity transform's structural preservation through lxml.
lxml iterparse with events=('comment',) yields exactly the comment nodes in document order Port / libxml / usage-python3-lxml-r21-iterparse-comment-event Passed
Feeds a small document containing two comments interleaved with elements to lxml.etree.iterparse(events=('comment',)) and asserts the iterator yields exactly two ('comment', <node>) tuples whose text content matches the source comments — pinning lxml's libxml2-backed comment event emission.
lxml iterparse with events=('pi',) yields processing-instruction nodes with their targets Port / libxml / usage-python3-lxml-r21-iterparse-pi-event Passed
Parses a document containing two processing instructions through lxml.etree.iterparse(events=('pi',)) and asserts the iterator yields two pi events whose .target values match the source targets in document order — pinning lxml's libxml2 PI event surface.
lxml ElementTree.xinclude() resolves a file-based xi:include into the document tree Port / libxml / usage-python3-lxml-r21-xinclude-resolves-inline-content Passed
Writes two XML files where the parent uses <xi:include href="child.xml"/>, parses and calls ElementTree.xinclude(), then asserts the resulting serialization contains the child's <c> element — pinning lxml's libxml2 XInclude resolution on Ubuntu 24.04.
lxml XSLT accepts a string parameter via XSLT.strparam and emits it in the result Port / libxml / usage-python3-lxml-r21-xslt-string-param-passing Passed
Compiles an XSLT stylesheet that copies a top-level <param> value into the output, invokes the transform with XSLT.strparam('value'), and asserts the serialized output contains exactly that string — pinning lxml/libxslt parameter passing on Ubuntu 24.04.
lxml etree.tostring c14n2 strips comments Port / libxml / usage-python3-lxml-r9-c14n2-strip-comments Passed
Serialises a tree with method=c14n2 and strip_text=False, with_comments=False and asserts the resulting bytes drop the comment node.
lxml RelaxNG validate accepts and rejects Port / libxml / usage-python3-lxml-r9-relaxng-validate Passed
Compiles a RelaxNG schema and verifies it accepts a conforming document and rejects a non-conforming one.
lxml XPath honours namespace prefix mapping Port / libxml / usage-python3-lxml-r9-xpath-namespace-prefix Passed
Parses a document with a default namespace and runs an XPath using a custom prefix mapping, asserting the namespaced element is selected.
lxml XPath position predicate Port / libxml / usage-python3-lxml-r9-xpath-position Passed
Parses an items list and uses an XPath position() predicate to select the second item, asserting the text matches.
lxml XSLT identity transform Port / libxml / usage-python3-lxml-r9-xslt-identity-transform Passed
Compiles an identity XSLT 1.0 stylesheet and applies it to a tree, verifying the serialized result preserves the structure.
lxml recover parser Port / libxml / usage-python3-lxml-recover-parser Passed
lxml RelaxNG validation Port / libxml / usage-python3-lxml-relaxng Passed
lxml remove comments parser Port / libxml / usage-python3-lxml-remove-comments-parser-batch11 Passed
lxml SAX handler integration Port / libxml / usage-python3-lxml-sax-handler-integration Passed
Drives a custom xml.sax.ContentHandler from an in-memory lxml etree using lxml.sax.saxify, asserts the handler observes the expected ordered sequence of startElement / characters / endElement callbacks, and verifies element nesting via depth tracking.
python3-lxml schema xml Port / libxml / usage-python3-lxml-schema-xml Passed
lxml Schematron validation Port / libxml / usage-python3-lxml-schematron-validate Passed
Validates an XML document against an ISO Schematron schema with python3-lxml and verifies a violating document is rejected with an exact failure report message.
lxml normalize-space text Port / libxml / usage-python3-lxml-strip-text Passed
lxml SubElement and ElementTree write_c14n Port / libxml / usage-python3-lxml-subelement-write-c14n Passed
Builds a tree with etree.SubElement and serializes it to disk via ElementTree.write with method="c14n", then verifies the exact canonical bytes including alphabetic attribute ordering.
lxml tostring inclusive vs exclusive C14N Port / libxml / usage-python3-lxml-tostring-c14n-inclusive Passed
Serializes a subtree through etree.tostring with method='c14n' both inclusively and exclusively, then verifies that inclusive C14N retains ancestor-declared but unused namespaces while exclusive C14N drops them.
lxml tostring c14n2 method Port / libxml / usage-python3-lxml-tostring-c14n2 Passed
Serializes an XML tree through etree.tostring with method='c14n2' (the newer Canonical XML 2.0 serializer) and verifies the canonical attribute ordering and namespace handling of the output, distinct from the legacy method='c14n' path.
lxml tostring method html Port / libxml / usage-python3-lxml-tostring-method-html Passed
Parses an XML tree containing self-closing void elements, serializes it via etree.tostring with method='html', and verifies that void tags such as <br> and <img> are emitted in HTML form rather than as XML self-closing tags.
lxml tostring pretty_print exact bytes Port / libxml / usage-python3-lxml-tostring-pretty-bytes Passed
Serializes a small lxml tree with etree.tostring(pretty_print=True) and verifies the exact byte-for-byte output, asserting indentation and newline placement match the documented libxml2 pretty-printer behavior.
lxml tostring pretty Port / libxml / usage-python3-lxml-tostring-pretty Passed
lxml tree write Port / libxml / usage-python3-lxml-tree-write Passed
Writes an XML tree to disk through lxml and verifies the resulting file contains the expected declaration and node text.
lxml TreeBuilder build Port / libxml / usage-python3-lxml-treebuilder-build Passed
Builds a document incrementally with lxml TreeBuilder events and verifies the serialized output and exact attribute set of the constructed root element.
python3-lxml XInclude XML expansion Port / libxml / usage-python3-lxml-xinclude-xml Passed
lxml xmlfile streaming write Port / libxml / usage-python3-lxml-xmlfile-streaming-write Passed
Streams XML to disk with the etree.xmlfile incremental writer using element context managers, then re-parses the written file and verifies the root tag, total child count, and a specific child attribute through python3-lxml.
lxml XMLID map Port / libxml / usage-python3-lxml-xmlid-map Passed
lxml XMLParser remove_blank_text Port / libxml / usage-python3-lxml-xmlparser-remove-blank-text Passed
Parses an indented XML document with lxml.etree.XMLParser(remove_blank_text=True) and verifies that ignorable whitespace text nodes are dropped, leaving exactly the element children expected with no whitespace .text or .tail.
lxml XMLSchema complex XSD validate Port / libxml / usage-python3-lxml-xmlschema-complex-xsd Passed
Loads a multi-element XSD with type restrictions and required attributes, validates a conforming document successfully, then validates a non-conforming document (missing required attribute) and verifies the schema error log surfaces the specific validation failure.
lxml etree.XPath compiled expression reused across documents Port / libxml / usage-python3-lxml-xpath-compiled-reuse-r8 Passed
Compiles an etree.XPath expression with namespace bindings once and applies it to two distinct parsed documents, verifying that the same compiled XPath instance returns the per-document node counts and string values without reparsing the expression.
lxml XPath count() over filtered nodeset Port / libxml / usage-python3-lxml-xpath-count-function-r7 Passed
Compiles an XPath expression that counts item elements whose status attribute equals "ok" and verifies the libxml2 XPath engine returns the exact float count and that an unfiltered count() over the full nodeset returns the total cardinality.
python3-lxml XPath count Port / libxml / usage-python3-lxml-xpath-count Passed
lxml XPathEvalError on malformed expression Port / libxml / usage-python3-lxml-xpath-eval-error-r7 Passed
Submits a syntactically invalid XPath expression to etree.XPath compilation and verifies the libxml2 backend raises XPathSyntaxError, then submits an undefined function reference to a compiled XPath at evaluation time and verifies XPathEvalError is raised, confirming both error classes are surfaced from the C library.
lxml etree.XPath with extensions dict Port / libxml / usage-python3-lxml-xpath-extension-callable Passed
Compiles an etree.XPath expression with a custom extension function passed via the extensions= mapping (rather than via FunctionNamespace), invokes the XPath against an in-memory tree, and verifies the Python callable was called by the libxml2-backed XPath engine and returned the expected aggregated result.
lxml XPath last item text Port / libxml / usage-python3-lxml-xpath-last-item-text Passed
Selects the last item element with python3-lxml's last() XPath function and verifies the trailing item text.
lxml XPath multi-namespace count Port / libxml / usage-python3-lxml-xpath-multi-namespace-count Passed
Evaluates XPath expressions over a document that mixes two distinct namespaces and verifies the exact element counts returned for each namespace prefix binding.
lxml XPath string-length and concat Port / libxml / usage-python3-lxml-xpath-string-length-r7 Passed
Evaluates the XPath string-length() function on a selected element text and combines concat() with normalize-space() to produce a derived string, verifying both libxml2 XPath string functions return their canonical results.
lxml XPath string value Port / libxml / usage-python3-lxml-xpath-string-value Passed
Evaluates a string-valued XPath expression through python3-lxml and verifies the selected text node.
lxml XPath string Port / libxml / usage-python3-lxml-xpath-string Passed
lxml XPath sum weight Port / libxml / usage-python3-lxml-xpath-sum-weight Passed
Sums the weight attribute across item elements with python3-lxml and verifies the aggregated total.
lxml XPath variable Port / libxml / usage-python3-lxml-xpath-variable-batch11 Passed
python3-lxml xpath xml Port / libxml / usage-python3-lxml-xpath-xml Passed
lxml XPathEvaluator namespace bindings Port / libxml / usage-python3-lxml-xpathevaluator-namespaces Passed
Builds an etree.XPathEvaluator with explicit namespace bindings, evaluates several namespace-prefixed expressions against a multi-namespace document, and verifies returned node counts and string values match the expected bindings.
lxml XSLT extension function Port / libxml / usage-python3-lxml-xslt-extension-function Passed
Registers a Python XSLT 1.0 extension function via lxml and verifies the transform output applies the custom function.
lxml XSLT parameter Port / libxml / usage-python3-lxml-xslt-param Passed
lxml XSLT text output Port / libxml / usage-python3-lxml-xslt-text-output-batch11 Passed
python3-lxml xslt xml Port / libxml / usage-python3-lxml-xslt-xml Passed
shared-mime-info alias entry registration Port / libxml / usage-shared-mime-info-alias-resolution-r7 Passed
Stages a synthetic MIME package that declares application/x-validator-canonical with an alias element pointing at application/x-validator-old, runs update-mime-database to parse it through libxml2, and verifies the rebuilt aliases file maps the alias name to the canonical type and that both type names are listed in the types file.
shared-mime-info custom MIME with multiple globs Port / libxml / usage-shared-mime-info-custom-multi-glob Passed
Stages a synthetic MIME package that defines a single application-defined type with three distinct glob patterns (suffix, prefix, and directory wildcard), runs update-mime-database to install it, then verifies that every glob is registered in globs2 and resolves back to the same MIME type, exercising libxml2 SAX parsing of multi-glob mime-type entries.
shared-mime-info derived XML MIME type install and uninstall Port / libxml / usage-shared-mime-info-derived-xml-type-install Passed
Stages a synthetic MIME package that defines an application/xml-derived type with a custom .vex extension, runs update-mime-database to install it, verifies the derived type is registered in globs2 and types and that XMLnamespaces records its root namespace, then removes the package, rebuilds, and verifies the synthetic type is no longer registered, exercising libxml2 SAX parsing through both install and uninstall code paths.
shared-mime-info custom magic priority emitted to magic file Port / libxml / usage-shared-mime-info-magic-priority-custom-r8 Passed
Stages a synthetic MIME package that declares a custom magic match with a non-default priority and a literal byte signature, runs update-mime-database to parse it through libxml2, and verifies the rebuilt magic file emits the priority header for the new type and that types/globs2 also reflect the registration.
shared-mime-info magic priority install Port / libxml / usage-shared-mime-info-magic-priority-r7 Passed
Stages a synthetic MIME package that defines an application/x-validator-magic type with a magic match rule keyed on a fixed leading byte sequence and priority 60, runs update-mime-database to parse it through libxml2, and verifies the rebuilt magic file lists the synthetic type with the declared priority and that the rule appears before lower-priority entries.
shared-mime-info mime cache build Port / libxml / usage-shared-mime-info-mime-cache-build Passed
Runs update-mime-database against the staged freedesktop MIME packages and verifies the rebuilt mime.cache plus globs2 entries for text/plain and application/xml, exercising libxml2 SAX parsing through shared-mime-info.
shared-mime-info installs custom MIME with explicit icon element Port / libxml / usage-shared-mime-info-r10-icon-element-types Passed
Stages a synthetic MIME package that declares an explicit <icon> element on a custom mime-type, runs update-mime-database, and asserts the type is recorded in the generated types file along with a non-empty mime.cache.
shared-mime-info preserves explicit glob weight column in globs2 Port / libxml / usage-shared-mime-info-r11-glob-weight-recorded Passed
Stages a synthetic MIME package whose <glob> declares an explicit weight="80" attribute, runs update-mime-database, and asserts the generated globs2 file lists the weight in the leading numeric column for the custom MIME type.
shared-mime-info records an explicit alias entry in aliases after update-mime-database Port / libxml / usage-shared-mime-info-r12-update-mime-database-aliases Passed
Stages a synthetic MIME package whose mime-type declares an explicit <alias type="..."/> child, runs update-mime-database against the staging tree, and asserts the generated aliases file lists the alias mapped to the canonical custom MIME type.
shared-mime-info preserves localized xml:lang comments through update-mime-database Port / libxml / usage-shared-mime-info-r13-comment-localized Passed
Stages a synthetic MIME package whose mime-type carries both a default-locale comment and a localized xml:lang="fr" comment, runs update-mime-database against the staging tree, and asserts the generated XML output for the custom MIME type retains both the default and the French comment text.
shared-mime-info records every glob pattern declared on a custom MIME type Port / libxml / usage-shared-mime-info-r14-multi-glob-patterns Passed
Stages a synthetic MIME package whose mime-type declares two distinct glob patterns, runs update-mime-database against the staging tree, and asserts the generated globs file lists both patterns mapped to the same canonical MIME type so multi-glob declarations are preserved.
shared-mime-info records a sub-class-of relationship in the subclasses index Port / libxml / usage-shared-mime-info-r15-subclass-default-text-plain Passed
Stages a synthetic MIME package whose mime-type declares <sub-class-of type="text/plain"/>, runs update-mime-database, and asserts the produced subclasses file lists the custom type as a direct subclass of text/plain in the canonical "<child> <parent>" form.
xdg-mime query filetype on a plain XML file resolves to an application/*xml MIME type Port / libxml / usage-shared-mime-info-r16-xdg-mime-query-plain-xml Passed
Writes a minimal well-formed XML document to disk, invokes xdg-mime query filetype on it, and asserts the resolved MIME type ends in 'xml' (e.g. application/xml or text/xml) — exercising the libxml2-backed mime-detection path through shared-mime-info's installed database.
shared-mime-info freedesktop.org.xml package ships an application/xml type entry Port / libxml / usage-shared-mime-info-r18-mime-cache-has-xml-package Passed
Inspects /usr/share/mime/packages/freedesktop.org.xml from the shared-mime-info package and asserts the file contains a mime-type element for application/xml — confirming the libxml-parsed source package is intact and registers the core XML MIME type.
xdg-mime query filetype identifies an SVG document as image/svg+xml Port / libxml / usage-shared-mime-info-r18-xdg-mime-detects-svg-image Passed
Writes a minimal SVG XML document and invokes xdg-mime query filetype (falling back to file --mime-type when xdg-mime is unavailable), then asserts the resolved type is image/svg+xml, exercising shared-mime-info's libxml-driven SVG detection rule.
shared-mime-info package declares xhtml glob and root-XML namespace for application/xhtml+xml Port / libxml / usage-shared-mime-info-r19-package-xhtml-glob-and-root-xml Passed
Inspects /usr/share/mime/packages/freedesktop.org.xml and asserts the application/xhtml+xml mime-type entry declares both the *.xhtml glob and a root-XML element scoped to the XHTML namespace — confirming the libxml-parsed shared-mime-info rules describe XHTML detection.
shared-mime-info package declares svg glob and the SVG root-XML namespace Port / libxml / usage-shared-mime-info-r20-package-svg-glob-and-root-xml Passed
Inspects /usr/share/mime/packages/freedesktop.org.xml and asserts the image/svg+xml mime-type entry declares both the *.svg glob pattern and a root-XML rule namespaced to http://www.w3.org/2000/svg — pinning the libxml-parsed shared-mime-info rules describe SVG detection.
update-mime-database builds a mime.cache from a minimal custom packages directory Port / libxml / usage-shared-mime-info-r21-update-mime-database-builds-cache Passed
Creates an isolated MIME data dir with a single packages/custom.xml declaring a glob/comment pair, runs update-mime-database on it, and asserts the resulting mime.cache binary file is present and non-empty — pinning libxml-driven update-mime-database build on a tiny package set on Ubuntu 24.04.
file --mime-type reports text/plain for a simple .txt input on a shared-mime-info system Port / libxml / usage-shared-mime-info-r21-xdg-mime-query-default-text Passed
Creates a small .txt file and runs file --mime-type, falling back gracefully and asserting the returned MIME type equals text/plain — pinning shared-mime-info's libxml-built text/plain detection rule on Ubuntu 24.04.
shared-mime-info update writes a magic file Port / libxml / usage-shared-mime-info-r9-update-magic-section Passed
Rebuilds the shared-mime-info database from /usr/share/mime/packages into a temp prefix and verifies that mime.cache, magic, and globs are produced.
shared-mime-info RSS and Atom globs Port / libxml / usage-shared-mime-info-rss-atom-globs Passed
Rebuilds the shared-mime-info database and verifies that XML-derived feed types (application/rss+xml and application/atom+xml) appear in the generated globs2 and types files with the expected extensions, exercising libxml2 parsing of MIME packages.
shared-mime-info subclass chain registration Port / libxml / usage-shared-mime-info-subclass-chain-r8 Passed
Stages a synthetic MIME package that declares a custom application/x-validator-config+xml type as a sub-class-of application/xml, runs update-mime-database to parse it through libxml2, and verifies the rebuilt subclasses file records the parent relationship and that types/globs2 also list the new entry.
shared-mime-info SVG magic detect Port / libxml / usage-shared-mime-info-svg-magic-detect Passed
Builds a private MIME database from the system shared-mime-info packages and verifies that a synthetic SVG payload is identified as image/svg+xml via the rebuilt globs2 plus magic data, exercising libxml2 SAX through update-mime-database.
shared-mime-info update-mime-database exit code Port / libxml / usage-shared-mime-info-update-mime-database-exit-code Passed
Builds a private MIME database from the system shared-mime-info packages, asserts update-mime-database exits with status 0, then runs it again pointing at a directory with no packages subdirectory and verifies it exits non-zero, exercising libxml2 SAX through update-mime-database error and success paths.
shared-mime-info xhtml and html globs Port / libxml / usage-shared-mime-info-xhtml-html-globs Passed
Rebuilds the shared-mime-info database from the system MIME packages and verifies that application/xhtml+xml and text/html types appear with their canonical extensions in globs2 plus a text/html magic block, exercising libxml2 SAX through update-mime-database.
xmlstarlet append attribute Port / libxml / usage-xmlstarlet-append-attribute Passed
xmlstarlet appends node Port / libxml / usage-xmlstarlet-append-node Passed
xmlstarlet c14n root Port / libxml / usage-xmlstarlet-c14n-root Passed
Canonicalizes XML with xmlstarlet c14n and verifies the canonical output retains the namespaced note element.
xmlstarlet c14n with comments Port / libxml / usage-xmlstarlet-c14n-with-comments-batch11 Passed
xmlstarlet canonical XML Port / libxml / usage-xmlstarlet-c14n Passed
xmlstarlet concat text Port / libxml / usage-xmlstarlet-concat-text Passed
xmlstarlet concatenates values Port / libxml / usage-xmlstarlet-concat-values Passed
xmlstarlet count nodes Port / libxml / usage-xmlstarlet-count-nodes Passed
xmlstarlet deletes attribute Port / libxml / usage-xmlstarlet-delete-attribute Passed
Deletes an XML attribute with xmlstarlet edit mode and verifies the serialized element no longer carries the attribute.
xmlstarlet deletes node Port / libxml / usage-xmlstarlet-delete-node Passed
xmlstarlet ed delete all comment nodes Port / libxml / usage-xmlstarlet-ed-delete-comments Passed
Runs xmlstarlet ed with a -d expression that selects every XML comment node anywhere in the document and verifies the result preserves all element content and attributes while removing every comment, including comments nested inside child elements.
xmlstarlet edit add attribute Port / libxml / usage-xmlstarlet-edit-add-attribute Passed
Adds an XML attribute with xmlstarlet ed and verifies the new attribute value in the updated document.
xmlstarlet edit append node Port / libxml / usage-xmlstarlet-edit-append-node Passed
Appends a new element with xmlstarlet ed and verifies the inserted node text in the updated document.
xmlstarlet edit delete node Port / libxml / usage-xmlstarlet-edit-delete-node Passed
Deletes an XML node with xmlstarlet edit and verifies the removed text no longer appears in the output.
xmlstarlet ed insert before sibling Port / libxml / usage-xmlstarlet-edit-insert-before Passed
Inserts a new sibling element before an existing node with xmlstarlet ed -i and verifies the resulting child sequence and exact node count match the expected ordering.
xmlstarlet ed -s subnode text + attr combined Port / libxml / usage-xmlstarlet-edit-insert-pi-r7 Passed
Uses xmlstarlet ed to combine a text-typed subnode insertion (-s -t text) with an attribute insertion (-i -t attr) in a single invocation, then verifies the rewritten document contains the expected text content and attribute values via xmlstarlet sel.
xmlstarlet ed -r renames an attribute Port / libxml / usage-xmlstarlet-edit-rename-attribute-r8 Passed
Uses xmlstarlet ed -r against an attribute XPath to rename id to ref on every <item> element, verifying the new attribute name carries the original values, the old name is gone, and elements counted under the new name match the input.
xmlstarlet rename item element Port / libxml / usage-xmlstarlet-edit-rename-item Passed
Renames an element with xmlstarlet ed -r and verifies the new tag is emitted while the original tag no longer appears.
xmlstarlet edit subnode Port / libxml / usage-xmlstarlet-edit-subnode-batch11 Passed
xmlstarlet edit update attribute Port / libxml / usage-xmlstarlet-edit-update-attr Passed
xmlstarlet edit xml Port / libxml / usage-xmlstarlet-edit-xml Passed
xmlstarlet elements list Port / libxml / usage-xmlstarlet-elements-list-batch11 Passed
xmlstarlet escapes text Port / libxml / usage-xmlstarlet-escape-text Passed
xmlstarlet escape unescape round trip Port / libxml / usage-xmlstarlet-escape-unescape-chain Passed
Pipes a string containing XML metacharacters through xmlstarlet esc to produce escaped entities and then through xmlstarlet unesc to recover the original payload, asserting both the intermediate escaped form and that the round-tripped output exactly equals the input.
xmlstarlet fo re-encode UTF-8 to ISO-8859-1 Port / libxml / usage-xmlstarlet-fo-encoding-iso8859 Passed
Pipes a UTF-8 XML document containing Latin-1-representable characters through xmlstarlet fo with -e ISO-8859-1, then verifies the produced declaration advertises ISO-8859-1, the bytes are no longer valid UTF-8 (proving an encoding conversion happened), and the original characters round-trip back to their UTF-8 form when decoded as ISO-8859-1.
xmlstarlet format indent Port / libxml / usage-xmlstarlet-format-indent-batch11 Passed
xmlstarlet format xml Port / libxml / usage-xmlstarlet-format-xml Passed
xmlstarlet inserts attribute Port / libxml / usage-xmlstarlet-insert-attribute Passed
xmlstarlet moves node Port / libxml / usage-xmlstarlet-move-node Passed
Moves an XML node with xmlstarlet edit mode and verifies the relocated node appears under the target element.
xmlstarlet namespace select Port / libxml / usage-xmlstarlet-namespace-select Passed
xmlstarlet omit declaration format Port / libxml / usage-xmlstarlet-omit-decl-format Passed
xmlstarlet pyx output Port / libxml / usage-xmlstarlet-pyx-output Passed
Converts XML to PYX line-oriented form with xmlstarlet pyx and verifies element and text records appear in the output.
xmlstarlet sel -c copies a matched subtree to output Port / libxml / usage-xmlstarlet-r10-sel-copy-of-subtree Passed
Selects with -c (copy) on a single subtree and asserts the emitted XML preserves the element name plus its inner content from the source document.
xmlstarlet sel normalize-space collapses whitespace Port / libxml / usage-xmlstarlet-r10-sel-normalize-space Passed
Applies XPath normalize-space() to a text node padded with leading, trailing, and interior whitespace, and asserts the printed value has whitespace collapsed to single spaces with edges trimmed.
xmlstarlet sel computes XPath string-length on element text Port / libxml / usage-xmlstarlet-r10-sel-string-length-fn Passed
Selects string-length() of a known text node and asserts the printed integer equals the byte-length of the source string.
xmlstarlet sel uses XPath translate to uppercase ASCII text Port / libxml / usage-xmlstarlet-r10-sel-translate-fn Passed
Applies the classic translate() ASCII-uppercase trick to a known mixed-case text value and asserts the output equals the all-uppercase form.
xmlstarlet ed -L deletes a matched node directly in the source file Port / libxml / usage-xmlstarlet-r11-ed-in-place-deletes Passed
Writes a small two-element XML document, runs xmlstarlet ed -L to delete one element by xpath against the file in place, and asserts the on-disk file lost the matched element while keeping the sibling.
xmlstarlet fo -n strips leading whitespace while keeping line breaks Port / libxml / usage-xmlstarlet-r11-fo-no-indent-flat Passed
Pipes a pre-indented document through xmlstarlet fo -n and asserts the emitted output preserves one element per line while removing the leading per-element indentation, distinguishing -n from the default indenting formatter.
xmlstarlet sel -i predicate emits the documented YES/NO marker Port / libxml / usage-xmlstarlet-r11-sel-if-then-emits-marker Passed
Runs xmlstarlet sel with a -t -i predicate that compares count() against the source tree and asserts a documents-with-match input emits "YES" while a documents-without-match input emits "NO" via mirrored if/elif templates.
xmlstarlet ed -m relocates a matched node to a new parent path Port / libxml / usage-xmlstarlet-r12-ed-move-node Passed
Edits a small two-section document with xmlstarlet ed -m to move /root/a/item under /root/b, and asserts /root/a no longer contains an item child while /root/b gains the item with its original text intact.
xmlstarlet sel substring-after() returns the suffix after a separator Port / libxml / usage-xmlstarlet-r12-sel-substring-after-fn Passed
Runs xmlstarlet sel -t -v with the XPath function substring-after(@name, '-') against an attribute that carries a hyphenated value, and asserts the emitted output is exactly the suffix portion of the attribute string.
xmlstarlet tr applies an XSLT 1.0 stylesheet from stdin and emits the rendered output Port / libxml / usage-xmlstarlet-r12-tr-output-pipeline Passed
Pipes an XML document through xmlstarlet tr with a stylesheet that wraps each item value in a <line> element, and asserts the output contains exactly three rendered lines with the original item values preserved.
xmlstarlet val -e rejects a malformed XML document with a non-zero exit code Port / libxml / usage-xmlstarlet-r12-val-rejects-malformed Passed
Pipes a malformed XML document through xmlstarlet val -e, asserts the command exits non-zero, and verifies a well-formed document still validates with exit 0 to confirm the validator is not failing unconditionally.
xmlstarlet ed --inplace -u modifies the file on disk without writing to stdout Port / libxml / usage-xmlstarlet-r13-ed-inplace-update Passed
Writes a small XML document, runs xmlstarlet ed --inplace -u to update an attribute value in place, asserts the on-disk file now carries the new value while the original element structure is preserved and that no extra .bak file is produced when --inplace is used without a backup suffix.
xmlstarlet pyx emits one PYX line per element open, attribute, text, and close Port / libxml / usage-xmlstarlet-r13-pyx-roundtrip-counts Passed
Runs xmlstarlet pyx on a small two-item XML document and asserts the emitted PYX stream contains the expected open-tag "(", attribute "A", text "-", and close-tag ")" line counts that match a hand-derived analysis of the input.
xmlstarlet sel concat() builds a composite string from multiple attribute values Port / libxml / usage-xmlstarlet-r13-sel-concat-attrs-fn Passed
Selects items from a small XML file using xmlstarlet sel with an XPath concat() expression that interleaves attribute values and a literal separator, and asserts the emitted line for each item matches the expected "id=...|tier=..." composite string.
xmlstarlet sel -t -m loop -v -n emits one value per line for each match Port / libxml / usage-xmlstarlet-r13-sel-for-each-newline Passed
Runs xmlstarlet sel with a -m loop over /catalog/item, prints each item text via -v "." and a newline via -n, and asserts the output is exactly four newline-separated values in document order without extra leading or trailing blank lines.
xmlstarlet c14n canonicalizes a document by alphabetizing each element's attributes Port / libxml / usage-xmlstarlet-r14-c14n-sorts-attributes Passed
Runs xmlstarlet c14n on a document whose attributes appear in non-alphabetical order on multiple elements, captures stdout, and asserts the canonicalized output reorders each element's attributes alphabetically (a before b on the root, m before z on the child) and expands self-closing tags into open/close pairs.
xmlstarlet ed --omit-decl emits the edited document without the XML declaration Port / libxml / usage-xmlstarlet-r14-ed-omit-decl-strips-prolog Passed
Edits an XML document with xmlstarlet ed --omit-decl plus an attribute update, captures stdout, and asserts the rewritten document carries the updated value but does NOT begin with the "<?xml" prolog that the same edit emits without --omit-decl.
xmlstarlet val --well-formed accepts well-formed XML and rejects malformed XML Port / libxml / usage-xmlstarlet-r14-val-well-formed-only Passed
Runs xmlstarlet val --well-formed against a well-formed document and asserts a "valid" verdict and exit 0. Repeats with a malformed document where the close tag is mismatched and asserts a non-zero exit code, demonstrating the well-formedness gate.
xmlstarlet ed -r renames every matched element to the supplied tag while preserving children and attributes Port / libxml / usage-xmlstarlet-r15-ed-rename-element Passed
Runs xmlstarlet ed -r against an XPath that matches multiple elements and asserts the rewritten output replaces the old tag with the new tag on every match while keeping each element's text and any attribute values intact.
xmlstarlet sel count(//item[@type='x']) returns the count of attribute-matching elements Port / libxml / usage-xmlstarlet-r15-sel-count-attribute-predicate Passed
Runs xmlstarlet sel with an XPath count() over a predicate that filters elements by an attribute value, and asserts the captured stdout equals the number of matching nodes (here, 2). Pins the XPath count() and predicate semantics through the xmlstarlet sel front-end.
xmlstarlet sel evaluates the XPath substring-before() function on a literal string argument Port / libxml / usage-xmlstarlet-r15-sel-substring-before-fn Passed
Runs xmlstarlet sel -t -v "substring-before('alpha-beta', '-')" against any well-formed input document and asserts the captured stdout is the literal "alpha", pinning the XPath 1.0 substring-before() semantics through xmlstarlet's selection harness.
xmlstarlet fo --indent-spaces 4 formats nested children with four-space indentation Port / libxml / usage-xmlstarlet-r16-fo-indent-spaces-four Passed
Runs xmlstarlet fo --indent-spaces 4 on a compact document with nested elements and asserts the reformatted output indents the <child> line with exactly four leading spaces (and the <grandchild> with exactly eight), confirming the indent-spaces setting takes effect.
xmlstarlet sel -t -v extracts the text value of an XPath-matched element Port / libxml / usage-xmlstarlet-r16-sel-value-of-xpath Passed
Runs xmlstarlet sel -t -v against an XPath that selects a specific <item> by attribute predicate, captures stdout, and asserts the output is exactly that element's text content with no surrounding markup.
xmlstarlet ed -a appends a new element after a target node and survives a re-parse Port / libxml / usage-xmlstarlet-r17-ed-append-attribute-roundtrip Passed
Runs xmlstarlet ed -a to append a new <item> after an existing one in a small XML document, then re-parses the output with xmlstarlet sel to count <item> children and asserts the count grew by one.
xmlstarlet tr applies an identity XSLT and preserves the input document structure Port / libxml / usage-xmlstarlet-r17-tr-inline-xslt-identity Passed
Runs xmlstarlet tr with a minimal identity XSLT stylesheet against a small XML input and asserts the transformed output contains the same root element and child <item> texts as the source, exercising libxslt through the xmlstarlet tr entry point.
xmlstarlet val exits 0 on well-formed input and non-zero on malformed input Port / libxml / usage-xmlstarlet-r17-val-exit-code-valid-vs-invalid Passed
Runs xmlstarlet val on a well-formed XML document (expects exit 0) and on a malformed one with an unclosed tag (expects non-zero exit), exercising the well-formedness validator's exit-code contract.
xmlstarlet c14n canonicalization sorts attributes into deterministic order Port / libxml / usage-xmlstarlet-r18-c14n-canonicalization-stable-order Passed
Feeds an XML element with attributes declared in non-canonical order to xmlstarlet c14n, then verifies the canonicalized output places attribute 'a' before attribute 'b' as required by Canonical XML 1.0.
xmlstarlet ed -u replaces a target node's text content in place Port / libxml / usage-xmlstarlet-r18-ed-update-text-replaces-node-content Passed
Runs xmlstarlet ed -u '//item/text()' to overwrite the text inside an <item> element with a new value, then re-parses the output with xmlstarlet sel and asserts the new value is observed.
xmlstarlet sel -t -v with count XPath returns the element count as an integer Port / libxml / usage-xmlstarlet-r18-sel-count-xpath-returns-integer Passed
Builds a small XML document with five <leaf> children, queries it via xmlstarlet sel -t -v 'count(//leaf)', and asserts the printed value is exactly 5 to pin the XPath count() integer-string emission.
xmlstarlet ed -i with -t attr adds a new attribute to an element via XPath Port / libxml / usage-xmlstarlet-r19-ed-insert-attribute-via-t-a Passed
Runs xmlstarlet ed -i //item -t attr -n status -v active to insert a 'status' attribute on the //item node, then queries the resulting document with xmlstarlet sel and asserts the attribute value reads back as 'active'.
xmlstarlet sel -t -m //item -v . -n prints each item's text on its own line Port / libxml / usage-xmlstarlet-r19-sel-template-match-text-extracts-values Passed
Feeds a small XML document with three <item> children to xmlstarlet sel using a -t -m //item template with -v . and -n separator, then asserts the output contains each item's text in document order, exercising the XPath template iteration path.
xmlstarlet val -w exits non-zero on an XML document with an unclosed tag Port / libxml / usage-xmlstarlet-r19-val-well-formed-rejects-unclosed-tag Passed
Writes an intentionally malformed XML document with an unclosed <a> tag, then runs xmlstarlet val -w which performs a well-formedness check only, and asserts the validator exits with a non-zero status while a separate well-formed sibling document exits zero.
xmlstarlet ed -u replaces an existing attribute's value in-document Port / libxml / usage-xmlstarlet-r20-ed-update-attribute-value Passed
Starts from an XML document with item[@status="old"], runs xmlstarlet ed -u //item/@status -v new and asserts that querying //item/@status on the result reads back 'new', exercising the libxml2-backed attribute update path in xmlstarlet ed.
xmlstarlet sel -t -v 'name(//item[1])' returns the literal string 'item' Port / libxml / usage-xmlstarlet-r20-sel-name-fn-returns-element-name Passed
Runs xmlstarlet sel -t -v with an XPath name() call targeting the first <item> element and asserts the printed output is exactly 'item', exercising the libxml2 XPath name() function through the xmlstarlet select pipeline.
xmlstarlet val -d rejects a document missing a DTD-required attribute with a non-zero exit Port / libxml / usage-xmlstarlet-r20-val-dtd-rejects-missing-required-attribute Passed
Builds a DTD that declares item with a required 'id' attribute and an instance missing that attribute, runs xmlstarlet val -d against it, and asserts the command exits non-zero, exercising the libxml2 DTD-validation rejection path in xmlstarlet val.
xmlstarlet fo --indent-tab emits tab-prefixed nested element lines Port / libxml / usage-xmlstarlet-r21-format-indent-tab-flag Passed
Runs xmlstarlet fo --indent-tab on a flat single-line XML document, then asserts the output contains at least one nested-element line that starts with a tab character — pinning xmlstarlet's libxml2-backed pretty-printer's tab-indent mode on Ubuntu 24.04.
xmlstarlet pyx emits open-paren/close-paren tag lines for each element start/end Port / libxml / usage-xmlstarlet-r21-pyx-output-emits-bracketed-tags Passed
Runs xmlstarlet pyx on a small XML tree and asserts the output contains lines starting with '(' (element open) and ')' (element close) for the root tag — pinning xmlstarlet's libxml2-backed PYX SAX-stream emission on Ubuntu 24.04.
xmlstarlet sel -t -v string(/r) emits the concatenated text content of the root Port / libxml / usage-xmlstarlet-r21-sel-string-fn-emits-text-content Passed
Runs xmlstarlet sel -t -v 'string(/r)' against a document with text spread across two siblings and asserts the result equals the concatenated text content — pinning xmlstarlet's libxml2 XPath string() function on Ubuntu 24.04.
xmlstarlet val -s exits non-zero for a document that violates the XSD's xs:integer typing Port / libxml / usage-xmlstarlet-r21-val-xsd-rejects-violation Passed
Builds an XSD requiring <num> to be xs:integer and an instance with <num>not-a-number</num>, runs xmlstarlet val -s and asserts the validator exits non-zero — pinning xmlstarlet's libxml2 XSD-validation rejection path on Ubuntu 24.04.
xmlstarlet ed updates element text Port / libxml / usage-xmlstarlet-r9-ed-update-value Passed
Uses xmlstarlet ed -u to replace a text node selected by XPath and verifies the new value appears in the output while the old value is gone.
xmlstarlet sel sums attribute values via XPath sum() Port / libxml / usage-xmlstarlet-r9-sel-distinct-values Passed
Selects sum(@n) over a list of numbered items and asserts the printed total matches the arithmetic sum.
xmlstarlet tr applies XSLT stylesheet Port / libxml / usage-xmlstarlet-r9-tr-stylesheet-pipeline Passed
Transforms an items list to plain text via xmlstarlet tr with a small XSLT stylesheet and verifies the concatenated values appear in order.
xmlstarlet val accepts well-formed and rejects broken XML Port / libxml / usage-xmlstarlet-r9-validate-well-formed Passed
Runs xmlstarlet val on a well-formed document expecting exit 0, then on a malformed document expecting non-zero exit and an error message.
xmlstarlet renames node Port / libxml / usage-xmlstarlet-rename-node Passed
xmlstarlet sel template build element Port / libxml / usage-xmlstarlet-sel-build-element Passed
Uses xmlstarlet sel -t with nested -e directives to construct a synthetic XML element wrapping a child element per matched node, and verifies the resulting structure has exactly one wrapper element with the expected child count and per-record attribute bindings.
xmlstarlet sel template copy match Port / libxml / usage-xmlstarlet-sel-copy-match Passed
Uses xmlstarlet sel -t -m //x -c "." to copy each matched element verbatim into the output stream and verifies that the emitted XML contains every original element with its attributes and text intact.
xmlstarlet sel template if/then/else branching Port / libxml / usage-xmlstarlet-sel-if-then-else Passed
Runs xmlstarlet sel with a template that walks /root/item and uses -if, -then, and -else to emit one literal for items above a numeric threshold and another for items below it, then verifies the produced output line for each item matches the expected branch.
xmlstarlet sel -N binds custom namespace prefix for XPath Port / libxml / usage-xmlstarlet-sel-namespace-prefix-r8 Passed
Selects values out of a namespaced document by binding a prefix via xmlstarlet sel -N to the document's namespace URI, demonstrating that the bound prefix on the command line need not match the document's source prefix and that count/string queries return the expected values.
xmlstarlet sel template -m -c -v sequence Port / libxml / usage-xmlstarlet-sel-template-match-mode-r7 Passed
Runs xmlstarlet sel with a -t template that uses -m to iterate item elements, -c to copy a nested element subtree per match, -v to extract an attribute value, and -n for newline separators, and verifies the emitted lines exactly match the expected per-item rendering.
xmlstarlet sel template multi-element Port / libxml / usage-xmlstarlet-sel-template-multi Passed
Uses xmlstarlet sel -t -m to iterate over multiple matching elements and emit one record per match, verifying the exact joined output and the total record count.
xmlstarlet select numeric cast Port / libxml / usage-xmlstarlet-sel-value-numeric-cast Passed
Uses xmlstarlet sel -t -v with the XPath number() function to coerce attribute strings to numbers, computes a sum of weight attributes through sum() and number() in separate templates, and verifies both the cast scalar values and the aggregate result.
xmlstarlet select attribute value Port / libxml / usage-xmlstarlet-select-attribute-value Passed
xmlstarlet select attribute Port / libxml / usage-xmlstarlet-select-attribute Passed
xmlstarlet selects count Port / libxml / usage-xmlstarlet-select-count Passed
xmlstarlet select if Port / libxml / usage-xmlstarlet-select-if-batch11 Passed
xmlstarlet namespaced note select Port / libxml / usage-xmlstarlet-select-namespace-note Passed
xmlstarlet namespaced tag select Port / libxml / usage-xmlstarlet-select-namespaced-tag Passed
Reads a namespaced element with xmlstarlet sel and a registered namespace prefix and verifies the selected text.
xmlstarlet select numeric sum Port / libxml / usage-xmlstarlet-select-sum-value Passed
xmlstarlet select text count Port / libxml / usage-xmlstarlet-select-text-count Passed
xmlstarlet select xml Port / libxml / usage-xmlstarlet-select-xml Passed
xmlstarlet tr XSLT identity transform Port / libxml / usage-xmlstarlet-tr-identity-transform Passed
Runs xmlstarlet tr with an XSLT identity transform that copies every node and attribute from the input document, and verifies that all source elements, attributes, and text content are preserved in the transformed output.
xmlstarlet tr applies XSLT with -s string parameter Port / libxml / usage-xmlstarlet-tr-xslt-with-stringparam-r8 Passed
Runs xmlstarlet tr to apply an XSLT stylesheet that consumes a top-level <xsl:param> populated via -s name=value on the command line, verifying the parameter value is interpolated into the output and the result also reflects the input data.
xmlstarlet transform XML Port / libxml / usage-xmlstarlet-transform-xml Passed
xmlstarlet unesc text roundtrip Port / libxml / usage-xmlstarlet-unescape-text Passed
Escapes a string with xmlstarlet esc, unescapes the result with xmlstarlet unesc, and verifies the recovered text matches the original byte-for-byte.
xmlstarlet update attribute Port / libxml / usage-xmlstarlet-update-attribute Passed
xmlstarlet updates node Port / libxml / usage-xmlstarlet-update-node Passed
xmlstarlet val -e verbose DTD diagnostics Port / libxml / usage-xmlstarlet-validate-dtd-inline-r7 Passed
Runs xmlstarlet val -e (verbose) against an external DTD declaring a required attribute and verifies a conforming document is reported "valid" while a non-conforming document is reported "invalid" with verbose, well-formed diagnostics naming the missing required attribute and a non-zero exit code.
xmlstarlet validate external DTD Port / libxml / usage-xmlstarlet-validate-external-dtd Passed
Validates an XML document against an external DTD file using xmlstarlet val -d, confirming a conforming document is reported valid and that a second document violating the DTD element model is reported invalid with a non-zero exit status.
xmlstarlet val RelaxNG Port / libxml / usage-xmlstarlet-validate-relaxng-schema Passed
Validates a conforming document and rejects a non-conforming document against a RelaxNG schema using xmlstarlet val -r and verifies the per-document validity verdicts.
xmlstarlet validate well-formed Port / libxml / usage-xmlstarlet-validate-well-formed Passed
Runs the xmlstarlet val -w well-formedness check on a document and verifies it reports the file as valid.
xmlstarlet validate xml Port / libxml / usage-xmlstarlet-validate-xml Passed
xmlstarlet val W3C XML Schema Port / libxml / usage-xmlstarlet-validate-xsd-schema-r8 Passed
Validates a conforming document against a W3C XML Schema (XSD) via xmlstarlet val -s and rejects a non-conforming document, verifying the per-document validity verdict text and that the bad case exits non-zero.
CVE-2003-1564 libxml regression Port / libxml / cve-2003-1564 Passed
Asserts that xmllint without --huge rejects a classic billion-laughs document via libxml2's built-in entity-expansion limits, instead of expanding entities to exhaust CPU and memory.
CVE-2007-6284 libxml regression Port / libxml / cve-2007-6284 Passed
Asserts that xmllint terminates within a bounded time on input containing invalid UTF-8 multibyte sequences, instead of looping forever inside xmlCurrentChar.
CVE-2008-3281 libxml regression Port / libxml / cve-2008-3281 Passed
Asserts that libxml2 applies entity-expansion limits to attribute-value substitution as well, rejecting a billion-laughs payload that lives in an attribute instead of element content.
CVE-2009-2414 libxml regression Port / libxml / cve-2009-2414 Passed
Asserts that libxml2 enforces a recursion bound on deeply nested DTD element declarations, surfacing a parse error rather than overflowing the C stack.
CVE-2013-0339 libxml regression Port / libxml / cve-2013-0339 Passed
Asserts that xmllint without --noent does not substitute external file entities, leaving the entity reference unresolved instead of disclosing local file contents.
CVE-2014-0191 libxml regression Port / libxml / cve-2014-0191 Passed
Asserts that xmllint --nonet honors the no-network flag for external parameter entities — a SYSTEM parameter entity pointing at an http:// URL must not be fetched.
CVE-2014-3660 libxml regression Port / libxml / cve-2014-3660 Passed
Asserts that libxml2's entity-expansion limits still apply even when --noent is passed (the post-CVE protection must not be bypassable by entity-substitution mode).
CVE-2016-3627 libxml regression Port / libxml / cve-2016-3627 Passed
Asserts that xmllint --recover does not recurse forever building a self-referential entity in error-tolerant parsing, terminating within the script timeout.
CVE-2016-3705 libxml regression Port / libxml / cve-2016-3705 Passed
Asserts that libxml2 enforces a recursion-depth limit across the entity-related parser helpers, surfacing an error rather than blowing the stack on deeply nested entity references.
CVE-2017-16932 libxml regression Port / libxml / cve-2017-16932 Passed
Asserts that libxml2 enforces a recursion limit on parameter-entity expansion, terminating a self-referential parameter-entity DTD with an error rather than recursing forever.
CVE-2017-18258 libxml regression Port / libxml / cve-2017-18258 Passed
Asserts that libxml2's xz-compressed input path is reachable from xmlReadFile and that a tiny xz file expanding to ~1 million empty elements is fully decompressed and parsed — the parser produces all expected nodes and peak RSS reflects that the decompressed XML actually landed in memory. Pre-fix libxml2 had no lzma memlimit at all and would happily inflate any expansion ratio; this case is the controlled-bomb regression for that attack surface.
CVE-2017-7375 libxml regression Port / libxml / cve-2017-7375 Passed
Asserts that the libxml2 Python bindings do not silently load and inline external entities under default parser flags — a SYSTEM file:// reference must not surface secret content in the parsed tree.
CVE-2018-14404 libxml regression Port / libxml / cve-2018-14404 Passed
Asserts that xmllint --xpath rejects an invalid XPath logical expression with an error rather than crashing on a NULL operand inside libxml2's XPath evaluator.
CVE-2020-7595 libxml regression Port / libxml / cve-2020-7595 Passed
Asserts that libxml2 does not loop forever in xmlStringLenDecodeEntities on truncated entity-bearing input (must terminate with a parse error, bounded by the script timeout).
CVE-2021-3541 libxml regression Port / libxml / cve-2021-3541 Passed
Asserts that libxml2 still applies entity-expansion budgets to a hostile entity graph that previously bypassed exponential-expansion protections by mixing parameter and general entities.
CVE-2024-40896 libxml regression Port / libxml / cve-2024-40896 Passed
Asserts that libxml2 with --nonoent and --nonet does not resolve external SYSTEM entities even when the document declares them — XXE bypass attempts must not surface external file content.
CVE-2025-9714 libxml regression Port / libxml / cve-2025-9714 Passed
Asserts that xmllint enforces XPath recursion-depth bounds across recursive sub-evaluations, returning an error on deeply nested predicates instead of overflowing the stack.
CVE-2026-0989 libxml regression Port / libxml / cve-2026-0989 Passed
Asserts that xmllint --relaxng terminates with an error on a self-referential RelaxNG <include> chain, instead of recursing forever and exhausting the stack.
CVE-2026-0990 libxml regression Port / libxml / cve-2026-0990 Passed
Asserts that xmlcatalog terminates with an error on a self-referential XML catalog delegate chain, instead of recursing forever via nextCatalog/delegateURI traversal.