I am trying to parse and xml document: <?xml version="1.0"?> <!DOCTYPE PrequalResponse PUBLIC "-//New Edge Networks//DTD Pilot Prequalification Response 2.3//EN" "http://api.newedgenetworks.com/dtd/prequalresponse.dtd"> <PrequalResponse> <TransactionCode><Code>1005</Code><Message>Authentication failed: Invalid user name or password</Message></TransactionCode> </PrequalResponse>
I received 'XML error: junk after document element at line 5'. I found some mention searching the web that the xml_parse() function does not know the end of the stream: The problem is that, in the general case, there's no way to determine if a stream is *supposed* to contain multiple documents. What is needed is some external way to determine the end of the input; you can then feed the parser data buffers until the end-of-buffer function returns true. You can do this by embedding the chunks of XML into another protocol; this should not be difficult if you can determine the size of each XML document in bytes before sending it, so that each document can be preceeded by the byte-count. Otherwise, you'll need a stream encoding that contains explicit end-of-file markers. I can set my passing xml document with just '<trythis>1</trythis>' and I get the same error, except of course it says line 1 instead of line 5. Any help on how I can be sure the function knows the end of ? -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php