Is there an easy way to do this in PHP? How do you take plain text, formatted as XML, from a form textarea and have PHP take it in as XML? I can find out how to walk the tree after it's an XML object.
Just tried richsage's technique on this sample xml:
<?xml version="1.0"?>
<videocollection>
    <title id="1">Tootsie</title>
    <genre>comedy</genre>
    <year>1982</year>
    <language>English</language>
    <cast>Dustin Hoffman</cast>
    <cast>Jessica Lang</cast>
    <cast>Teri Gar</cast>
    <cast>Sydney Pollak</cast>
    <crew>
      <director>Sydney Pollak</director>
    </crew>
    <title id="2">Jurassic Park</title>
    <genre>science fiction</genre>
    <year>1993</year>
    <language>English</language>
    <cast>Sam Neil</cast>
    <cast>Laura Dern</cast>
    <cast>Jeff Goldblum</cast>
    <crew>
      <director>Steven Spielberg</director>
    </crew>
    <title id="3">Mission Impossible</title>
    <genre>action</genre>
    <year>1996</year>
    <language>English</language>
    <cast>Tom Cruise</cast>
    <cast>Jon Voight</cast>
    <cast>Emmanuelle Beart</cast>
    <cast>Jean Reno</cast>
    <crew>
      <director>Brian de Palma</director>
    </crew>
</videocollection>
Here's my code:
<html>
<head><title></title></head>
<body>
</body>
<?php
echo $_SERVER['PHP_SELF'];
$in_xml=$_POST['in_xml'];
if ($in_xml) {
    print "We got it!...";// . $in_xml;
    $doc = new DOMDocument();
    $doc->loadXML( $in_xml);
} else {
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<textarea name="in_xml" cols="40" rows="10">
  Enter your comment here
</textarea>
<input type="submit" value="Submit">
<?php
}
?>
</html>
Got a whole bunch of warnings: Warning: DOMDocument::loadXML() [domdocument.loadxml]: String not started expecting ' or " in Entity, line: 1 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Malformed declaration expecting version in Entity, line: 1 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Blank needed here in Entity, line: 1 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: parsing XML declaration: '?>' expected in Entity, line: 1 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: AttValue: " or ' expected in Entity, line: 4 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: attributes construct error in Entity, line: 4 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Couldn't find end of Start Tag title line 4 in Entity, line: 4 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Opening and ending tag mismatch: videocollection line 3 and title in Entity, line: 4 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Extra content at the end of the document in Entity, line: 5 in /Library/WebServer/Documents/sandbox/parse_xml/index.php on line 12