Actually if it doesn't have to be part of the DOM assuming you are
passing in a context as the second parameter of $() which the original
author is.

I don't use the xpath plugin so I'm not sure about that but the second
attempt you said failed worked for me.  I got 3 alert boxes with '1',
'2', '3' just as I expected.  Here is my test case.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
  <head>
    <title>Tester</title>
    <style type="text/css">
    </style>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
      function doIt() {
        $.get("jquery_xml_load.xml", function (xml) {
              $("building", xml).each(function () {
                    alert($("city_id", this).text());
                  });
            });
      }

      $(document).ready(function() {
        $("button").click(doIt);
      });
    </script>
  </head>
  <body>
    <button>Do It</button>
  </body>
</html>

The xml file is a copy and paste of what you put in your post.  I
think your problem is somewhere other than what you posted.

Hope that helps.

David

Reply via email to