You are here: Re: How to parse Xml? « PHP Programming Language « IT news, forums, messages
Re: How to parse Xml?

Posted by php.developer2007 on 08/06/07 16:40

On Aug 6, 9:06 pm, Benjamin <musiccomposit...@gmail.com> wrote:
> On Aug 6, 9:44 am, php.developer2...@gmail.com wrote:
>
>
>
>
>
> > Hi i want to parse a xml document which contains attribute can anybody
> > help me in that.
>
> > Example
> > --------------------
> > <category id="1" parent-id="1" level="2">
> > <category id="2" parent-id="1" level="3">
> > <category id="3" parent-id="5" level="6">
>
> > I want to get all id's in this example with using regular
> > expressions..
>
> > Output
> > ----------
> > 1
> > 2
> > 3
>
> First of all that's not valid XML. In order to parse it, it has to be
> valid. This, however, is easily fixed in your case. Just put the whole
> body in <categories> tags and add the XML declaration like this:
> <?xml version="1.0"?>
> <categories>
> <category id="1" parent-id="1" level="2">
> <category id="2" parent-id="1" level="3">
> <category id="3" parent-id="5" level="6">
> </categories>
>
> With PHP, you have many options to parse XML with. My favorite and
> probably the most easy is SimpleXML. Look athttp://www.php.net/simplexml.- Hide quoted text -
>
> - Show quoted text -

Yeah I know i m just giving an example.I want it to be done with
preg_match_all as i had done this before with it.help if any body
help.I m facing problem this time.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация