|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.utilities.xml.DocumentNamespaceHelper
public class DocumentNamespaceHelper
This Class uses SAX and SAXNamespaceExtractorHandler to extract namespace(s) from XML using the folowing methods:
| Field Summary | |
|---|---|
protected boolean |
debugFlag
The debugFlag for this Object. |
protected static org.apache.commons.logging.Log |
log
The logging implementation for this class. |
protected boolean |
parseWholeDocument
If parseWholeDocument is true, DocumentNamespaceHelper will parse the whole document. |
protected SAXNamespaceExtractorHandler |
saxNamespaceExtractorHandler
SAX handler that extracts all namespaces from a XML document. |
protected java.lang.String |
thisClassName
The full name of this class. |
| Constructor Summary | |
|---|---|
DocumentNamespaceHelper()
Creates a new instance of DocumentNamespaceHelper. |
|
| Method Summary | |
|---|---|
Namespace[] |
getDeclaredNamespaces(java.lang.String xmlText)
Get the namespace declartions for the XML as an array of org.osesb.utilities.xml.Namespace(s). |
java.lang.String |
getDefaultNamespaceURI(java.lang.String xmlText)
Get the default namespace URI for the XML; that is, the namespace that is given by a root element 'xmlns' attribute with no prefix. |
java.lang.String |
getDocumentNamespaceURI(java.lang.String xmlText)
Get the namespace for a XML document according to the following ordered lookup: The default namespace, which is the namespace given by a root element 'xmlns' attribute with no prefix. The target namespace, which is the value of the 'targetNamespace' root attribute. The namespace portion of the value of a 'schemaLocation' root attribute. |
Namespace[] |
getNamespaces(java.lang.String xmlText)
Get all namespaces associated with the XML as an array of org.osesb.utilities.xml.Namespace(s), including: 'xmlns' declarations. A 'targetNamespace' declaration. The namespace portion of a 'schemaLocation' declaration. |
boolean |
getParseWholeDocument()
Get parseWholeDocument property. |
java.lang.String |
getSchemaLocationNamespaceURI(java.lang.String xmlText)
Get the namespace portion of the value of a 'schemaLocation' root attribute. |
java.lang.String |
getTargetNamespaceURI(java.lang.String xmlText)
Get the targtetNamespace URI for the XML; that is, the namespace that is the value of the 'targetNamespace' root attribute. |
static void |
main(java.lang.String[] args)
Main method for testing and sandboxing. |
void |
setDebugFlag(boolean debugFlag)
Set the debugFlag for this object. |
void |
setParseWholeDocument(boolean parseWholeDocument)
Set parseWholeDocument property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected java.lang.String thisClassName
protected SAXNamespaceExtractorHandler saxNamespaceExtractorHandler
protected boolean parseWholeDocument
protected boolean debugFlag
| Constructor Detail |
|---|
public DocumentNamespaceHelper()
| Method Detail |
|---|
public Namespace[] getNamespaces(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the namespaces from.
java.lang.Exception - if invoked with a null xmlText or
if there is a problem parsing the XML.
public Namespace[] getDeclaredNamespaces(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the namespaces from.
java.lang.Exception - if invoked with a null xmlText or
if there is a problem parsing the XML.
public java.lang.String getTargetNamespaceURI(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the namespace from.
java.lang.Exception - if invoked with a null xmlText or
if there is a problem parsing the XML.
public java.lang.String getDefaultNamespaceURI(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the namespace from.
java.lang.Exception - if invoked with a null xmlText or
if there is a problem parsing the XML.
public java.lang.String getSchemaLocationNamespaceURI(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the namespace from.
java.lang.Exception - if invoked with a null xmlText or
if there is a problem parsing the XML.
public java.lang.String getDocumentNamespaceURI(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the namespace from.
java.lang.Exception - if invoked with a null xmlText or
if there is a problem parsing the XML.public boolean getParseWholeDocument()
public void setParseWholeDocument(boolean parseWholeDocument)
parseWholeDocument - property.public void setDebugFlag(boolean debugFlag)
debugFlag - If true, debug messages are logged.public static void main(java.lang.String[] args)
args - The test data directory.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||