Java Doc for Node.java in  » HTML-Parser » JTidy » org » w3c » tidy » 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 » JTidy » org.w3c.tidy 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.w3c.tidy.Node

Node
public class Node implements Cloneable(Code)
Used for elements and text nodes element name is null for text nodes start and end are offsets into lexbuf which contains the textual content of all elements in the parse tree. Parent and content allow traversal of the parse tree in any direction. attributes are represented as a linked list of AttVal nodes which hold the strings for attribute/value pairs.
author:
   Dave Raggett dsr@w3.org
author:
   Andy Quick ac.quick@sympatico.ca (translation to Java)
author:
   Fabrizio Giustina
version:
   $Revision: 1.31 $ ($Author: fgiust $)


Field Summary
final public static  shortASP_TAG
     node type: asp tag.
final public static  shortCDATA_TAG
     node type: CDATA.
final public static  shortCOMMENT_TAG
     node type: comment.
final public static  shortDOCTYPE_TAG
     node type: doctype.
final public static  shortEND_TAG
     End tag.
final public static  shortJSTE_TAG
     node type: jste tag.
final public static  shortPHP_TAG
     node type: php tag.
final public static  shortPROC_INS_TAG
     node type: .
final public static  shortROOT_NODE
     node type: root.
final public static  shortSECTION_TAG
     node type: section tag.
final public static  shortSTART_END_TAG
     Start of an end tag.
final public static  shortSTART_TAG
     Start tag.
final public static  shortTEXT_NODE
     node type: text.
final public static  shortXML_DECL
     node type: doctype.
protected  org.w3c.dom.Nodeadapter
     DOM adapter.
protected  AttValattributes
     Attribute/Value linked list.
protected  booleanclosed
     true if closed by explicit end tag.
protected  Nodecontent
     Contained node.
protected  Stringelement
     Tag name.
protected  intend
     end of span onto text array.
protected  booleanimplicit
     true if inferred.
protected  Nodelast
     last node.
protected  booleanlinebreak
     true if followed by a line break.
protected  Nodenext
     next node.
protected  Nodeparent
     parent node.
protected  Nodeprev
     pevious node.
protected  intstart
     start of span onto text array.
protected  Dicttag
     tag's dictionary definition.
protected  byte[]textarray
     the text array.
protected  shorttype
     TextNode, StartTag, EndTag etc.
protected  Dictwas
     old tag when it was changed.

Constructor Summary
public  Node()
     Instantiates a new text node.
public  Node(short type, byte[] textarray, int start, int end)
     Instantiates a new node.
Parameters:
  type - node type: Node.ROOT_NODE | Node.DOCTYPE_TAG | Node.COMMENT_TAG | Node.PROC_INS_TAG | Node.TEXT_NODE |Node.START_TAG | Node.END_TAG | Node.START_END_TAG | Node.CDATA_TAG | Node.SECTION_TAG | Node.
public  Node(short type, byte[] textarray, int start, int end, String element, TagTable tt)
     Instantiates a new node.
Parameters:
  type - node type: Node.ROOT_NODE | Node.DOCTYPE_TAG | Node.COMMENT_TAG | Node.PROC_INS_TAG | Node.TEXT_NODE |Node.START_TAG | Node.END_TAG | Node.START_END_TAG | Node.CDATA_TAG | Node.SECTION_TAG | Node.

Method Summary
public  voidaddAttribute(String name, String value)
     Adds an attribute to the node.
public  voidaddClass(String classname)
     Add a css class to the node.
public  voidcheckAttributes(Lexer lexer)
     Default method for checking an element's attributes.
public  booleancheckNodeIntegrity()
     Checks for node integrity.
protected  Objectclone()
     Used to clone heading nodes when split by an hr.
protected  NodecloneNode(boolean deep)
     Clone this node.
public static  voidcoerceNode(Lexer lexer, Node node, Dict tag)
     Coerce a node.
public  voiddiscardDocType()
     Discard the doctype node.
public static  NodediscardElement(Node element)
     Remove node from markup tree and discard it.
protected static  NodeescapeTag(Lexer lexer, Node element)
     Escapes the given tag.
public  booleanexpectsContent()
    
public  NodefindBody(TagTable tt)
     Find the body node.
public  NodefindDocType()
     Find the doctype element.
public  NodefindHEAD(TagTable tt)
     Find the head tag.
public  NodefindHTML(TagTable tt)
     Find the "html" element.
