|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.xtreemos.xosd.factory.utils.parsers.XMLValidatorAndParser
public class XMLValidatorAndParser
Validates the XML document against the XSD schema using org.w3c.dom packages. Parses the XML document and puts the data into a mixed ArrayList and Hashtable structure. Hashtables (key/value) pairs correspond to the (XML tag/XML value) pairs.
Where multiple values are assigned to the same key (defined in XSD as sequence) and ArrayList is put to the Hashtable value.
Where the value of the key is a complex type, the key is of type of Hashtable.
The output is used in XMLSearchEngine
XMLSearchEngine
Field Summary | |
---|---|
(package private) static org.apache.log4j.Logger |
logger
|
Constructor Summary | |
---|---|
XMLValidatorAndParser()
Default constructor for XMLValidatorAndParser. |
Method Summary | |
---|---|
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
loadSchema(java.io.InputStream xmlSchemaStream,
java.lang.String xsdSchemaFile)
The method that performs the actual parsing and validating of the XML document accessable via an input stream. |
java.util.Hashtable<java.lang.String,java.lang.Object> |
loadSchema(java.lang.String xmlString)
Validates the XML document against the XSD schema using org.w3c.dom packages. |
java.util.Hashtable<java.lang.String,java.lang.Object> |
loadSchema(java.lang.String xmlSchemaFile,
java.lang.String xsdSchemaFile)
Validates the XML document in a file against the XSD schema using org.w3c.dom packages. |
java.util.Hashtable<java.lang.String,java.lang.Object> |
loadSchemaFromElement(org.w3c.dom.Document xmlDocument,
java.lang.String xsdSchemaFile)
Validates the XML document against the XSD schema using org.w3c.dom packages. |
java.util.Hashtable<java.lang.String,java.lang.Object> |
loadSchemaFromString(java.lang.String xmlSchema,
java.lang.String xsdSchemaFile)
Validates the XML document in a string against the XSD schema using org.w3c.dom packages. |
private void |
loadXML(org.w3c.dom.Node element,
java.util.Hashtable<java.lang.String,java.lang.Object> inHash)
Parses the XML document and puts the data into a mixed ArrayList and Hashtable structure. |
static void |
main(java.lang.String[] args)
main method - used just for testing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static org.apache.log4j.Logger logger
Constructor Detail |
---|
public XMLValidatorAndParser()
Method Detail |
---|
private void loadXML(org.w3c.dom.Node element, java.util.Hashtable<java.lang.String,java.lang.Object> inHash) throws java.lang.Exception
Where multiple values are assigned to the same key (defined in XSD as sequence) and ArrayList is put to the Hashtable value.
Where the value of the key is a complex type, the key is of type of Hashtable.
Where element is a leaf node with attributes, attributes and value of the node are added into Hashtable, key of the node is named with keyword "value". If "value" is already name of some attribute, string formed with concatenation of the node's name and "Value". If key name cannot be specified, exception is thrown. User should be aware how to access to nodes value.
If node is leave without attributes, simply value is assigned to the key (named by node's name).
element
- the root element of the XML treeinHash
- the Hashtable for this subtree
java.lang.Exception
loadSchema(String, String)
protected java.util.Hashtable<java.lang.String,java.lang.Object> loadSchema(java.io.InputStream xmlSchemaStream, java.lang.String xsdSchemaFile) throws java.io.IOException, org.xml.sax.SAXException
xmlSchemaStream
- The stream containing the XML document contents.xsdSchemaFile
- The full path to the file containing the XML schema
in an XSD document.
java.io.IOException
org.xml.sax.SAXException
XMLSearchEngine
public java.util.Hashtable<java.lang.String,java.lang.Object> loadSchema(java.lang.String xmlSchemaFile, java.lang.String xsdSchemaFile) throws java.io.IOException, org.xml.sax.SAXException
Where multiple values are assigned to the same key (defined in XSD as sequence) and ArrayList is put to the Hashtable value.
Where the value of the key is a complex type, the key is of type of Hashtable.
xmlSchemaFile
- The full path to the XML documentxsdSchemaFile
- The full path to the XSD document; if null, no validation is performed
java.io.IOException
org.xml.sax.SAXException
XMLSearchEngine
public java.util.Hashtable<java.lang.String,java.lang.Object> loadSchemaFromString(java.lang.String xmlSchema, java.lang.String xsdSchemaFile) throws java.io.IOException, org.xml.sax.SAXException
Where multiple values are assigned to the same key (defined in XSD as sequence) and ArrayList is put to the Hashtable value.
Where the value of the key is a complex type, the key is of type of Hashtable.
xmlSchema
- The contents of the XML documentxsdSchemaFile
- The full path to the XSD document; if null, no validation is performed
java.io.IOException
org.xml.sax.SAXException
XMLSearchEngine
public java.util.Hashtable<java.lang.String,java.lang.Object> loadSchemaFromElement(org.w3c.dom.Document xmlDocument, java.lang.String xsdSchemaFile) throws java.io.IOException, org.xml.sax.SAXException
Where multiple values are assigned to the same key (defined in XSD as sequence) and ArrayList is put to the Hashtable value.
Where the value of the key is a complex type, the key is of type of Hashtable.
xmlDocument
- XML document element (received & transformed by ResourceQuery)xsdSchemaFile
- The full path to the XSD document; if null, no validation is performed
java.io.IOException
org.xml.sax.SAXException
XMLSearchEngine
public java.util.Hashtable<java.lang.String,java.lang.Object> loadSchema(java.lang.String xmlString) throws java.io.IOException, org.xml.sax.SAXException
Where multiple values are assigned to the same key (defined in XSD as sequence) and ArrayList is put to the Hashtable value.
Where the value of the key is a complex type, the key is of type of Hashtable.
xmlString
- String containing XML
java.io.IOException
org.xml.sax.SAXException
XMLSearchEngine
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |