Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

HTML and PHP Parser

Thread view: 
Sergey Danilov - 25 Oct 2005 07:17 GMT
Hi all!

Anybody know html parser writing in java which take in account php tags
and could work with non-valid html or processing peace of html document
with php tags?

I found two library
Jericho HTML Parser
http://jerichohtml.sourceforge.net/
but It seems The author doesn't support it.

http://htmlparser.sourceforge.net/
and this very complicatied in use. I can't understand Do it support php
parsing and if it do, What way to use it ???

May be somebady give me good advice or something

Thanks in advance
Roedy Green - 25 Oct 2005 11:36 GMT
On 24 Oct 2005 23:17:24 -0700, "Sergey Danilov"
<SergeyDanilov@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>Anybody know html parser writing in java which take in account php tags
>and could work with non-valid html or processing peace of html document
>with php tags?

for some possibilities see
http://mindprod.com/jgloss/htmlrendering.html

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Monique Y. Mudama - 25 Oct 2005 21:02 GMT
> Hi all!
>
[quoted text clipped - 13 lines]
>
> Thanks in advance

This request doesn't make sense to me.  You would need not just an
HTML parser, but a PHP interpreter.  You would need to run the PHP
script through the interpreter first, and only then could you try to
parse the HTML.

In other words, you'd be better off using exec() to run the script
file through a PHP interpreter, then taking the output of the PHP
interpreter and sending that to an HTML parser.

Am I wrong?

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Oliver Wong - 25 Oct 2005 21:49 GMT
>> Hi all!
>>
[quoted text clipped - 24 lines]
>
> Am I wrong?

   The OP may, for example, be trying to write an IDE that is aware of both
HTML and PHP, and does syntax highlighting, autocompletion and other
Eclipse-like features. This IDE doesn't need to actually run the PHP code,
but merely to parse it, so it can display it in pretty colours. An IDE is
another place where it would be reasonable to want to handle "broken code",
since the programmer might be in the middle of typing a statement and
doesn't want a thousand errors to suddenly pop up after every new character
inserted.

   - Oliver
Monique Y. Mudama - 25 Oct 2005 22:39 GMT
>     The OP may, for example, be trying to write an IDE that is aware
>     of both HTML and PHP, and does syntax highlighting,
[quoted text clipped - 5 lines]
>     doesn't want a thousand errors to suddenly pop up after every
>     new character inserted.

Oh.  My bad.  I thought this was a question about displaying/rendering
HTML in java, not colorizing the code.

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Roedy Green - 26 Oct 2005 01:53 GMT
>An IDE is
>another place where it would be reasonable to want to handle "broken code",
>since the programmer might be in the middle of typing a statement and
>doesn't want a thousand errors to suddenly pop up after every new character
>inserted.

A parser to colourise code is a quite different animal than one to
parse it to run it. I have written a number of colorouriser parsers
that work on fragments.  Mine work more like the way a human does,
looking at just the immediate context looking for clues.  You can't
count on there being a matching declaration.

You can see the results all over my website. Happily, getting a colour
slightly off is not fatal.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Sergey Danilov - 26 Oct 2005 02:39 GMT
Yes.
I actually need for HTML and PHP parsing to make highlighting in my
editor.
Or the way to create this stuff.
Oliver Wong - 26 Oct 2005 15:27 GMT
> Yes.
> I actually need for HTML and PHP parsing to make highlighting in my
> editor.
> Or the way to create this stuff.

   If you're going to integrate this into your own code, you might want to
try the comp.compilers group. The regulars there probably have a treasure
chest of tools for dealing with problems like these.

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.