|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdom2.input.stax.DTDParser
public class DTDParser
Parses out key information from a single String representing a DOCTYPE declaration. StAX parsers supply a single string representing the DOCTYPE and this needs to be processed to get items like the SystemID, etc. Additionally it needs to be reformatted to create a standardised representation.
The assumption is that the DTD is valid.
We need to pull out 4 elements of data:
We can do this all with a well-structured regular expression, which is actually simpler than trying to fish out all the components ourselves....
Method Summary | |
---|---|
static DocType |
parse(java.lang.String input,
JDOMFactory factory)
Parse out a DOCTYPE declaration as supplied by the standard StAX readers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static DocType parse(java.lang.String input, JDOMFactory factory) throws JDOMException
Using 'XML' terminology, this method assumes that the input is both 'well-formed' and 'valid'. The assumptions that this class makes ensure that the 'right thing' is done for valid content, but invalid content may or may not fail with a JDOMException. The behaviour of this method with invalid input is 'undefined'.
input
- the input DOCTYPE string to parse. Must be valid.factory
- The JDOM factory to use to build the JDOM DocType.
JDOMException
- if the DocType is not generated.
|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |