|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.content.parsers.LinkParser
public class LinkParser
Parses wiki links in the format defined in Link
.
Link
Constructor Summary | |
---|---|
LinkParser()
|
Method Summary | |
---|---|
Link |
parse(String contentToParse)
Parse the raw content representing a Wiki link (as typed by the user) and transfer it into a structured form as a Link Object. |
protected void |
parseAlias(StringBuffer content,
Link link)
Find out the alias part of the full link. |
protected String |
parseElementAfterString(StringBuffer content,
String separator)
Find out the element located to the right of the passed separator. |
protected String |
parseElementBeforeString(StringBuffer content,
String separator)
Find out the element located to the left of the passed separator. |
protected void |
parseTarget(StringBuffer content,
Link link)
Find out the target part of the full link. |
protected URI |
parseURI(StringBuffer content)
Find out the URI part of the full link. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LinkParser()
Method Detail |
---|
public Link parse(String contentToParse) throws ContentParserException
Link
Object.
contentToParse
- the raw content to parse. This is the link content without the
square brackets.
Link
object containing the parsed data
ContentParserException
- in case of an error while parsing, like a malformed
element for exampleprotected void parseAlias(StringBuffer content, Link link)
Note: As it's possible to specify a target we need a way to differentiate the following 2 links:
content
- the string to parse. This parameter will be modified by the method to remove
the parsed content.link
- the link on which to set the alias and the delimiter symbol usedprotected void parseTarget(StringBuffer content, Link link) throws ContentParserException
Note: The target element must start with an underscore ("_"). See
parseAlias(StringBuffer, Link)
for more details as to why.
content
- the string to parse. This parameter will be modified by the method to remove
the parsed content.link
- the link on which to set the target and the delimiter symbol used
ContentParserException
- if the target does not start with an underscoreprotected URI parseURI(StringBuffer content) throws ContentParserException
content
- the string to parse. This parameter will be modified by the method to remove
the parsed content.
ContentParserException
- if the URI is malformedprotected String parseElementBeforeString(StringBuffer content, String separator)
content
- the string to parse. This parameter will be modified by the method to remove
the parsed content.separator
- the separator string to locate the element
protected String parseElementAfterString(StringBuffer content, String separator)
content
- the string to parse. This parameter will be modified by the method to remove
the parsed content.separator
- the separator string to locate the element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |