A
Alexey Verkhovsky
I'm using REXML::XPath for testing of XHTML contents, and in some cases
I have to sort the results of a match, because it doesn't come out in
the same order as it appears in the document. I haven't found anything
about it in the RDoc.
Is there no guarantee about the ordering, or am I missing something?
E.g., REXML::XPath.match(xml, '//input') produces <input/> tags in a
different order from how it is in the form.
<form action="/topic/show/1#postform" method="post">
<input type="hidden" name="dummy" value="ie-workaround" />
<!-- TODO remove this -->
<input type="hidden" name="reply_to" value="1001" />
Parent_id:<br />
<input id="post_parent_id" name="post[parent_id]" size="30" type="hidden" value="1001" /><br />
Topic_id:<br />
<input id="post_topic_id" name="post[topic_id]" size="30" type="hidden" value="1" /><br />
Name:<br />
<input id="post_guest_name" name="post[guest_name]" size="30" type="text" value="" /><br />
Email:<br />
<input id="post_guest_email" name="post[guest_email]" size="30" type="text" value="" /><br />
Subject:<br />
<input id="post_subject" name="post[subject]" size="30" type="text" value="Re: B2" /><br />
Text:<br />
<textarea cols="80" id="post_text" name="post[text]" rows="24" wrap="virtual">Alex wrote:
> (unknown) wrote:
>> xyz
</textarea><br />
<input type="submit" name="submit" value="Submit" />
</form>
Best regards,
Alexey Verkhovsky
I have to sort the results of a match, because it doesn't come out in
the same order as it appears in the document. I haven't found anything
about it in the RDoc.
Is there no guarantee about the ordering, or am I missing something?
E.g., REXML::XPath.match(xml, '//input') produces <input/> tags in a
different order from how it is in the form.
<form action="/topic/show/1#postform" method="post">
<input type="hidden" name="dummy" value="ie-workaround" />
<!-- TODO remove this -->
<input type="hidden" name="reply_to" value="1001" />
Parent_id:<br />
<input id="post_parent_id" name="post[parent_id]" size="30" type="hidden" value="1001" /><br />
Topic_id:<br />
<input id="post_topic_id" name="post[topic_id]" size="30" type="hidden" value="1" /><br />
Name:<br />
<input id="post_guest_name" name="post[guest_name]" size="30" type="text" value="" /><br />
Email:<br />
<input id="post_guest_email" name="post[guest_email]" size="30" type="text" value="" /><br />
Subject:<br />
<input id="post_subject" name="post[subject]" size="30" type="text" value="Re: B2" /><br />
Text:<br />
<textarea cols="80" id="post_text" name="post[text]" rows="24" wrap="virtual">Alex wrote:
> (unknown) wrote:
>> xyz
</textarea><br />
<input type="submit" name="submit" value="Submit" />
</form>
Best regards,
Alexey Verkhovsky