VdexReload 1.1.3 API

uk.ac.reload.editor.contentpackaging.htmlparser
Class HTMLParser

java.lang.Object
  extended byjavax.swing.text.html.HTMLEditorKit.ParserCallback
      extended byuk.ac.reload.editor.contentpackaging.htmlparser.HTMLParser

public class HTMLParser
extends javax.swing.text.html.HTMLEditorKit.ParserCallback

Class used to parse a web page and find all dependant links contained within it. Additionally used to figure out how & where to copy files when a user wishes to import them


Field Summary
protected  boolean _absoluteLocalLinkFound
          We want to know if a user has put an absolute local link in a page
protected  java.util.Vector _allLinks
          All Links
protected  boolean _firstPage
          We need to check the first page and see if it refers to local links that are higher up in the folder structure than itself.
protected  boolean _higherLocalLinkFound
          We want to know if a user has imported a page which has a local link higher up the directory tree structure than itself
protected  javax.swing.text.html.HTML.Attribute[] _htmlAttributes
           
protected  java.io.File _htmlFile
          The File to Parse
protected  java.util.Hashtable _htmlResourcesTable
          Our main data structure to hold source/destination paths
protected  java.io.File _rootFolder
          The Root Folder
protected  java.io.File _startPath
          Hold the starting point for the webpage(s)
 
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
IMPLIED
 
Constructor Summary
HTMLParser(java.io.File htmlFile)
          Basic Constructor.
HTMLParser(java.io.File htmlFile, java.io.File rootFolder, boolean userWantsToImport)
          Constructor.
 
Method Summary
 java.io.File[] getAllLinks()
          Return all Links
 java.util.Hashtable getLinks()
          Accessor method for links found in page
 java.lang.String getTagText(java.lang.String tagName)
           
 boolean isAbsoluteLocalLinkFound()
          Accessor method to see if any FULL absolute local links were found in the page(s) i.e.
 boolean isHigherLocalLinkFound()
          Accessor method to see if any local links were found in the first page that are higher in the directory tree than itself.
 
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
flush, handleComment, handleEndOfLineString, handleEndTag, handleError, handleSimpleTag, handleStartTag, handleText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_htmlAttributes

protected javax.swing.text.html.HTML.Attribute[] _htmlAttributes

_htmlFile

protected java.io.File _htmlFile
The File to Parse


_firstPage

protected boolean _firstPage
We need to check the first page and see if it refers to local links that are higher up in the folder structure than itself. _firstpage will be used to flag up the first time the code is asked to parse a page.


_rootFolder

protected java.io.File _rootFolder
The Root Folder


_higherLocalLinkFound

protected boolean _higherLocalLinkFound
We want to know if a user has imported a page which has a local link higher up the directory tree structure than itself


_absoluteLocalLinkFound

protected boolean _absoluteLocalLinkFound
We want to know if a user has put an absolute local link in a page


_htmlResourcesTable

protected java.util.Hashtable _htmlResourcesTable
Our main data structure to hold source/destination paths


_startPath

protected java.io.File _startPath
Hold the starting point for the webpage(s)


_allLinks

protected java.util.Vector _allLinks
All Links

Constructor Detail

HTMLParser

public HTMLParser(java.io.File htmlFile)
Basic Constructor. Takes the web page to be parsed as first argument


HTMLParser

public HTMLParser(java.io.File htmlFile,
                  java.io.File rootFolder,
                  boolean userWantsToImport)
Constructor. Takes the web page to be parsed as first argument. Takes a folder path as the second argument, used to calculate where the files are to be copied to.

Parameters:
htmlFile - the html file concerned
rootFolder - folder into which files are to be copied
userWantsToImport - true or false value
Method Detail

getAllLinks

public java.io.File[] getAllLinks()
Return all Links

Returns:
an array of all links

getLinks

public java.util.Hashtable getLinks()
Accessor method for links found in page

Returns:
- hashtable of all source(key) and destination(value) files

isAbsoluteLocalLinkFound

public boolean isAbsoluteLocalLinkFound()
Accessor method to see if any FULL absolute local links were found in the page(s) i.e. 'file:///c:/dreamweaversite/acmeweb/index.htm'

Returns:
true/false

isHigherLocalLinkFound

public boolean isHigherLocalLinkFound()
Accessor method to see if any local links were found in the first page that are higher in the directory tree than itself.

Returns:
true/false

getTagText

public java.lang.String getTagText(java.lang.String tagName)
Returns:
The text value of an HTML tag

VdexReload 1.1.3 API