org.archive.wayback.util.htmllex
Class ParseContext

java.lang.Object
  extended by org.archive.wayback.util.htmllex.ParseContext
Direct Known Subclasses:
ReplayParseContext

public class ParseContext
extends Object

Class which tracks the context and state involved with parsing an HTML document via SAX events. Also holds some page URL information, and provides some URL resolving functionality. Lastly, this class exposes a general purpose HashMap for use by specific applications.

Version:
$Date: 2010-10-12 01:56:38 +0700 (Tue, 12 Oct 2010) $, $Revision: 3271 $
Author:
brad

Field Summary
protected  org.archive.net.UURI baseUrl
           
 
Constructor Summary
ParseContext()
          constructor
 
Method Summary
 String contextualizeUrl(String url)
           
 String getData(String key)
          Retrieves previously stored data for key key from this ParseContext
 Map<String,String> getMap()
           
 boolean isInCSS()
           
 boolean isInJS()
           
 boolean isInScriptText()
           
 void putData(String key, String value)
          Stores arbitrary key value pairs in this ParseContext
 String resolve(String url)
           
 void setBaseUrl(URL url)
           
 void setInCSS(boolean inCSS)
           
 void setInJS(boolean inJS)
           
 void setInScriptText(boolean inScriptText)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseUrl

protected org.archive.net.UURI baseUrl
Constructor Detail

ParseContext

public ParseContext()
constructor

Method Detail

putData

public void putData(String key,
                    String value)
Stores arbitrary key value pairs in this ParseContext

Parameters:
key - for storage
value - for storage

getData

public String getData(String key)
Retrieves previously stored data for key key from this ParseContext

Parameters:
key - under which value was stored
Returns:
previously stored value for key or null, if nothing was stored

getMap

public Map<String,String> getMap()
Returns:
the full Map of String to String for this parsing context.

setBaseUrl

public void setBaseUrl(URL url)
Parameters:
url - against which relative URLs should be resolved for this parse

resolve

public String resolve(String url)
               throws URISyntaxException
Parameters:
url - which should be resolved against the baseUrl for this ParseContext.
Returns:
absolute form of url, resolved against baseUrl if relative.
Throws:
URISyntaxException - if the input URL is malformed

contextualizeUrl

public String contextualizeUrl(String url)
Parameters:
url - which should be resolved.
Returns:
absolute form of input url, or url itself if javascript:

isInCSS

public boolean isInCSS()
Returns:
the inCSS

setInCSS

public void setInCSS(boolean inCSS)
Parameters:
inCSS - the inCSS to set

isInJS

public boolean isInJS()
Returns:
the inJS

setInJS

public void setInJS(boolean inJS)
Parameters:
inJS - the inJS to set

isInScriptText

public boolean isInScriptText()
Returns:
the inScriptText

setInScriptText

public void setInScriptText(boolean inScriptText)
Parameters:
inScriptText - the inScriptText to set


Copyright © 2005-2011 Internet Archive. All Rights Reserved.