public class DTDParser
extends java.lang.Object
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....
Modifier and Type | Method and Description |
---|---|
static DocType |
parse(java.lang.String input,
JDOMFactory factory)
Parse out a DOCTYPE declaration as supplied by the standard StAX
readers.
|
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.Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.