Java Doc for HTMLTagBalancer.java in  » HTML-Parser » nekohtml » org » cyberneko » html » 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 » HTML Parser » nekohtml » org.cyberneko.html 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.cyberneko.html.HTMLTagBalancer

HTMLTagBalancer
public class HTMLTagBalancer implements XMLDocumentFilter,HTMLComponent(Code)
Balances tags in an HTML document. This component receives document events and tries to correct many common mistakes that human (and computer) HTML document authors make. This tag balancer can:
  • add missing parent elements;
  • automatically close elements with optional end tags; and
  • handle mis-matched inline element tags.

This component recognizes the following features:

  • http://cyberneko.org/html/features/augmentations
  • http://cyberneko.org/html/features/report-errors
  • http://cyberneko.org/html/features/balance-tags/document-fragment
  • http://cyberneko.org/html/features/balance-tags/ignore-outside-content

This component recognizes the following properties:

  • http://cyberneko.org/html/properties/names/elems
  • http://cyberneko.org/html/properties/names/attrs
  • http://cyberneko.org/html/properties/error-reporter

See Also:   HTMLElements
author:
   Andy Clark
version:
   $Id: HTMLTagBalancer.java,v 1.20 2005/02/14 04:06:22 andyc Exp $

Inner Class :public static class Info
Inner Class :public static class InfoStack

Field Summary
final protected static  StringAUGMENTATIONS
     Include infoset augmentations.
final protected static  StringDOCUMENT_FRAGMENT
     Document fragment balancing only.
final protected static  StringDOCUMENT_FRAGMENT_DEPRECATED
     Document fragment balancing only (deprecated).
final protected static  StringERROR_REPORTER
     Error reporter.
final protected static  StringIGNORE_OUTSIDE_CONTENT
     Ignore outside content.
final protected static  StringNAMESPACES
     Namespaces.
final protected static  StringNAMES_ATTRS
     Modify HTML attribute names: { "upper", "lower", "default" }.
final protected static  StringNAMES_ELEMS
     Modify HTML element names: { "upper", "lower", "default" }.
final protected static  shortNAMES_LOWERCASE
     Lowercase HTML names.
final protected static  shortNAMES_MATCH
     Match HTML element names.
final protected static  shortNAMES_NO_CHANGE
     Don't modify HTML names.
final protected static  shortNAMES_UPPERCASE
     Uppercase HTML names.
final protected static  StringREPORT_ERRORS
     Report errors.
final protected static  HTMLEventInfoSYNTHESIZED_ITEM
     Synthesized event info item.
protected  booleanfAugmentations
     Include infoset augmentations.
protected  booleanfDocumentFragment
     Document fragment balancing only.
protected  XMLDocumentHandlerfDocumentHandler
     The document handler.
protected  XMLDocumentSourcefDocumentSource
     The document source.
final protected  InfoStackfElementStack
     The element stack.
protected  HTMLErrorReporterfErrorReporter
     Error reporter.
protected  booleanfIgnoreOutsideContent
     Ignore outside content.
final protected  InfoStackfInlineStack
     The inline stack.
protected  shortfNamesAttrs
     Modify HTML attribute names.
protected  shortfNamesElems
     Modify HTML element names.
protected  booleanfNamespaces
     Namespaces.
protected  booleanfOpenedForm
    
protected  booleanfReportErrors
     Report errors.
protected  booleanfSeenAnything
     True if seen anything.
protected  booleanfSeenBodyElement
     True if seen <body< element.
protected  booleanfSeenDoctype
     True if root element has been seen.
protected  booleanfSeenHeadElement
     True if seen <head< element.
protected  booleanfSeenRootElement
     True if root element has been seen.
protected  booleanfSeenRootElementEnd
     True if seen the end of the document element.
protected  HTMLTagBalancingListenertagBalancingListener
    


Method Summary
final protected  voidcallEndElement(QName element, Augmentations augs)
     Call document handler end element.
final protected  voidcallStartElement(QName element, XMLAttributes attrs, Augmentations augs)
     Call document handler start element.