public static  voidfixEmptyRow(Lexer lexer, Node row)
     If a table row is empty then insert an empty cell.This practice is consistent with browser behavior and avoids potential problems with row spanning cells.
protected  org.w3c.dom.NodegetAdapter()
     Returns a DOM Node which wrap the current tidy Node.
public  AttValgetAttrByName(String name)
     Returns an attribute with the given name in the current node.
Parameters:
  name - attribute name.
public  booleanhasOneChild()
    
public static  voidinsertDocType(Lexer lexer, Node element, Node doctype)
     The doctype has been found after other tags, and needs moving to before the html element.
public static  booleaninsertMisc(Node element, Node node)
     Insert a node at the end.
public  voidinsertNodeAfterElement(Node node)
     Insert node into markup tree after element.
public static  voidinsertNodeAsParent(Node element, Node node)
     Insert node into markup tree in pace of element which is moved to become the child of the node.
Parameters:
  element - child node.
public  voidinsertNodeAtEnd(Node node)
     Insert node into markup tree.
public  voidinsertNodeAtStart(Node node)
     Insert a node into markup tree.
public static  voidinsertNodeBeforeElement(Node element, Node node)
     Insert node into markup tree before element.
Parameters:
  element - child node.
public  booleanisBlank(Lexer lexer)
     Is the node content empty or blank? Assumes node is a text node.
public  booleanisDescendantOf(Dict tag)
    
public  booleanisElement()
    
public  booleanisJavaScript()
     Used to check script node for script language.
public  booleanisNewNode()
     Is this a new (user defined) node? Used to determine how attributes without values should be printed.
public static  voidmoveBeforeTable(Node row, Node node, TagTable tt)
     Unexpected content in table row is moved to just before the table in accordance with Netscape and IE.
public  voidremoveAttribute(AttVal attr)
     Remove an attribute from node and then free it.
public  voidremoveNode()
     Extract this node and its children from a markup tree.
public  voidrepairDuplicateAttributes(Lexer lexer)
     The same attribute name can't be used more than once in each element.
protected  voidsetType(short newType)
     Setter for node type.
public  StringtoString()
    
public static  voidtrimEmptyElement(Lexer lexer, Node element)
     Trim an empty element.
public static  voidtrimInitialSpace(Lexer lexer, Node element, Node text)
     This maps <p> hello <em> world </em> to <p> hello <em> world </em>.
public static  voidtrimSpaces(Lexer lexer, Node element)
     Move initial and trailing space out.
public static  voidtrimTrailingSpace(Lexer lexer, Node element, Node last)
     This maps hello world to hello world .

Field Detail
ASP_TAG
final public static short ASP_TAG(Code)
node type: asp tag.



CDATA_TAG
final public static short CDATA_TAG(Code)
node type: CDATA.



COMMENT_TAG
final public static short COMMENT_TAG(Code)
node type: comment.



DOCTYPE_TAG
final public static short DOCTYPE_TAG(Code)
node type: doctype.



END_TAG
final public static short END_TAG(Code)
End tag.



JSTE_TAG
final public static short JSTE_TAG(Code)
node type: jste tag.



PHP_TAG
final public static short PHP_TAG(Code)
node type: php tag.



PROC_INS_TAG
final public static short PROC_INS_TAG(Code)
node type: .



ROOT_NODE
final public static short ROOT_NODE(Code)
node type: root.



SECTION_TAG
final public static short SECTION_TAG(Code)
node type: section tag.



START_END_TAG
final public static short START_END_TAG(Code)
Start of an end tag.



START_TAG
final public static short START_TAG(Code)
Start tag.



TEXT_NODE
final public static short TEXT_NODE(Code)
node type: text.



XML_DECL
final public static short XML_DECL(Code)
node type: doctype.



adapter
protected org.w3c.dom.Node adapter(Code)
DOM adapter.



attributes
protected AttVal attributes(Code)
Attribute/Value linked list.



closed
protected boolean closed(Code)
true if closed by explicit end tag.



content
protected Node content(Code)
Contained node.



element
protected String element(Code)
Tag name.



end
protected int end(Code)
end of span onto text array.



implicit
protected boolean implicit(Code)
true if inferred.



last
protected Node last(Code)
last node.



linebreak
protected boolean linebreak(Code)
true if followed by a line break.



next
protected Node next(Code)
next node.



parent
protected Node parent(Code)
parent node.



prev
protected Node prev(Code)
pevious node.



start
protected int start(Code)
start of span onto text array.



tag
protected Dict tag(Code)
tag's dictionary definition.



textarray
protected byte[] textarray(Code)
the text array.



type
protected short type(Code)
TextNode, StartTag, EndTag etc.



was
protected Dict was(Code)
old tag when it was changed.




Constructor Detail
Node
public Node()(Code)
Instantiates a new text node.



Node
public Node(short type, byte[] textarray, int start, int end)(Code)
Instantiates a new node.
Parameters:
  type - node type: Node.ROOT_NODE | Node.DOCTYPE_TAG | Node.COMMENT_TAG | Node.PROC_INS_TAG | Node.TEXT_NODE |Node.START_TAG | Node.END_TAG | Node.START_END_TAG | Node.CDATA_TAG | Node.SECTION_TAG | Node. ASP_TAG |Node.JSTE_TAG | Node.PHP_TAG | Node.XML_DECL
Parameters:
  textarray - array of bytes contained in the Node
Parameters:
  start - start position
Parameters:
  end - end position



Node
public Node(short type, byte[] textarray, int start, int end, String element, TagTable tt)(Code)
Instantiates a new node.
Parameters:
  type - node type: Node.ROOT_NODE | Node.DOCTYPE_TAG | Node.COMMENT_TAG | Node.PROC_INS_TAG | Node.TEXT_NODE |Node.START_TAG | Node.END_TAG | Node.START_END_TAG | Node.CDATA_TAG | Node.SECTION_TAG | Node. ASP_TAG |Node.JSTE_TAG | Node.PHP_TAG | Node.XML_DECL
Parameters:
  textarray - array of bytes contained in the Node
Parameters:
  start - start position
Parameters:
  end - end position
Parameters:
  element - tag name
Parameters:
  tt - tag table instance




Method Detail
addAttribute
public void addAttribute(String name, String value)(Code)
Adds an attribute to the node.
Parameters:
  name - attribute name
Parameters:
  value - attribute value



addClass
public void addClass(String classname)(Code)
Add a css class to the node. If a class attribute already exists adds the value to the existing attribute.
Parameters:
  classname - css class name



checkAttributes
public void checkAttributes(Lexer lexer)(Code)
Default method for checking an element's attributes.
Parameters:
  lexer - Lexer



checkNodeIntegrity
public boolean checkNodeIntegrity()(Code)
Checks for node integrity. false if node is not consistent



clone
protected Object clone()(Code)
Used to clone heading nodes when split by an hr.
See Also:   java.lang.Object.clone



cloneNode
protected Node cloneNode(boolean deep)(Code)
Clone this node.
Parameters:
  deep - if true deep clone the node (also clones all the contained nodes) cloned node



coerceNode
public static void coerceNode(Lexer lexer, Node node, Dict tag)(Code)
Coerce a node.
Parameters:
  lexer - Lexer
Parameters:
  node - Node
Parameters:
  tag - tag dictionary reference



discardDocType
public void discardDocType()(Code)
Discard the doctype node.



discardElement
public static Node discardElement(Node element)(Code)
Remove node from markup tree and discard it.
Parameters:
  element - discarded node next node



escapeTag
protected static Node escapeTag(Lexer lexer, Node element)(Code)
Escapes the given tag.
Parameters:
  lexer - Lexer
Parameters:
  element - node to be escaped escaped node



expectsContent
public boolean expectsContent()(Code)
Does the node expect contents? false if this node should be empty



findBody
public Node findBody(TagTable tt)(Code)
Find the body node.
Parameters:
  tt - tag table body node



findDocType
public Node findDocType()(Code)
Find the doctype element. doctype node or null if not found



findHEAD
public Node findHEAD(TagTable tt)(Code)
Find the head tag.
Parameters:
  tt - tag table head node



findHTML
public Node findHTML(TagTable tt)(Code)
Find the "html" element.
Parameters:
  tt - tag table html node



fixEmptyRow
public static void fixEmptyRow(Lexer lexer, Node row)(Code)
If a table row is empty then insert an empty cell.This practice is consistent with browser behavior and avoids potential problems with row spanning cells.
Parameters:
  lexer - Lexer
Parameters:
  row - row node



getAdapter
protected org.w3c.dom.Node getAdapter()(Code)
Returns a DOM Node which wrap the current tidy Node. org.w3c.dom.Node instance



getAttrByName
public AttVal getAttrByName(String name)(Code)
Returns an attribute with the given name in the current node.
Parameters:
  name - attribute name. AttVal instance or null if no attribute with the iven name is found



