Bluehost.com Web Hosting $6.95

XML error: junk after document element

This is a discussion on XML error: junk after document element within the PHP General forums, part of the PHP Programming Forums category; I am trying to parse and xml document: <?xml version="1.0"?> <!DOCTYPE PrequalResponse PUBLIC &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-26-2003
Robert Fitzpatrick
 
Posts: n/a
Default XML error: junk after document element

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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:05 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0