Java Doc for LinkParser.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » 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 » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.parser.LinkParser

LinkParser
public class LinkParser (Code)
Parses JSPWiki-style "augmented" link markup into a Link object containing the link text, link reference, and any optional link attributes (as JDOM Attributes).

The parser recognizes three link forms:

  1. [Text]
  2. [Text | Link]
  3. [Text | Link | attributes]

where the attributes are space-delimited, each in the form of

 name1='value1' name2='value2' name3='value3' (etc.) 

If the attribute parsing fails, the parser will still return the basic link, writing a warning to the log.

Permitted Attributes

Attributes that aren't declared on <a> or those that permit scripting in HTML (as this is a security risk) are ignored and have no effect on parsing, nor show up in the resulting attribute list). The 'href' and 'name' attributes are also ignored as spurious. The permitted list is: 'accesskey', 'charset', 'class', 'hreflang', 'id', 'lang', 'dir', 'rel', 'rev', 'style' , 'tabindex', 'target' , 'title', and 'type'. The declared attributes that will be ignored are: 'href', 'name', 'shape', 'coords', 'onfocus', 'onblur', or any of the other 'on*' event attributes.

The permitted attributes and target attribute values are static String arrays ( LinkParser.PERMITTED_ATTRIBUTES and LinkParser.PERMITTED_TARGET_VALUES resp.) that could be compile-time modified (i.e., predeclared).

Permitted Values on Target Attribute

The following target names are reserved in HTML 4 and have special meanings. These are the only values permitted by the parser.

_blank
The user agent should load the designated document in a new, unnamed window.
_self
The user agent should load the document in the same frame as the element that refers to this target.
_parent
The user agent should load the document into the immediate FRAMESET parent of the current frame. This value is equivalent to _self if the current frame has no parent.
_top
The user agent should load the document into the full, original window (thus canceling all other frames). This value is equivalent to _self if the current frame has no parent.

Returned Value

This returns a Link object, a public inner class with methods:

  • getText() returns the link text.
  • getReference() returns the link reference value.
  • attributeCount() returns the number of declared attributes.
  • getAttributes() returns an iterator over any validated XHTML-compliant attributes, returned as JDOM Attributes.

The attributeCount() method can be used to circumvent calling getAttributes(), which will create an empty Iterator rather than return a null.

Example: Link Form 1

From an incoming wikitext link of:

 [Acme] 
returns:
 getText():         "Acme"
 getReference():    "Acme"
 attributeCount():  0
 getAttributes():   an empty Iterator 

Example: Link Form 2

From an incoming wikitext link of:

 [Acme | http://www.acme.com/] 
returns:
 getText():         "Acme"
 getReference():    "http://www.acme.com/"
 attributeCount():  0
 getAttributes():   an empty Iterator 

Example: Link Form 3

From an incoming wikitext link of:

 [Acme | http://www.acme.com/ | id='foo' rel='Next'] 
returns:
 getText():         "Acme"
 getReference():    "http://www.acme.com/"
 attributeCount():  2
 getAttributes():   an Iterator containing:
 JDOM Attribute:  id="foo"
 JDOM Attribute:  rel="Next" 

author:
   Murray Altheim
since:
   2.5.10

Inner Class :public static class Link



Method Summary
final public static  booleanisSpace(String s)
     Returns true if the String s is completely composed of whitespace.
final public static  booleanisSpace(char c)
     Returns true if char c is a member of S (space) [XML 1.1 production 3].
Parameters:
  c - Character to check.
public  Linkparse(String linktext)
     Processes incoming link text, separating out the link text, the link URI, and then any specified attributes.



Method Detail
isSpace
final public static boolean isSpace(String s)(Code)
Returns true if the String s is completely composed of whitespace.
Parameters:
  s - The string to check True, if "s" is all XML whitespace.



isSpace
final public static boolean isSpace(char c)(Code)
Returns true if char c is a member of S (space) [XML 1.1 production 3].
Parameters:
  c - Character to check. True, if the character is an XML space.



parse
public Link parse(String linktext) throws ParseException(Code)
Processes incoming link text, separating out the link text, the link URI, and then any specified attributes.
Parameters:
  linktext - the wiki link text to be parsed a Link object containing the link text, reference, and any valid Attributes
throws:
  ParseException - if the parameter is null



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.