<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kolmafia.us/index.php?action=history&amp;feed=atom&amp;title=Xpath</id>
	<title>Xpath - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kolmafia.us/index.php?action=history&amp;feed=atom&amp;title=Xpath"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Xpath&amp;action=history"/>
	<updated>2026-04-25T03:22:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Xpath&amp;diff=8472&amp;oldid=prev</id>
		<title>Ulti at 13:43, 30 April 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Xpath&amp;diff=8472&amp;oldid=prev"/>
		<updated>2015-04-30T13:43:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:43, 30 April 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l68&quot;&gt;Line 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Category:Ash Functions|&lt;/del&gt;Category:String Handling Routines]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:String Handling Routines]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key kolmafia_wiki:diff:1.41:old-8471:rev-8472:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Ulti</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Xpath&amp;diff=8471&amp;oldid=prev</id>
		<title>Ulti: Created page with &quot;{{ #vardefine:name|xpath}}{{ #vardefine:return_type|string[int]}}{{ #vardefine:aggregate|yes}}{{  FunctionPage| name={{#var:name}}|  function1={{Function| name={{#var:name}}|...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Xpath&amp;diff=8471&amp;oldid=prev"/>
		<updated>2015-04-30T13:42:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{ #vardefine:name|xpath}}{{ #vardefine:return_type|string[int]}}{{ #vardefine:aggregate|yes}}{{  FunctionPage| name={{#var:name}}|  function1={{Function| name={{#var:name}}|...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|xpath}}{{&lt;br /&gt;
#vardefine:return_type|string[int]}}{{&lt;br /&gt;
#vardefine:aggregate|yes}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|string|htmldocument}}|&lt;br /&gt;
parameter2={{Param|string|xpathselector}}|&lt;br /&gt;
p1desc={{Pspan|htmldocument}} is a string representing an html document such as that returned from visit_url|&lt;br /&gt;
p2desc={{Pspan|xpathselector}} is a standard xpath selector for selecting nodes in the document|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=This function returns an array of strings, for efficiency purposes, not a map, representing the node(s) which xpath has selected for you in the html document. Unlike a map, arrays will encounter an &amp;quot;out of bounds&amp;quot; exception when attempting to add new elements to it, do note the difference. This function will return an empty array if no nodes match the selector. In the event the selector uses invalid syntax, this function will error with &amp;quot;invalid xpath expression&amp;quot;|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=The following code, if you are stuck in a choice adventure, will output the options of that choice adventure.|&lt;br /&gt;
code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
string[int] textOptions;&lt;br /&gt;
string[int] valueOptions;&lt;br /&gt;
string[int] choiceAdventureNumber;&lt;br /&gt;
string[int] choiceAdventureName;&lt;br /&gt;
string page=visit_url(&amp;#039;charsheet.php&amp;#039;);&lt;br /&gt;
textOptions=xpath(page,&amp;#039;//form[@action=&amp;quot;choice.php&amp;quot;]//input[@type=&amp;quot;submit&amp;quot;]/@value&amp;#039;);&lt;br /&gt;
valueOptions=xpath(page,&amp;#039;//form[@action=&amp;quot;choice.php&amp;quot;]//input[@type=&amp;quot;hidden&amp;quot;][@name=&amp;quot;option&amp;quot;]/@value&amp;#039;);&lt;br /&gt;
choiceAdventureNumber=xpath(page,&amp;#039;//form[@action=&amp;quot;choice.php&amp;quot;]//input[@type=&amp;quot;hidden&amp;quot;][@name=&amp;quot;whichchoice&amp;quot;]/@value&amp;#039;);&lt;br /&gt;
choiceAdventureName=xpath(page,&amp;#039;//tr/td/b/text()&amp;#039;);&lt;br /&gt;
if(count(textOptions)==0 || count(valueOptions)==0 || count(choiceAdventureNumber)==0)&lt;br /&gt;
{&lt;br /&gt;
	print(&amp;#039;not in a choice adventure&amp;#039;);&lt;br /&gt;
}else{&lt;br /&gt;
	string choiceAdvName;&lt;br /&gt;
	string choiceAdvNum=choiceAdventureNumber[0];&lt;br /&gt;
	if(count(choiceAdventureName)==0)&lt;br /&gt;
	{&lt;br /&gt;
		choiceAdvName=&amp;#039;unnamed choice adventure&amp;#039;;&lt;br /&gt;
	}else{&lt;br /&gt;
		choiceAdvName=choiceAdventureName[0];&lt;br /&gt;
	}&lt;br /&gt;
	print(&amp;#039;choice adventure #&amp;#039;+choiceAdvNum+&amp;#039;:&amp;#039;+choiceAdvName);&lt;br /&gt;
	for x from 0 to count(valueOptions)-1&lt;br /&gt;
	{&lt;br /&gt;
		print(&amp;#039;option &amp;#039;+valueOptions[x]+&amp;#039;:&amp;#039;+textOptions[x]);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|moreinfo=&lt;br /&gt;
For example, if you used &amp;quot;intriguing puzzle box&amp;quot; from your inventory and ran the above script, you&amp;#039;d see the following output:&lt;br /&gt;
&amp;lt;pre&amp;gt;choice adventure #525:Fiddling with a Puzzle&lt;br /&gt;
option 1:Push the left face.&lt;br /&gt;
option 2:Turn the right face clockwise.&lt;br /&gt;
option 3:Turn the rear face counterclockwise.&lt;br /&gt;
option 4:Push the right face.&lt;br /&gt;
option 5:Turn the right face counterclockwise.&lt;br /&gt;
option 6:Turn the left face counterclockwise.&lt;br /&gt;
option 7:Stop messing with this dang puzzle.&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|visit_url}}|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Ash Functions|Category:String Handling Routines]]&lt;/div&gt;</summary>
		<author><name>Ulti</name></author>
	</entry>
</feed>