File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DOM of current page?

 
S. Schaefer
Greenhorn
Posts: 7
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.

I was just wondering if there is a way to get the DOM of the currently loaded page for example to a org.jdom.document or something like this,
so that i can get a specific node using xpath or something similar and then get the child-element of that node...?
I found HtmlUnit while "googling" (does that word even exist in english? :P), but i'm not quite sure that it does what i'm looking for ...

Looking forward to your answers and thanks in advance
gilaras
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Current page in what?

Assuming we are talking about a HTML page, what loaded it?

If the page was coded as XHTML it can be parsed into a DOM by normal XML parsers but if was generated as HTML 4 it probably is not valid XML.

Bill
 
S. Schaefer
Greenhorn
Posts: 7
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The current page shown in the firefox webbrowser ;-)
Is should have been coded in xhtml, but rendered by icefaces ... don't know if this has something to say ... ;D
So it should be XMLParser-usable ... but how does the parser get the currently rendered page?
 
Paul Clapham
Sheriff
Pie
Posts: 20166
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, you can access the page's DOM via Javascript. But you seem to be asking about Java. Should we assume your question involves an applet? You didn't say anything like that.
 
S. Schaefer
Greenhorn
Posts: 7
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought i said something like that, i'm sorry ;-)

But your answer helped me nevertheless...
At least i got what i was looking for by using xpath ;-)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic