Java Doc for Attributes.java in  » HTML-Parser » jericho-html » au » id » jericho » lib » 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 » jericho html » au.id.jericho.lib.html 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   au.id.jericho.lib.html.Segment
      au.id.jericho.lib.html.nodoc.SequentialListSegment
         au.id.jericho.lib.html.Attributes

Attributes
final public class Attributes extends SequentialListSegment (Code)
Represents the list of Attribute objects present within a particular StartTag .

This segment starts at the end of the start tag's and ends at the end of the last attribute.

The attributes in this list are a representation of those found in the source document and are not modifiable. The OutputDocument.replace(AttributesMap) and OutputDocument#replace(Attributes, boolean convertNamesToLowerCase) methods provide the means to add, delete or modify attributes and their values in an OutputDocument .

As of version 2.4, any encountered inside the attributes area of a non-server tag no longer interfere with the parsing of the attributes.

If too many syntax errors are encountered while parsing a start tag's attributes, the parser rejects the entire start tag and generates a entry. The threshold for the number of errors allowed can be set using the Attributes.setDefaultMaxErrorCount(int) static method.

Obtained using the StartTag.getAttributes method, or explicitly using the Source.parseAttributes(int posint maxEnd) method.

It is common for instances of this class to contain no attributes.

See also the XML 1.0 specification for attributes.

Note that before version 2.0 the segment ended just before the tag's instead of at the end of the last attribute.
See Also:   StartTag
See Also:   Attribute





Method Summary
static  voidappendHTML(Writer writer, Map attributesMap)
     Outputs the contents of the specified as HTML attribute name/value pairs to the specified Writer.
 StringBufferappendTidy(StringBuffer sb, Tag nextTag)
    
static  Attributesconstruct(Source source, int startTagBegin, StartTagType startTagType, String tagName)
    
static  Attributesconstruct(Source source, int startTagBegin, int attributesBegin, int maxEnd, StartTagType startTagType, String tagName, int maxErrorCount)
    
static  Attributesconstruct(Source source, int begin, int maxEnd, int maxErrorCount)
    
public static  StringgenerateHTML(Map attributesMap)
     Returns the contents of the specified as HTML attribute name/value pairs.

Each attribute (including the first) is preceded by a single space, and all values are and enclosed in double quotes.

The map keys must be of type String and values must be objects that implement the CharSequence interface.

A null value represents an attribute with no value.
Parameters:
  attributesMap - a map containing attribute name/value pairs.

public  Attributeget(String name)
     Returns the Attribute with the specified name (case insensitive).

If more than one attribute exists with the specified name (which is illegal HTML), the first is returned.
Parameters:
  name - the name of the attribute to get.

public  intgetCount()
     Returns the number of attributes.
public  StringgetDebugInfo()
     Returns a string representation of this object useful for debugging purposes.
public static  intgetDefaultMaxErrorCount()
     Returns the default maximum error count allowed when parsing attributes.
 MapgetMap(boolean convertNamesToLowerCase)
    
 StringgetRawValue(String name)
     Returns the raw (not ) value of the attribute, or null if the attribute .
public  StringgetValue(String name)
     Returns the value of the attribute with the specified name (case insensitive).

Returns null if no attribute with the specified name exists or the attribute .

This is equivalent to Attributes.get(String) get(name) . Attribute.getValue getValue() , except that it returns null if no attribute with the specified name exists instead of throwing a NullPointerException.
Parameters:
  name - the name of the attribute to get.

public  Iteratoriterator()
     Returns an iterator over the Attribute objects in this list in order of appearance.
public  ListIteratorlistIterator(int index)
     Returns a list iterator of the Attribute objects in this list in order of appearance, starting at the specified position in the list.

The specified index indicates the first item that would be returned by an initial call to the next() method. An initial call to the previous() method would return the item with the specified index minus one.

IMPLEMENTATION NOTE: For efficiency reasons this method does not return an immutable list iterator. Calling any of the add(Object), remove() or set(Object) methods on the returned ListIterator does not throw an exception but could result in unexpected behaviour.
Parameters:
  index - the index of the first item to be returned from the list iterator (by a call to the next() method).

public  MappopulateMap(Map attributesMap, boolean convertNamesToLowerCase)
     Populates the specified Map with the name/value pairs from these attributes.

Both names and values are stored as String objects.

The entries are added in order of apprearance in the source document.

An attribute with is represented by a map entry with a null value.

Attribute values are automatically before storage in the map.
Parameters:
  attributesMap - the map to populate, must not be null.
Parameters:
  convertNamesToLowerCase - specifies whether all attribute names are converted to lower case in the map.

public static  voidsetDefaultMaxErrorCount(int value)
     Sets the default maximum error count allowed when parsing attributes.



Method Detail
appendHTML
static void appendHTML(Writer writer, Map attributesMap) throws IOException(Code)
Outputs the contents of the specified as HTML attribute name/value pairs to the specified Writer.

Each attribute is preceded by a single space, and all values are and enclosed in double quotes.
Parameters:
  out - the Writer to which the output is to be sent.
Parameters:
  attributesMap - a map containing attribute name/value pairs.
throws:
  IOException - if an I/O exception occurs.
See Also:   Attributes.populateMap(Map attributesMap,boolean convertNamesToLowerCase)




appendTidy
StringBuffer appendTidy(StringBuffer sb, Tag nextTag)(Code)



construct
static Attributes construct(Source source, int startTagBegin, StartTagType startTagType, String tagName)(Code)
called from StartTagType.parseAttributes(Source, int startTagBegin, String tagName)



construct
static Attributes construct(Source source, int startTagBegin, int attributesBegin, int maxEnd, StartTagType startTagType, String tagName, int maxErrorCount)(Code)
called from StartTag.parseAttributes(int maxErrorCount)



construct
static Attributes construct(Source source, int begin, int maxEnd, int maxErrorCount)(Code)
called from Source.parseAttributes(int pos, int maxEnd, int maxErrorCount)



generateHTML
public static String generateHTML(Map attributesMap)(Code)
Returns the contents of the specified as HTML attribute name/value pairs.

Each attribute (including the first) is preceded by a single space, and all values are and enclosed in double quotes.

The map keys must be of type String and values must be objects that implement the CharSequence interface.

A null value represents an attribute with no value.
Parameters:
  attributesMap - a map containing attribute name/value pairs. the contents of the specified as HTML attribute name/value pairs.
See Also:   StartTag.generateHTML(String tagNameMap attributesMapboolean emptyElementTag)




get
public Attribute get(String name)(Code)
Returns the Attribute with the specified name (case insensitive).

If more than one attribute exists with the specified name (which is illegal HTML), the first is returned.
Parameters:
  name - the name of the attribute to get. the attribute with the specified name, or null if no attribute with the specified name exists.
See Also:   Attributes.getValue(String name)




getCount
public int getCount()(Code)
Returns the number of attributes.

This is equivalent to calling the size() method specified in the List interface. the number of attributes.




getDebugInfo
public String getDebugInfo()(Code)
Returns a string representation of this object useful for debugging purposes. a string representation of this object useful for debugging purposes.



getDefaultMaxErrorCount
public static int getDefaultMaxErrorCount()(Code)
Returns the default maximum error count allowed when parsing attributes.

The system default value is 2.

When searching for start tags, the parser can find the end of the start tag only by the attributes, as it is valid HTML for attribute values to contain '>' characters (see the HTML 4.01 specification section 5.3.2).

If the source text being parsed does not follow the syntax of an attribute list at all, the parser assumes that the text which was originally identified as the beginning of of a start tag is in fact some other text, such as an invalid '<' character in the middle of some text, or part of a script element. In this case the entire start tag is rejected.

On the other hand, it is quite common for attributes to contain minor syntactical errors, such as an invalid character in an attribute name, or a couple of special characters in that otherwise contain only attributes. For this reason the parser allows a certain number of minor errors to occur while parsing an attribute list before the entire start tag or attribute list is rejected. This property indicates the number of minor errors allowed.

Major syntactical errors cause the start tag or attribute list to be rejected immediately, regardless of the maximum error count setting.

Some errors are considered too minor to count at all (ignorable), such as missing whitespace between the end of a quoted attribute value and the start of the next attribute name.

The classification of particular syntax errors in attribute lists into major, minor, and ignorable is not part of the specification and may change in future versions.

Errors are as they occur.

The value of this property is set using the Attributes.setDefaultMaxErrorCount(int) method. the default maximum error count allowed when parsing attributes.
See Also:   Source.parseAttributes(int posint maxEndint maxErrorCount)




getMap
Map getMap(boolean convertNamesToLowerCase)(Code)



getRawValue
String getRawValue(String name)(Code)
Returns the raw (not ) value of the attribute, or null if the attribute .

This is an internal convenience method. the raw (not ) value of the attribute, or null if the attribute .




getValue
public String getValue(String name)(Code)
Returns the value of the attribute with the specified name (case insensitive).

Returns null if no attribute with the specified name exists or the attribute .

This is equivalent to Attributes.get(String) get(name) . Attribute.getValue getValue() , except that it returns null if no attribute with the specified name exists instead of throwing a NullPointerException.
Parameters:
  name - the name of the attribute to get. the value of the attribute with the specified name, or null if the attribute does not exist or .
See Also:   Attribute.getValue




iterator
public Iterator iterator()(Code)
Returns an iterator over the Attribute objects in this list in order of appearance. an iterator over the Attribute objects in this list in order of appearance.



listIterator
public ListIterator listIterator(int index)(Code)
Returns a list iterator of the Attribute objects in this list in order of appearance, starting at the specified position in the list.

The specified index indicates the first item that would be returned by an initial call to the next() method. An initial call to the previous() method would return the item with the specified index minus one.

IMPLEMENTATION NOTE: For efficiency reasons this method does not return an immutable list iterator. Calling any of the add(Object), remove() or set(Object) methods on the returned ListIterator does not throw an exception but could result in unexpected behaviour.
Parameters:
  index - the index of the first item to be returned from the list iterator (by a call to the next() method). a list iterator of the items in this list (in proper sequence), starting at the specified position in the list.
throws:
  IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).




populateMap
public Map populateMap(Map attributesMap, boolean convertNamesToLowerCase)(Code)
Populates the specified Map with the name/value pairs from these attributes.

Both names and values are stored as String objects.

The entries are added in order of apprearance in the source document.

An attribute with is represented by a map entry with a null value.

Attribute values are automatically before storage in the map.
Parameters:
  attributesMap - the map to populate, must not be null.
Parameters:
  convertNamesToLowerCase - specifies whether all attribute names are converted to lower case in the map. the same map specified as the argument to the attributesMap parameter, populated with the name/value pairs from these attributes.
See Also:   Attributes.generateHTML(Map attributesMap)




setDefaultMaxErrorCount
public static void setDefaultMaxErrorCount(int value)(Code)
Sets the default maximum error count allowed when parsing attributes.

See the Attributes.getDefaultMaxErrorCount() method for a full description of this property.
Parameters:
  value - the default maximum error count allowed when parsing attributes.




Methods inherited from au.id.jericho.lib.html.nodoc.SequentialListSegment
public boolean add(Object o)(Code)(Java Doc)
public void add(int index, Object element)(Code)(Java Doc)
public boolean addAll(Collection collection)(Code)(Java Doc)
public boolean addAll(int index, Collection collection)(Code)(Java Doc)
public void clear()(Code)(Java Doc)
public boolean contains(Object o)(Code)(Java Doc)
public boolean containsAll(Collection collection)(Code)(Java Doc)
public Object get(int index)(Code)(Java Doc)
abstract public int getCount()(Code)(Java Doc)
public int indexOf(Object o)(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
public Iterator iterator()(Code)(Java Doc)
public int lastIndexOf(Object o)(Code)(Java Doc)
abstract public ListIterator listIterator(int index)(Code)(Java Doc)
public ListIterator listIterator()(Code)(Java Doc)
public boolean remove(Object o)(Code)(Java Doc)
public Object remove(int index)(Code)(Java Doc)
public boolean removeAll(Collection collection)(Code)(Java Doc)
public boolean retainAll(Collection collection)(Code)(Java Doc)
public Object set(int index, Object element)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public List subList(int fromIndex, int toIndex)(Code)(Java Doc)
public Object[] toArray()(Code)(Java Doc)
public Object[] toArray(Object a)(Code)(Java Doc)

Fields inherited from au.id.jericho.lib.html.Segment
final int begin(Code)(Java Doc)
List childElements(Code)(Java Doc)
final int end(Code)(Java Doc)
final Source source(Code)(Java Doc)

Methods inherited from au.id.jericho.lib.html.Segment
final static StringBuffer appendCollapseWhiteSpace(StringBuffer sb, CharSequence text)(Code)(Java Doc)
final public char charAt(int index)(Code)(Java Doc)
public int compareTo(Object o)(Code)(Java Doc)
final public boolean encloses(Segment segment)(Code)(Java Doc)
final public boolean encloses(int pos)(Code)(Java Doc)
final public boolean equals(Object object)(Code)(Java Doc)
public String extractText()(Code)(Java Doc)
public String extractText(boolean includeAttributes)(Code)(Java Doc)
public List findAllCharacterReferences()(Code)(Java Doc)
public List findAllElements()(Code)(Java Doc)
public List findAllElements(String name)(Code)(Java Doc)
public List findAllElements(StartTagType startTagType)(Code)(Java Doc)
public List findAllElements(String attributeName, String value, boolean valueCaseSensitive)(Code)(Java Doc)
public List findAllStartTags()(Code)(Java Doc)
public List findAllStartTags(String name)(Code)(Java Doc)
public List findAllStartTags(String attributeName, String value, boolean valueCaseSensitive)(Code)(Java Doc)
public List findAllTags()(Code)(Java Doc)
public List findAllTags(TagType tagType)(Code)(Java Doc)
public List findFormControls()(Code)(Java Doc)
public FormFields findFormFields()(Code)(Java Doc)
final public int getBegin()(Code)(Java Doc)
public List getChildElements()(Code)(Java Doc)
public String getDebugInfo()(Code)(Java Doc)
final public int getEnd()(Code)(Java Doc)
public Renderer getRenderer()(Code)(Java Doc)
public TextExtractor getTextExtractor()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public void ignoreWhenParsing()(Code)(Java Doc)
final public boolean isWhiteSpace()(Code)(Java Doc)
final public static boolean isWhiteSpace(char ch)(Code)(Java Doc)
final public int length()(Code)(Java Doc)
public Attributes parseAttributes()(Code)(Java Doc)
final public CharSequence subSequence(int beginIndex, int endIndex)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

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.