Java Doc for Parser.java in  » Apache-Harmony-Java-SE » javax-package » javax » swing » text » html » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » javax package » javax.swing.text.html.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.text.html.parser.Parser

All known Subclasses:   javax.swing.text.html.parser.DocumentParser,
Parser
public class Parser implements DTDConstants(Code)
This class attempts to read and parse an HTML file, which it gets via an Input Stream. The parsing is based on a Document Type Definition ( DTD ), and calls various methods (such as handleError, handleStartTag, etc.) when it finds tags or data. This methods should be overriden in a subclass in order to use the parser.

Inner Class :class ParserHandlerImpl implements ParserHandler

Field Summary
protected  DTDdtd
     The actual DTD used to parsed the document.
protected  booleanstrict
     Defines whether the parsing of the document is strict or not.

Constructor Summary
public  Parser(DTD dtd)
    

Method Summary
protected  voidendTag(boolean omitted)
     Calls method that reports that a closing tag has been found.
protected  voiderror(String err)
     Reports an error message with only one information field.
protected  voiderror(String err, String arg1)
    
protected  voiderror(String err, String arg1, String arg2)
    
protected  voiderror(String err, String arg1, String arg2, String arg3)
    
protected  voidflushAttributes()
     Cleans the information stored in the attribute's stack.
protected  SimpleAttributeSetgetAttributes()
     Returns the attributes stored in the attribute's stack.
protected  intgetCurrentLine()
     Reports the line number where the parser is scanning the parsed file.
protected  intgetCurrentPos()
     Reports the current position that is being parsed on the document.
 StringgetEOLString()
    
protected  voidhandleComment(char[] text)
     This method is called when a comment is found in the parsed file.
protected  voidhandleEOFInComment()
     This method is called when the end of the parsed file is found inside a comment.
protected  voidhandleEmptyTag(TagElement tag)
     This method is called when a simple or empty tag is found in the parsed file.
protected  voidhandleEndTag(TagElement tag)
     This method is called when a closing tag is found in the parsed file.
protected  voidhandleError(int ln, String msg)
     This method is called when an error is found in the parsed file.
protected  voidhandleStartTag(TagElement tag)
     This method is called when an opening tag, that is not simple or empty, is found in the parsed file.
protected  voidhandleText(char[] text)
     This method is called when a piece of text is found in the parsed file.
protected  voidhandleTitle(char[] text)
     This method is called when a title is found in the parsed file.
protected  TagElementmakeTag(Element elem)
     Construct a new TagElement with the information stored into a Element .
Parameters:
  elem - the Element that constains the information.
protected  TagElementmakeTag(Element elem, boolean fictional)
     Construct a new TagElement with the information stored into a Element .
Parameters:
  elem - the Element that constains the information.
Parameters:
  fictional - the value stored in the fictional field of theTagElement.
protected  voidmarkFirstTime(Element elem)
     It marks the first occurence of an element inside a document.
public synchronized  voidparse(Reader in)
     It parses a HTML document.
public  StringparseDTDMarkup()
     Obtains the information of the last parsed markup declaration in the parsed file.
protected  booleanparseMarkupDeclarations(StringBuffer strBuff)
    
protected  voidstartTag(TagElement tag)
    

Field Detail
dtd
protected DTD dtd(Code)
The actual DTD used to parsed the document.



strict
protected boolean strict(Code)
Defines whether the parsing of the document is strict or not.




Constructor Detail
Parser
public Parser(DTD dtd)(Code)
Construct a new Parser using the information stored in a DTD
Parameters:
  dtd - the DTD where the information is stored.




Method Detail
endTag
protected void endTag(boolean omitted)(Code)
Calls method that reports that a closing tag has been found.
Parameters:
  omitted - determines whether the end tag may be omitted or not.



error
protected void error(String err)(Code)
Reports an error message with only one information field.
Parameters:
  err - the error message.



error
protected void error(String err, String arg1)(Code)
Reports an error message with two information field
Parameters:
  err - the first part of the message.
Parameters:
  arg1 - the second part of the message.



