xml-conduit -Text.XML.Cursor  

<p>Select attributes on the current element (or nothing if it is not an element). XPath: <em>the attribute axis contains the attributes of the context node; the axis will be empty unless the context node is an element</em></p><p>Note that this is not strictly an <code><a href="/?query=%28%28name%3A%28%21Axis%29%20package%3A%28%21xml-conduit%29%20module%3A%28%21Text.XML.Cursor%29%29%5E100.0%29%20OR%20%28%28name%3A%28%21Axis%29%20package%3A%28%21xml-conduit%29%29%5E10.0%29%20OR%20name%3A%28%21Axis%29">Axis</a></code>, but will work with most combinators.</p><p>The return list of the generalised axis contains as elements lists of <code>Content</code> elements, each full list representing an attribute value.</p>
attr :: Name -> Lens' Element (Maybe Text)

xml-html-conduit-lens -Text.Xml.Lens  

<p>Traverse node attributes with a specific name </p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let doc = "<root><foo bar=\"baz\" qux=\"quux\"/><foo qux=\"xyzzy\"/></root>" :: TL.Text </code></strong></pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>doc ^.. xml...attr "qux".traverse </code></strong>["quux","xyzzy"] </pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>doc ^.. xml...attr "bar" </code></strong>[Just "baz",Nothing] </pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>doc & xml...attr "qux".traverse %~ Text.reverse </code></strong>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><foo bar=\"baz\" qux=\"xuuq\"/><foo qux=\"yzzyx\"/></root>" </pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>doc & xml.ix 1.attr "bar" ?~ "bazzy" </code></strong>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><foo bar=\"baz\" qux=\"quux\"/><foo bar=\"bazzy\" qux=\"xyzzy\"/></root>" </pre>
attrs :: IndexedTraversal' Name Element Text

xml-html-conduit-lens -Text.Xml.Lens  

<p>Traverse node attributes </p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let doc = "<root><foo bar=\"baz\" qux=\"zap\"/><foo quux=\"xyzzy\"/></root>" :: TL.Text </code></strong></pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>doc ^.. xml...attrs.indices (has (name.unpacked.prefixed "qu")) </code></strong>["zap","xyzzy"] </pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>doc & xml...attrs %~ Text.toUpper </code></strong>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><foo bar=\"BAZ\" qux=\"ZAP\"/><foo quux=\"XYZZY\"/></root>" </pre>

xml-enumerator -Text.XML.Cursor  

<p>Select attributes on the current element (or nothing if it is not an element). XPath: <em>the attribute axis contains the attributes of the context node; the axis will be empty unless the context node is an element</em> </p><p>Note that this is not strictly an <code><a href="/?query=%28%28name%3A%28%21Axis%29%20package%3A%28%21xml-enumerator%29%20module%3A%28%21Text.XML.Cursor%29%29%5E100.0%29%20OR%20%28%28name%3A%28%21Axis%29%20package%3A%28%21xml-enumerator%29%29%5E10.0%29%20OR%20name%3A%28%21Axis%29">Axis</a></code>, but will work with most combinators. </p><p>The return list of the generalised axis contains as elements lists of <code>Content</code> elements, each full list representing an attribute value. </p>
attribute :: HasAttribute k => ByteString -> n k Immutable -> Maybe ByteString Class Method