Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69374 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97725 invoked from network); 27 Sep 2013 03:13:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2013 03:13:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=jstokes@heartofthefyre.us; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jstokes@heartofthefyre.us; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heartofthefyre.us designates 69.89.16.30 as permitted sender) X-PHP-List-Original-Sender: jstokes@heartofthefyre.us X-Host-Fingerprint: 69.89.16.30 oproxy13-pub.mail.unifiedlayer.com Linux 2.6 Received: from [69.89.16.30] ([69.89.16.30:56935] helo=oproxy13-pub.mail.unifiedlayer.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/B0-28456-0C7F4425 for ; Thu, 26 Sep 2013 23:13:06 -0400 Received: (qmail 6271 invoked by uid 0); 27 Sep 2013 03:13:01 -0000 Received: from unknown (HELO box451.bluehost.com) (74.220.219.51) by oproxy13.mail.unifiedlayer.com with SMTP; 27 Sep 2013 03:13:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heartofthefyre.us; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:To:MIME-Version:From:Date:Message-ID; bh=iGJ7JQu4P3LbrYDHswf3I7wciLC+8/0+i/Maz7k2Jbo=; b=Ued7DOJRWHXDQaQGRfgJQh56bTkIti5LUBRtEJpR9dcMrq9B6/YGntE8RAYdwa27SJao+GeFFqnZV4pvlHwZKMl3SEq/9xU5XOVPiMbcM6StZ3dETK8hpO0JUT6s/mGp; Received: from [172.249.117.162] (port=63981 helo=[192.168.0.127]) by box451.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1VPOUH-0004eL-5U for internals@lists.php.net; Thu, 26 Sep 2013 21:13:01 -0600 Message-ID: <5244F7B7.8070800@heartofthefyre.us> Date: Thu, 26 Sep 2013 20:12:55 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: internals@lists.php.net References: <523D4B8B.8020104@heartofthefyre.us> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Identified-User: {3002:box451.bluehost.com:heartof8:heartofthefyre.us} {sentby:smtp auth 172.249.117.162 authed with jstokes@heartofthefyre.us} Subject: Re: [PHP-DEV] Re: Question on XMLReader From: jstokes@heartofthefyre.us (John Stokes) Well, fine then. I'm trying to understand the mechanics behind XMLReader::next() and XMLReader::read() Given an XML file like this: $library = ' Of Mice and Men A Tale of Two Cities '; $XMLdoc = XMLReader::XML($library); It seems to me that the XMLReader object essentially functions as a pointer. QUESTION 1 I'm guessing that calling $XMLdoc->next(); moves the pointer like this. POINTER--> ... However, a call to readOuterXML(), readInnerXML(), etc. results in nothing being printed. Another $XMLdoc->next(); call results in ... POINTER--> And again, a call to read...XML() results in nothing being printed. The second case makes sense, because you're at the end of the document. I don't understand why the first call returns nothing. QUESTION 2 A similar scenario using XMLReader::read(). If I were to do successive calls to $XMLdoc->read(); and $XMLdoc->readOuterXML() I get: 1. POINTER--> ... Prints the whole document. 2. POINTER-->(empty text node) ... Prints nothing, as expected. 3. POINTER--> Of Mice and Men ... SHOULD print the whole book node. It doesn't. 3. POINTER-->(empty text node) Of Mice and Men ... Prints nothing, as expected. 4. POINTER-->Of Mice and Men ... Prints Of Mice and Men 5. POINTER-->Of Mice and Men ... Prints Of Mice and Men Why doesn't iteration 3 print the entire book node? QUESTION 2a Using the same scenario as above, does the read() actually read in the entire document on iteration 1, or does it wait for a call to readOuterXML(),readInnerXML(), etc? If it actually reads the entire document, doesn't that defeat the purpose of a pull parser? QUESTION 3 Starting with iteration 3 above, if I assume that it DID print the whole book node, a call to $XMLdoc->next() should do this: Of Mice and Men POINTER--> A Tale of Two Cities ... Now a call to readOuterXML() SHOULD print the entire 2nd book node. Instead it prints nothing. Why? Thanks in advance for the help. -John On 9/21/2013 6:37 AM, David Soria Parra wrote: > John Stokes schrieb: >> I'm working on documenting the XMLReader and XMLWriter classes. Is there >> someone on the list that can answer some questions about the details of >> how XMLReader works? > Please don't ask to ask. Sent a mail to this list or to the php.doc > mailinglist and just ask your question. > > Thank you > > ps.: yes there will be people that can answer questions regarding those > two classes >