error
protected void error(String err, String arg1, String arg2)(Code)
Reports an error message with three information field
Parameters:
  err - the first part of the message.
Parameters:
  arg1 - the second part of the message.
Parameters:
  arg2 - the third part of the message.



error
protected void error(String err, String arg1, String arg2, String arg3)(Code)
Reports an error message with four information field
Parameters:
  err - the first part of the message.
Parameters:
  arg1 - the second part of the message.
Parameters:
  arg2 - the third part of the message.
Parameters:
  arg3 - the forth part of the message.



flushAttributes
protected void flushAttributes()(Code)
Cleans the information stored in the attribute's stack.



getAttributes
protected SimpleAttributeSet getAttributes()(Code)
Returns the attributes stored in the attribute's stack. the attributes of the actual attribute's stack.



getCurrentLine
protected int getCurrentLine()(Code)
Reports the line number where the parser is scanning the parsed file. the actual line number in the document.



getCurrentPos
protected int getCurrentPos()(Code)
Reports the current position that is being parsed on the document. the actual position into the parsed file.



getEOLString
String getEOLString()(Code)



handleComment
protected void handleComment(char[] text)(Code)
This method is called when a comment is found in the parsed file.
Parameters:
  text - the text found as comment.



handleEOFInComment
protected void handleEOFInComment()(Code)
This method is called when the end of the parsed file is found inside a comment.



handleEmptyTag
protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException(Code)
This method is called when a simple or empty tag is found in the parsed file.
Parameters:
  tag - the TagElement that contains the information of theparsed opening tag.
throws:
  ChangedCharSetException -



handleEndTag
protected void handleEndTag(TagElement tag)(Code)
This method is called when a closing tag is found in the parsed file.
Parameters:
  tag - the TagElement that contains the information of theparsed opening tag.



handleError
protected void handleError(int ln, String msg)(Code)
This method is called when an error is found in the parsed file.
Parameters:
  ln - the line number where the error was found.
Parameters:
  msg - an appropiate message for the found error.



handleStartTag
protected void handleStartTag(TagElement tag)(Code)
This method is called when an opening tag, that is not simple or empty, is found in the parsed file.
Parameters:
  tag - the TagElement that contains the information of theparsed opening tag.



handleText
protected void handleText(char[] text)(Code)
This method is called when a piece of text is found in the parsed file.
Parameters:
  text - the piece of text found in the document.



handleTitle
protected void handleTitle(char[] text)(Code)
This method is called when a title is found in the parsed file.
Parameters:
  text - the piece of text found as part of the title of the parsedfile.



makeTag
protected TagElement makeTag(Element elem)(Code)
Construct a new TagElement with the information stored into a Element .
Parameters:
  elem - the Element that constains the information. a new TagElement that encapsullates the Elementreceived as argument. The fictional value is set to false.



makeTag
protected TagElement makeTag(Element elem, boolean fictional)(Code)
Construct a new TagElement with the information stored into a Element .
Parameters:
  elem - the Element that constains the information.
Parameters:
  fictional - the value stored in the fictional field of theTagElement. a new TagElement that encapsullates the Elementreceived as argument.



markFirstTime
protected void markFirstTime(Element elem)(Code)
It marks the first occurence of an element inside a document.
Parameters:
  elem - the Element whose first occurence wants to bemarked.



parse
public synchronized void parse(Reader in) throws IOException(Code)
It parses a HTML document.
During the parsing process, this method invokes the handlers for text, tags, comment, ... that posses this class. In this way, the user may be notified about all the information found in the parsed file.
Parameters:
  in - a reader from where the document to be parsed will be extractduring the parsing process.
throws:
  IOException -



parseDTDMarkup
public String parseDTDMarkup() throws IOException(Code)
Obtains the information of the last parsed markup declaration in the parsed file. the information stored in the last parsed markup declaration.
throws:
  IOException -



parseMarkupDeclarations
protected boolean parseMarkupDeclarations(StringBuffer strBuff) throws IOException(Code)



startTag
protected void startTag(TagElement tag) throws ChangedCharSetException(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.