Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69452 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31908 invoked from network); 2 Oct 2013 14:45:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2013 14:45:53 -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 67.222.54.6 as permitted sender) X-PHP-List-Original-Sender: jstokes@heartofthefyre.us X-Host-Fingerprint: 67.222.54.6 oproxy6-pub.mail.unifiedlayer.com Linux 2.6 Received: from [67.222.54.6] ([67.222.54.6:35602] helo=oproxy6-pub.mail.unifiedlayer.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/A8-23255-F913C425 for ; Wed, 02 Oct 2013 10:45:52 -0400 Received: (qmail 7532 invoked by uid 0); 2 Oct 2013 14:45:46 -0000 Received: from unknown (HELO box451.bluehost.com) (74.220.219.51) by oproxy6.mail.unifiedlayer.com with SMTP; 2 Oct 2013 14:45:46 -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=KaabJFec1p5mbPXmh/GICiWBj+23I3iJasJuZKTiAig=; b=CF4ED3HsvuU7btFIkn0j1pCtioGu9kl3ELVR+36fHgK+ca0X22FOlX0ZD7+zHhpqu6x7NG68zRK8fxIVvebOAFSG9DO7z6p/JppCTzTWyWrUUKzdNll1JCSJkrv+oFfV; Received: from [172.249.117.162] (port=58390 helo=[192.168.0.127]) by box451.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1VRNgQ-0000EI-Dt for internals@lists.php.net; Wed, 02 Oct 2013 08:45:46 -0600 Message-ID: <524C3196.4090600@heartofthefyre.us> Date: Wed, 02 Oct 2013 07:45:42 -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> <5244F7B7.8070800@heartofthefyre.us> In-Reply-To: <5244F7B7.8070800@heartofthefyre.us> 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) UPDATE: I figured out number 2. Maybe I had an extra text node in there, but now it's working. Can someone help with the others? -John On 9/26/2013 8:12 PM, John Stokes wrote: > 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 >> > >