public  voidcharacters(XMLString text, Augmentations augs)
     Characters.
public  voidcomment(XMLString text, Augmentations augs)
     Comment.
public  voiddoctypeDecl(String rootElementName, String publicId, String systemId, Augmentations augs)
     Doctype declaration.
final protected  XMLAttributesemptyAttributes()
     Returns a set of empty attributes.
public  voidemptyElement(QName elem, XMLAttributes attrs, Augmentations augs)
     Empty element.
public  voidendCDATA(Augmentations augs)
     End CDATA section.
public  voidendDocument(Augmentations augs)
     End document.
public  voidendElement(QName element, Augmentations augs)
     End element.
public  voidendGeneralEntity(String name, Augmentations augs)
     End entity.
public  voidendPrefixMapping(String prefix, Augmentations augs)
     End prefix mapping.
public  XMLDocumentHandlergetDocumentHandler()
     Returns the document handler.
public  XMLDocumentSourcegetDocumentSource()
     Returns the document source.
protected  HTMLElements.ElementgetElement(String name)
     Returns an HTML element.
final protected  intgetElementDepth(HTMLElements.Element element)
     Returns the depth of the open tag associated with the specified element name or -1 if no matching element is found.
public  BooleangetFeatureDefault(String featureId)
     Returns the default state for a feature.
final protected static  shortgetNamesValue(String value)
     Converts HTML names string value to constant value.
protected  intgetParentDepth(HTMLElements.Element[] parents, short bounds)
     Returns the depth of the open tag associated with the specified element parent names or -1 if no matching element is found.
public  ObjectgetPropertyDefault(String propertyId)
     Returns the default state for a property.
public  String[]getRecognizedFeatures()
     Returns recognized features.
public  String[]getRecognizedProperties()
     Returns recognized properties.
public  voidignorableWhitespace(XMLString text, Augmentations augs)
     Ignorable whitespace.
final protected static  StringmodifyName(String name, short mode)
     Modifies the given name based on the specified mode.
public  voidprocessingInstruction(String target, XMLString data, Augmentations augs)
     Processing instruction.
public  voidreset(XMLComponentManager manager)
     Resets the component.
public  voidsetDocumentHandler(XMLDocumentHandler handler)
     Sets the document handler.
public  voidsetDocumentSource(XMLDocumentSource source)
     Sets the document source.
public  voidsetFeature(String featureId, boolean state)
     Sets a feature.
public  voidsetProperty(String propertyId, Object value)
     Sets a property.
 voidsetTagBalancingListener(HTMLTagBalancingListener tagBalancingListener)
    
public  voidstartCDATA(Augmentations augs)
     Start CDATA section.
public  voidstartDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs)
     Start document.
public  voidstartDocument(XMLLocator locator, String encoding, Augmentations augs)
     Start document.
public  voidstartElement(QName elem, XMLAttributes attrs, Augmentations augs)
     Start element.
public  voidstartGeneralEntity(String name, XMLResourceIdentifier id, String encoding, Augmentations augs)
     Start entity.
public  voidstartPrefixMapping(String prefix, String uri, Augmentations augs)
     Start prefix mapping.
final protected  AugmentationssynthesizedAugs()
     Returns an augmentations object with a synthesized item added.
public  voidtextDecl(String version, String encoding, Augmentations augs)
     Text declaration.
public  voidxmlDecl(String version, String encoding, String standalone, Augmentations augs)
     XML declaration.

Field Detail
AUGMENTATIONS
final protected static String AUGMENTATIONS(Code)
Include infoset augmentations.



DOCUMENT_FRAGMENT
final protected static String DOCUMENT_FRAGMENT(Code)
Document fragment balancing only.



DOCUMENT_FRAGMENT_DEPRECATED
final protected static String DOCUMENT_FRAGMENT_DEPRECATED(Code)
Document fragment balancing only (deprecated).



ERROR_REPORTER
final protected static String ERROR_REPORTER(Code)
Error reporter.



