|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.fife.ui.rsyntaxtextarea.parser.AbstractParser org.fife.ui.rsyntaxtextarea.parser.XmlParser
public class XmlParser
A parser for XML documents. Adds squiggle underlines for any XML errors found (though most XML parsers don't really have error recovery and so only can find one error at a time).
This class isn't actually used by RSyntaxTextArea anywhere, but you can install and use it yourself. Doing so is as simple as:
XmlParser xmlParser = new XmlParser(); textArea.addParser(xmlParser);To support DTD validation, specify an entity resolver when creating the parser, and enable validation like so:
XmlParser xmlParser = new XmlParser(new MyEntityResolver()); xmlParser.setValidating(true); textArea.addParser(xmlParser);Also note that a single instance of this class can be installed on multiple instances of
RSyntaxTextArea
.
For a more complete XML parsing/validation solution, see the
RSTALanguageSupport
project's XmlLanguageSupport
class.
Constructor Summary | |
---|---|
XmlParser()
|
|
XmlParser(org.xml.sax.EntityResolver resolver)
Constructor allowing DTD validation of documents. |
Method Summary | |
---|---|
boolean |
isValidating()
Returns whether this parser does DTD validation. |
ParseResult |
parse(RSyntaxDocument doc,
java.lang.String style)
Parses input from the specified document. |
void |
setValidating(boolean validating)
Sets whether this parser will use DTD validation if required. |
Methods inherited from class org.fife.ui.rsyntaxtextarea.parser.AbstractParser |
---|
getHyperlinkListener, getImageBase, isEnabled, setEnabled, setHyperlinkListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlParser()
public XmlParser(org.xml.sax.EntityResolver resolver)
resolver
- An entity resolver to use if validation is enabled.setValidating(boolean)
Method Detail |
---|
public boolean isValidating()
setValidating(boolean)
public ParseResult parse(RSyntaxDocument doc, java.lang.String style)
doc
- The document to parse. This document is in a read lock,
so it cannot be modified while parsing is occurring.style
- The language being rendered, such as
SyntaxConstants.SYNTAX_STYLE_JAVA
.
null
.public void setValidating(boolean validating)
validating
- Whether DTD validation should be enabled. If this is
true
, documents must specify a DOCTYPE, and you
should have used the constructor specifying an entity resolver.isValidating()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |