public class XMLRootDetector extends Object
Modifier and Type | Field and Description |
---|---|
static short |
INVALID
The type for invalid result.
|
static short |
INVALID_INPUT
The type for invalid input result for the last invocation.
|
static short |
NO_INPUT
The type for no input result for the last invocation.
|
static short |
RESULT_OK
The type for correct result for the last invocation.
|
Constructor and Description |
---|
XMLRootDetector() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkRootName(File file,
String rootName)
Return true if the name of the root element of an XML file is the specified name.
|
boolean |
checkRootName(Reader reader,
String rootName)
Return true if the name of the root element of a Reader parsed as an XML file is the specified name.
|
boolean |
checkRootName(URL url,
QName rootName)
Return true if the qualified name of the root element of an XML URL is the specified qualified name.
|
boolean |
checkRootName(URL url,
String rootName)
Return true if the name of the root element of an XML URL is the specified name.
|
boolean |
checkRootQualifiedName(File file,
QName rootName)
Return true if the qualified name of the root element of an XML file is the specified qualified name.
|
boolean |
checkRootQualifiedName(Reader reader,
QName rootName)
Return true if the qualified name of the root element of a Reader parsed as an XML file is the specified qualified name.
|
short |
getLastResultType()
Return the type of the last detection result.
|
QName |
getQualifiedRootName(File file)
Return the qualified name of the root element of an XML File.
|
QName |
getQualifiedRootName(File file,
boolean acceptNotWellFormed)
Return the qualified name of the root element of an XML File.
|
QName |
getQualifiedRootName(Reader reader)
Return the qualified name of the root element of a Reader parsed as an XML file.
|
QName |
getQualifiedRootName(URL url)
Return the qualified name of the root element of an XML URL.
|
QName |
getQualifiedRootName(URL url,
boolean acceptNotWellFormed)
Return the qualified name of the root element of an XML URL.
|
XMLNode |
getRoot(File file)
Return the root element of an XML File.
|
XMLNode |
getRoot(File file,
boolean acceptNotWellFormed)
Return the root element of an XML File.
|
XMLNode |
getRoot(Reader reader)
Return the root element of a Reader parsed as an XML file.
|
XMLNode |
getRoot(URL url)
Return the root element of an XML URL.
|
XMLNode |
getRoot(URL url,
boolean acceptNotWellFormed)
Return the root element of an XML URL.
|
String |
getRootName(File file)
Return the name of the root element of an XML File.
|
String |
getRootName(File file,
boolean acceptNotWellFormed)
Return the name of the root element of an XML File.
|
String |
getRootName(Reader reader)
Return the name of the root element of a Reader parsed as an XML file.
|
String |
getRootName(URL url)
Return the name of the root element of an XML URL.
|
String |
getRootName(URL url,
boolean acceptNotWellFormed)
Return the name of the root element of an XML URL.
|
public static final short INVALID
public static final short RESULT_OK
public static final short NO_INPUT
public static final short INVALID_INPUT
public short getLastResultType()
INVALID
: invalid result. It will only have this type before the first invocation.RESULT_OK
: correct resultINVALID_INPUT
: invalid input (the input file is an invalid XML file)NO_INPUT
: no input (the input file does not exist)public boolean checkRootName(File file, String rootName)
file
- the filerootName
- the specified name of the root element to checkpublic boolean checkRootQualifiedName(File file, QName rootName)
file
- the filerootName
- the specified qualified name of the root element to checkpublic boolean checkRootName(Reader reader, String rootName)
reader
- the ReaderrootName
- the specified name of the root element to checkpublic boolean checkRootQualifiedName(Reader reader, QName rootName)
reader
- the ReaderrootName
- the specified qualified name of the root element to checkpublic boolean checkRootName(URL url, String rootName)
url
- the URLrootName
- the specified name of the root element to checkpublic boolean checkRootName(URL url, QName rootName)
url
- the URLrootName
- the specified qualified name of the root element to checkpublic XMLNode getRoot(Reader reader)
reader
- the Readerpublic XMLNode getRoot(URL url)
url
- the URLpublic XMLNode getRoot(URL url, boolean acceptNotWellFormed)
url
- the URLacceptNotWellFormed
- true if not well-formed XML files are acceptedpublic XMLNode getRoot(File file)
file
- the filepublic XMLNode getRoot(File file, boolean acceptNotWellFormed)
file
- the fileacceptNotWellFormed
- true if not well-formed XML files are acceptedpublic String getRootName(URL url)
url
- the URLpublic String getRootName(URL url, boolean acceptNotWellFormed)
url
- the URLacceptNotWellFormed
- true if not well-formed XML files are acceptedpublic String getRootName(Reader reader)
reader
- the Readerpublic String getRootName(File file)
file
- the filepublic String getRootName(File file, boolean acceptNotWellFormed)
file
- the filacceptNotWellFormed
- true if not well-formed XML files are acceptedpublic QName getQualifiedRootName(URL url)
url
- the URLpublic QName getQualifiedRootName(URL url, boolean acceptNotWellFormed)
url
- the URLacceptNotWellFormed
- true if not well-formed XML files are acceptedpublic QName getQualifiedRootName(Reader reader)
reader
- the Readerpublic QName getQualifiedRootName(File file)
file
- the filepublic QName getQualifiedRootName(File file, boolean acceptNotWellFormed)
file
- the fileacceptNotWellFormed
- true if not well-formed XML files are accepted