hasOneChild
public boolean hasOneChild()(Code)
Does the node have one (and only one) child? true if the node has one child



insertDocType
public static void insertDocType(Lexer lexer, Node element, Node doctype)(Code)
The doctype has been found after other tags, and needs moving to before the html element.
Parameters:
  lexer - Lexer
Parameters:
  element - document
Parameters:
  doctype - doctype node to insert at the beginning of element



insertMisc
public static boolean insertMisc(Node element, Node node)(Code)
Insert a node at the end.
Parameters:
  element - parent node
Parameters:
  node - will be inserted at the end of element true if the node has been inserted



insertNodeAfterElement
public void insertNodeAfterElement(Node node)(Code)
Insert node into markup tree after element.
Parameters:
  node - new node to insert



insertNodeAsParent
public static void insertNodeAsParent(Node element, Node node)(Code)
Insert node into markup tree in pace of element which is moved to become the child of the node.
Parameters:
  element - child node. Will be inserted as a child of element
Parameters:
  node - parent node



insertNodeAtEnd
public void insertNodeAtEnd(Node node)(Code)
Insert node into markup tree.
Parameters:
  node - Node to insert



insertNodeAtStart
public void insertNodeAtStart(Node node)(Code)
Insert a node into markup tree.
Parameters:
  node - to insert



insertNodeBeforeElement
public static void insertNodeBeforeElement(Node element, Node node)(Code)
Insert node into markup tree before element.
Parameters:
  element - child node. Will be insertedbefore element
Parameters:
  node - following node



isBlank
public boolean isBlank(Lexer lexer)(Code)
Is the node content empty or blank? Assumes node is a text node.
Parameters:
  lexer - Lexer true if the node content empty or blank



isDescendantOf
public boolean isDescendantOf(Dict tag)(Code)
Is this node contained in a given tag?
Parameters:
  tag - descendant tag true if node is contained in tag



isElement
public boolean isElement()(Code)
Is the node an element? true if type is START_TAG | START_END_TAG



isJavaScript
public boolean isJavaScript()(Code)
Used to check script node for script language. true if the script node contains javascript



isNewNode
public boolean isNewNode()(Code)
Is this a new (user defined) node? Used to determine how attributes without values should be printed. This was introduced to deal with user defined tags e.g. Cold Fusion. true if this node represents a user-defined tag.



moveBeforeTable
public static void moveBeforeTable(Node row, Node node, TagTable tt)(Code)
Unexpected content in table row is moved to just before the table in accordance with Netscape and IE. This code assumes that node hasn't been inserted into the row.
Parameters:
  row - Row node
Parameters:
  node - Node which should be moved before the table
Parameters:
  tt - tag table



removeAttribute
public void removeAttribute(AttVal attr)(Code)
Remove an attribute from node and then free it.
Parameters:
  attr - attribute to remove



removeNode
public void removeNode()(Code)
Extract this node and its children from a markup tree.



repairDuplicateAttributes
public void repairDuplicateAttributes(Lexer lexer)(Code)
The same attribute name can't be used more than once in each element. Discard or join attributes according to configuration.
Parameters:
  lexer - Lexer



setType
protected void setType(short newType)(Code)
Setter for node type.
Parameters:
  newType - a valid node type constant



toString
public String toString()(Code)

See Also:   java.lang.Object.toString



trimEmptyElement
public static void trimEmptyElement(Lexer lexer, Node element)(Code)
Trim an empty element.
Parameters:
  lexer - Lexer
Parameters:
  element - empty node to be removed



trimInitialSpace
public static void trimInitialSpace(Lexer lexer, Node element, Node text)(Code)
This maps <p> hello <em> world </em> to <p> hello <em> world </em>. Trims initial space, by moving it before the start tag, or if this element is the first in parent's content, then by discarding the space.
Parameters:
  lexer - Lexer
Parameters:
  element - parent node
Parameters:
  text - text node



trimSpaces
public static void trimSpaces(Lexer lexer, Node element)(Code)
Move initial and trailing space out. This routine maps: hello world to hello world and hello world to hello world .
Parameters:
  lexer - Lexer
Parameters:
  element - Node



trimTrailingSpace
public static void trimTrailingSpace(Lexer lexer, Node element, Node last)(Code)
This maps hello world to hello world . If last child of element is a text node then trim trailing white space character moving it to after element's end tag.
Parameters:
  lexer - Lexer
Parameters:
  element - node
Parameters:
  last - last child of element



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.