Java Doc for SGMLTag.java in  » Swing-Library » wings3 » org » wings » template » 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 » Swing Library » wings3 » org.wings.template.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.wings.template.parser.SGMLTag

SGMLTag
public class SGMLTag (Code)
Convenient class for parsing SGML tokens from a page.

This class is optimized for speed, not ease of use. (Though I'd contend its fairly easy to use anyway!).

Other than earlier versions of this class this one reads its content from a Reader to avoid reading the whole file into a String before parsing it. The Reader is required to support the mark() operation.

Tags are only read enough to find out what the tag name is; If you want to read the full tag call parse(inputReader). This is done so that applications don't spend time processing tags about which they care little.

Here's a sample piece of code which uses this class to read all SGML tags on a page:

 void showTags(PrintWriter out, Reader input)
 {
 SGMLTag tag = new SGMLTag(input);
 while (!tag.finished()) {
 out.println ("tag: " + tag.toString());
 tag = new SGMLTag (input);
 }
 }
 

author:
   Tim Williams
author:
   Henner Zeller


Field Summary
final static  StringCOMMENT_STARTCOMMENT_END
    
final static  StringSSI_STARTSSI_END
    
final public static  chardoubleQuote
    
final public static  charsingleQuote
    

Constructor Summary
public  SGMLTag(Reader input, boolean parseIt)
     Create new SGML tag reference, starting at current location of the Reader. At first, only the type of tag (first argument) is read if parseIt is false. Tag may not be well-formed: if interested, call "parse(input)" directly afterwards (without reading any characters from the Reader) to get the attributes.

Note that this constructor skips over any HTML-style comments, as denoted by matched <-- ...

public  SGMLTag(Reader input)
     Create new SGML tag reference, starting at current location of the Reader.

Method Summary
public  Iteratorattributes(boolean upperCase)
     Get list of attribute names.
public  booleanfinished()
     Checked whether this tag indicates we're at the end of the list.
public  StringgetAttribute(String key, String defaultValue)
     Return value of attribute (parameter) setting in SGML tag.
public  HashMapgetAttributes()
     Return tag attributes and values.
public  StringgetName()
     get the Name of this SGML tag, in uppercase format.
public  intgetOffset()
    
public  booleanisNamed(String name)
     Check name of tag.
public  booleanisWellFormed()
     Check for well-formedness of this tag.
public  StringnextToken(Reader input)
     Read next token from string.
public  StringnextToken(Reader input, boolean skipWhitespaces)
     Read next token from string.
public  voidparse(Reader input)
    
protected  voidsearchStart(Reader input)
     Skip over any HTML-style comments, as denoted by matched <-- ...
public static  intskipWhiteSpace(Reader r)
    
public  StringtoString()
     Render this tag as a string.
public  Stringvalue(String attributeName, String defaultValue)
     Get attribute value, or default if not set. Case is ignored, value("a") will return the same result as value("A").

Field Detail
COMMENT_STARTCOMMENT_END
final static String COMMENT_STARTCOMMENT_END(Code)



SSI_STARTSSI_END
final static String SSI_STARTSSI_END(Code)



doubleQuote
final public static char doubleQuote(Code)



singleQuote
final public static char singleQuote(Code)




Constructor Detail
SGMLTag
public SGMLTag(Reader input, boolean parseIt) throws IOException(Code)
Create new SGML tag reference, starting at current location of the Reader. At first, only the type of tag (first argument) is read if parseIt is false. Tag may not be well-formed: if interested, call "parse(input)" directly afterwards (without reading any characters from the Reader) to get the attributes.

Note that this constructor skips over any HTML-style comments, as denoted by matched <-- ... --> pairs.
Parameters:
  input - the Reader being parsed for SGML tags
Parameters:
  parseIt - boolean which denotes if SGMLTag should beparsed fully
See Also:   SGMLTag.attributes




SGMLTag
public SGMLTag(Reader input) throws IOException(Code)
Create new SGML tag reference, starting at current location of the Reader. Read all attributes.

Note that this constructor skips over any HTML-style comments, as denoted by matched <-- ... --> pairs.
Parameters:
  input - the Reader being parsed for SGML tags
See Also:   SGMLTag.attributes





Method Detail
attributes
public Iterator attributes(boolean upperCase)(Code)
Get list of attribute names.
Parameters:
  upperCase - true returns names in all uppercase (good forcase-insensitive applications), false returns attribute nameswith same case as in original text enumeration of attribute names specified as strings,or null if this tag is poorly formed



finished
public boolean finished()(Code)
Checked whether this tag indicates we're at the end of the list. Note: The end tag is not usuable as an SGML tag. true if this tag represents end of tags, and is not usuable



getAttribute
public String getAttribute(String key, String defaultValue)(Code)
Return value of attribute (parameter) setting in SGML tag.
Parameters:
  key - name (uppercase) of attribute for which to check
Parameters:
  defaultValue - value if attribute unset
See Also:   SGMLTag.attributes
See Also:   SGMLTag.value value of that attribute, or default if not defined



getAttributes
public HashMap getAttributes()(Code)
Return tag attributes and values. parameter key / value pairs
See Also:   SGMLTag.attributes
See Also:   SGMLTag.value



getName
public String getName()(Code)
get the Name of this SGML tag, in uppercase format. For example, P for paragraph, B for bold, etc. This value is set to null when whitespace or another problem was encountered where the tag would be.



getOffset
public int getOffset()(Code)
returns the number of chars skipped before the starting '<'



isNamed
public boolean isNamed(String name)(Code)
Check name of tag. (Comparision is case-insensitive.) true if passed tag matches this one.



isWellFormed
public boolean isWellFormed()(Code)
Check for well-formedness of this tag. Note that calling this method causes rest of tag to be parsed. true if tag is a well-formed SGML tag, false otherwise



nextToken
public String nextToken(Reader input) throws IOException(Code)
Read next token from string. A token is a space-delimited word, a string in quotes (returned with quotes), a delimiter such as a greater-than, less-than, or equals sign. Quotes marks inside quoted strings may be escaped with a backslash (\) character. next token, or null if whitespace was encountered



nextToken
public String nextToken(Reader input, boolean skipWhitespaces) throws IOException(Code)
Read next token from string. A token is a space-delimited word, a string in quotes (returned with quotes), a delimiter such as a greater-than, less-than, or equals sign. Quotes marks inside quoted strings may be escaped with a backslash (\) character. next token, or null if whitespace was encountered



parse
public void parse(Reader input) throws IOException(Code)



searchStart
protected void searchStart(Reader input) throws IOException(Code)
Skip over any HTML-style comments, as denoted by matched <-- ... --> pairs.
Parameters:
  input - the reader being parsed for SGMLtags



skipWhiteSpace
public static int skipWhiteSpace(Reader r) throws IOException(Code)
could be overwritten



toString
public String toString()(Code)
Render this tag as a string. SGML tag as string, showing range and values



value
public String value(String attributeName, String defaultValue)(Code)
Get attribute value, or default if not set. Case is ignored, value("a") will return the same result as value("A"). Note also that if wish to check whether value was set, you can pass null as the defaultValue.
Parameters:
  attributeName - attribute for which to check
Parameters:
  defaultValue - value if attribute unset value of attribute, or defaultValue if not available



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.