I'm having a hard time getting some XML parsing to work.
Here's the story.
I am posting an XML file to a server for authentication.
The server I post to responds back with some XML. In that XML is a token that I need to parse out.
The data that I am being sent back is part XML and part HTTP header. I just can't seem to get the XML isolated to parse it. I'm thinking it has something to do with line breaks but I'm not sure. I have tried using the XML::Simple as well as regular expressions but nothing is working. Attached is the file I am getting returned from the server I am posting to. This is the file I need to parse the XML out of, just a few fields really, <Token> being the most important and <Status> being the other. Thanks for any help!
I have attached the XML file I get back from the server I am posting to. I changed a few things, but just values in the Tags, nothing else.
Here is the code I am using. It's commented out a lot because I have tried various methods.
I guess the big issue I seem to be having when using XML::Simple is:
*The XML returned has Non-XML in it, so XML::Simple is choking. I tried using RegEx to parse out just the XML from the returned file but nothing is working. I'm pretty decent with RegEx so I'm just not getting what is happening. Thanks!
my($query)= new CGI;
my $userAgent = LWP::UserAgent->new(agent => 'perl post');
$message="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?> <NotificationRequest Version=\"1.0\"> <NotificationHeader> <Type>2</Type> Snip....";
my $response = $userAgent->request(POST 'http://www.posttosite.com/web_service.php'
Content_Type => 'text/xml',
Content => $message);
print $response->error_as_HTML unless $response->is_success;
#print FILE $res;
#@a = split /\n/, $res;