logo       


Re: Parsing HTML: msg#00086

Subject: Re: Parsing HTML
On Wednesday 26 March 2003 18:33, Ben Sinclair wrote:
> Is there good documentation on how to do [ automatic reloading 
> of *ML pages ]? 

Sorry, there's not much documentation at the site yet, I didn't get around to 
document the new features. Maybe you want to write a howto based on your 
experiences?

Anyway, here's the basiscs that should get you going:

Prerequisites:
- Use XMLC 2.2. Either from CVS, or the binary package provided by David Li
- When you initally compile the pages, pass the "-for-deferred-parsing" option
   to XMLC

For the following, I'm assuming that you use XMLC in a servlet environment. In 
this case, the XMLC factory settings are controlled by servlet context 
parameters specified in web.xml. A detailed list of the availalbe parameters 
is included in the javadocs for org.enhydra.xml.xmlc.servlet.XMLCContext. 
Here are the most important ones pertaining to auto reloading:

- xmlcReloading: Must have the value "reparse" to enable on-the-fly reparsing
- xmlcReparseResourceDirs: A list of directories that XMLC uses to find HTML 
  files. Set this to your HTML document root (or document roots, you can
  specify a path here - XMLC will use the first matching file it finds on this
  path)

Let's assume you store your HTML pages in "/my/document/root", and you've got 
a page named "myPage.html". You've compiled the page with XMLC for deferred 
parsing which gave you the XMLC class "myPageHTML", and you've put a context 
parameter entry in web.xml that sets the reparse resource dir to  
"/my/document/root".

Here's what you need do in the servlet doGet() method in order to access the 
page:

// Get the XMLC context. "this" is the servlet.
XMLCContext ctx = XMLCContext.getContext(this); 
// Get the XMLC factory from the context
XMLCFactory factory = ctx.getXMLCFactory();
// Get the page
MyPageHTML page = (MyPageHTML)factory.create(MyPageHTML.class);

The factory automatically takes care of reparsing the HTML every time that 
either "/my/document/root/myPage.html" or "/my/document/root/mypage.xmlc" is 
changed. Changes are detected by checking the last modified timestamp of the 
files against the time of the last reparse, so you can force a reparse simply 
by touching the file.

Hope this helps,

Richard
-- 
Richard Kunze 

[ t]ivano Software, Bahnhofstr. 18, 63263 Neu-Isenburg
Tel.: +49 6102 80 99 07 - 0, Fax.: +49 6102 80 99 07 - 1
http://www.tivano.de, kunze@xxxxxxxxx 

Attachment: pgperFaXcrRCb.pgp
Description: signature

Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe