Xmllint hints 

  1. If you're on a unixy box try using 'xmllint -shell some_xml_file.xml' which will give you a shell to navigate around in the XML file. You can type 'help' for a list of commands but the ones I find most usefull are: cd, dir, ls, cat, pwd. I'm not enough of an expert to figure out what the leading fields on an ls are but I do know that to cd into arrays you use the syntax 'cd array[4]' to get to a particular element. See http://marty.feebleandfrail.org/macosxhints/webscrape/ for a tutorial I wrote on using xmllint and XML::LibXML to scrape web pages.
  2. Run the XML response from smugmug through a trivial parser like http://docs.python.org/lib/expat-example.html. If you're traversing the XML structure, adding calls to something like Perl's Data::Dumper or the Python module pprint to your code is a huge help.
  3. Open the XML file in your browser! Compare the output of (1) and (2) as well as your debug messages.
  4. Some APIs to XML parsers have annoying built in smartness where they automagically change how the data is returned. These can do wierd things to your parsed results! One of the Perl XML parsers, XML::Simple, for example, has a bunch of flags such as ForceArray (http://search.cpan.org/~grantm/XML-Simple-2.12/lib/XML/Simple.pm) and KeyAttr that control how the library will roll single nested elements up into attributes and when it will return arrays vs. hashes. In particular I found that you have to be very aware how XML::Simple behaves when there's one element (a user with 1 album, say) vs. multiple elements.

studiosells