IGNORE_OUTSIDE_CONTENT
final protected static String IGNORE_OUTSIDE_CONTENT(Code)
Ignore outside content.



NAMESPACES
final protected static String NAMESPACES(Code)
Namespaces.



NAMES_ATTRS
final protected static String NAMES_ATTRS(Code)
Modify HTML attribute names: { "upper", "lower", "default" }.



NAMES_ELEMS
final protected static String NAMES_ELEMS(Code)
Modify HTML element names: { "upper", "lower", "default" }.



NAMES_LOWERCASE
final protected static short NAMES_LOWERCASE(Code)
Lowercase HTML names.



NAMES_MATCH
final protected static short NAMES_MATCH(Code)
Match HTML element names.



NAMES_NO_CHANGE
final protected static short NAMES_NO_CHANGE(Code)
Don't modify HTML names.



NAMES_UPPERCASE
final protected static short NAMES_UPPERCASE(Code)
Uppercase HTML names.



REPORT_ERRORS
final protected static String REPORT_ERRORS(Code)
Report errors.



SYNTHESIZED_ITEM
final protected static HTMLEventInfo SYNTHESIZED_ITEM(Code)
Synthesized event info item.



fAugmentations
protected boolean fAugmentations(Code)
Include infoset augmentations.



fDocumentFragment
protected boolean fDocumentFragment(Code)
Document fragment balancing only.



fDocumentHandler
protected XMLDocumentHandler fDocumentHandler(Code)
The document handler.



fDocumentSource
protected XMLDocumentSource fDocumentSource(Code)
The document source.



fElementStack
final protected InfoStack fElementStack(Code)
The element stack.



fErrorReporter
protected HTMLErrorReporter fErrorReporter(Code)
Error reporter.



fIgnoreOutsideContent
protected boolean fIgnoreOutsideContent(Code)
Ignore outside content.



fInlineStack
final protected InfoStack fInlineStack(Code)
The inline stack.



fNamesAttrs
protected short fNamesAttrs(Code)
Modify HTML attribute names.



fNamesElems
protected short fNamesElems(Code)
Modify HTML element names.



fNamespaces
protected boolean fNamespaces(Code)
Namespaces.



fOpenedForm
protected boolean fOpenedForm(Code)
True if a form is in the stack (allow to discard opening of nested forms)



fReportErrors
protected boolean fReportErrors(Code)
Report errors.



fSeenAnything
protected boolean fSeenAnything(Code)
True if seen anything. Important for xml declaration.



fSeenBodyElement
protected boolean fSeenBodyElement(Code)
True if seen <body< element.



fSeenDoctype
protected boolean fSeenDoctype(Code)
True if root element has been seen.



fSeenHeadElement
protected boolean fSeenHeadElement(Code)
True if seen <head< element.



fSeenRootElement
protected boolean fSeenRootElement(Code)
True if root element has been seen.



fSeenRootElementEnd
protected boolean fSeenRootElementEnd(Code)
True if seen the end of the document element. In other words, this variable is set to false until the end </HTML> tag is seen (or synthesized). This is used to ensure that extraneous events after the end of the document element do not make the document stream ill-formed.



tagBalancingListener
protected HTMLTagBalancingListener tagBalancingListener(Code)





Method Detail
callEndElement
final protected void callEndElement(QName element, Augmentations augs) throws XNIException(Code)
Call document handler end element.



callStartElement
final protected void callStartElement(QName element, XMLAttributes attrs, Augmentations augs) throws XNIException(Code)
Call document handler start element.



characters
public void characters(XMLString text, Augmentations augs) throws XNIException(Code)
Characters.



comment
public void comment(XMLString text, Augmentations augs) throws XNIException(Code)
Comment.



doctypeDecl
public void doctypeDecl(String rootElementName, String publicId, String systemId, Augmentations augs) throws XNIException(Code)
Doctype declaration.



emptyAttributes
final protected XMLAttributes emptyAttributes()(Code)
Returns a set of empty attributes.



