Re: Is there a way to use the strpos() for next string...
| From: | Scott Fletcher | Date: | Thu, 20 Nov 2003 20:42:13 +0000 |
| Subject: | Re: Is there a way to use the strpos() for next string... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170494@lists.php.net to get a copy of this message | ||
I'll try. I haven't got the PHP XML Parser to work, I think it is because
the XML stuffs I receive is not a true XML, some of them don't have a
closing tag either because one tag have actual data as an attribute inside
one tag. It is kind of frustrating to on not knowing what XML Parser will
work.
Scott
"Kelly Hallman" <khallman@ultrafancy.com> wrote in message
news:Pine.LNX.4.44.0311200936000.21943-100000@clove.wrack.org...
> On Thu, 20 Nov 2003, Scott Fletcher wrote:
> > How exactly does the 3rd parameter option work. I tried this but it
> > doesn't work, so I don't know how exactly does it work... There isn't
> > detail information on the php.net website...
>
> "The optional offset parameter allows you to specify which character in
> haystack to start searching. The position returned is still relative to
> the the beginning of haystack."
>
> So if you are trying to find subsequent occurrences of the string, you'd
> need to make the offset be greater than the last character you checked, or
> you're going to keep getting the first occurrence.
>
> > $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
> > $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
> > $HTML_End = strpos($res_str,"]]>",1);
> > $XML_End = strpos($res_str,"]]>",2);
>
> If you're just trying to pull one bit of data out of a file, you might
> want to look into regex for this purpose. If you're actually trying to
> write a parser, I think you might do well to read up on how other parsers
> work (like, using a stack). Anyway, don't do that, use an existing XML
> parser.. unless you are on a learning quest.. then, by all means!
>
> --
> Kelly Hallman
> //Ultrafancy/