Re: XML Parser
| From: | Scott Fletcher | Date: | Fri, 24 Oct 2003 13:46:03 +0000 |
| Subject: | Re: XML Parser | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167422@lists.php.net to get a copy of this message | ||
Thanks! Oh Boy! :-)
For the repeating of the same XML name tag, I guess one way to do it is to
depend on the higher up XML name tag that group them together. Chopped them
off and use it somehow.
For ex.
--snip--
<Individual>
<FirstName>***</FirstName>
</Individual>
<Joint>
<FirstName>***</FirstName>
</Joint>
--snip--
This may help.... Now I'm going to have to decide on DOM XML or Expat...
Thanks,
Scott F.
"Ray Hunter" <bigdog@venticon.com> wrote in message
news:1067001570.9404.6.camel@bigdog.info.trw.com...
> I would probably make this a new thread since it is a new question.
>
> Anyways, the answer to your question is no, unless you make that
> happen. When you use the xml parser in php you are using a expat parser
> (stream-oriented parser) that you set up (register) handlers for. So
> when the parser encounters a tag (element) then it is handled by a
> predefined handler (function in this case) that is created by the
> developer.
>
> Now if you are using the DOM XML parser then the entire xml document is
> loaded as a DOM object like a tree. You can then access different
> branches (nodes) of the tree via dom functions.
>
> Each type of parser has its own pros and cons...I would suggest deciding
> which one is best for what you are doing. For example, if you have
> large xml files to parse, then expat is probably the best way...however,
> if you need to be able to access nodes of the document in random ways
> then the DOM XML parser might be a better alternative. Expat will be
> faster and less memory intensive than DOM.
>
> HTH...
>
> --
> Ray
>
> On Fri, 2003-10-24 at 07:03, Scott Fletcher wrote:
> > I wonder about overwritting the same tag twice, like '<FirstName>' and
end
> > up with one result when using hte XML parse... Does anyone know that
PHP
> > XML Parse can work without overwriting in this case and still get two
> > different result?
> >
> > Scott F.
> >
> > "Raditha Dissanayake" <jabber@raditha.com> wrote in message
> > news:3F987A8C.3010104@raditha.com...
> > > While it's possible to process XML using regular expression. The whole
> > > point of using XML is that you wouldn't have to use hacked solutions
> > > like that :-)
> > >
> > > Scott Fletcher wrote:
> > >
> > > >Hi Fellas!
> > > >
> > > > I don't want to use the PHP's XML feature at this moment because
I
> > found
> > > >out that I need to recompile PHP with the XML support which I can't
do at
> > > >this moment. So, instead of recompiling, does anyone know of a good
> > sample
> > > >coding or class out there on the Internet that would work I'm
looking
> > for
> > > >something similiar like this... Problem is I don't have good scripts
> > that
> > > >can handle the quote or double quote without missing up the XML data
and
> > PHP
> > > >Array...
> > > >
> > > >--snip--
> > > >//Individual
> > > ><FirstName>Bill</FirstName>
> > > ><LastName>Clinton</LastName>
> > > ><Gender>M</Gender>
> > > ><FavoratePet>Dog</FavoratePet>
> > > >//Joint
> > > ><FirstName>Hillary</FirstName>
> > > ><LastName>Clinton</LastName>
> > > ><Gender>F</Gender>
> > > ><FavoratePet>Cat</FavoratePet>
> > > >
> > > >//This would be return in array like...
> > > >echo $XML_Tag['FirstName'][0]; //Output would be "Bill"...
> > > >echo " "; //Whitespace...
> > > >echo $XML_Tag['LastName'][0]; //Output would be "Clinton"...
> > > >echo "'s favorate pet is a ";
> > > >echo $XML_Tag['FavoratePet']; //Output would be "Dog"...
> > > >echo " and his wife name is ";
> > > >echo $XML_Tag['FirstName'][1]; //Output would be
> > > >"Hillary"...
> > > >echo " "; //Whitespace...
> > > >echo $XML_Tag['LastName'][1]; //Output would be "Clinton"...
> > > >--snip--
> > > >
> > > >Just something like that... Thanks!!!
> > > >
> > > >Scott F.
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Raditha Dissanayake.
> >
> ------------------------------------------------------------------------
> > > http://www.radinks.com/sftp/ |
http://www.raditha/megaupload/
> > > Lean and mean Secure FTP applet with | Mega Upload - PHP file
uploader
> > > Graphical User Inteface. Just 150 KB | with progress bar.