emptyElement
public void emptyElement(QName elem, XMLAttributes attrs, Augmentations augs) throws XNIException(Code)
Empty element.



endCDATA
public void endCDATA(Augmentations augs) throws XNIException(Code)
End CDATA section.



endDocument
public void endDocument(Augmentations augs) throws XNIException(Code)
End document.



endElement
public void endElement(QName element, Augmentations augs) throws XNIException(Code)
End element.



endGeneralEntity
public void endGeneralEntity(String name, Augmentations augs) throws XNIException(Code)
End entity.



endPrefixMapping
public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException(Code)
End prefix mapping.



getDocumentHandler
public XMLDocumentHandler getDocumentHandler()(Code)
Returns the document handler.



getDocumentSource
public XMLDocumentSource getDocumentSource()(Code)
Returns the document source.



getElement
protected HTMLElements.Element getElement(String name)(Code)
Returns an HTML element.



getElementDepth
final protected int getElementDepth(HTMLElements.Element element)(Code)
Returns the depth of the open tag associated with the specified element name or -1 if no matching element is found.
Parameters:
  element - The element.



getFeatureDefault
public Boolean getFeatureDefault(String featureId)(Code)
Returns the default state for a feature.



getNamesValue
final protected static short getNamesValue(String value)(Code)
Converts HTML names string value to constant value.
See Also:   HTMLTagBalancer.NAMES_NO_CHANGE
See Also:   HTMLTagBalancer.NAMES_LOWERCASE
See Also:   HTMLTagBalancer.NAMES_UPPERCASE



getParentDepth
protected int getParentDepth(HTMLElements.Element[] parents, short bounds)(Code)
Returns the depth of the open tag associated with the specified element parent names or -1 if no matching element is found.
Parameters:
  parents - The parent elements.



getPropertyDefault
public Object getPropertyDefault(String propertyId)(Code)
Returns the default state for a property.



getRecognizedFeatures
public String[] getRecognizedFeatures()(Code)
Returns recognized features.



getRecognizedProperties
public String[] getRecognizedProperties()(Code)
Returns recognized properties.



ignorableWhitespace
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException(Code)
Ignorable whitespace.



modifyName
final protected static String modifyName(String name, short mode)(Code)
Modifies the given name based on the specified mode.



processingInstruction
public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException(Code)
Processing instruction.



reset
public void reset(XMLComponentManager manager) throws XMLConfigurationException(Code)
Resets the component.



setDocumentHandler
public void setDocumentHandler(XMLDocumentHandler handler)(Code)
Sets the document handler.



setDocumentSource
public void setDocumentSource(XMLDocumentSource source)(Code)
Sets the document source.



setFeature
public void setFeature(String featureId, boolean state) throws XMLConfigurationException(Code)
Sets a feature.



setProperty
public void setProperty(String propertyId, Object value) throws XMLConfigurationException(Code)
Sets a property.



setTagBalancingListener
void setTagBalancingListener(HTMLTagBalancingListener tagBalancingListener)(Code)



startCDATA
public void startCDATA(Augmentations augs) throws XNIException(Code)
Start CDATA section.



startDocument
public void startDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs) throws XNIException(Code)
Start document.



startDocument
public void startDocument(XMLLocator locator, String encoding, Augmentations augs) throws XNIException(Code)
Start document.



startElement
public void startElement(QName elem, XMLAttributes attrs, Augmentations augs) throws XNIException(Code)
Start element.



startGeneralEntity
public void startGeneralEntity(String name, XMLResourceIdentifier id, String encoding, Augmentations augs) throws XNIException(Code)
Start entity.



startPrefixMapping
public void startPrefixMapping(String prefix, String uri, Augmentations augs) throws XNIException(Code)
Start prefix mapping.



synthesizedAugs
final protected Augmentations synthesizedAugs()(Code)
Returns an augmentations object with a synthesized item added.



textDecl
public void textDecl(String version, String encoding, Augmentations augs) throws XNIException(Code)
Text declaration.



xmlDecl
public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) throws XNIException(Code)
XML declaration.



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.