|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.bbk.dcs.automed.xml.wrappers.XMLDSSFromXMLSchema
public class XMLDSSFromXMLSchema
Parses an XML Schema and creates the corresponding XMLDSS in DOM format.
IMPORTANT: an XML Schema that passes through this algorithm with no exceptions/errors is not to be considered valid!
Features not yet supported:Model groups: all model group declarations are treated as 'all' model group declarations, as this is the way the XMLDSS of a given XML file would be created. This means that the special behaviour of choice group and this of nesting model groups is ignored.
Wildcards: if the XML Schema contains any element or attribute wildcards, it will obviously ignore them, as it will not know what content to create.
Ignored declarations: the following declarations are ignored, as they obviously do not contribute to the XMLDSS content.
Should any unexpected behaviour of the algorithm occur (error/exception/unexpected XMLDSS) please contact the author of the class, specifying the problem and supplying the XML Schema used.
Field Summary | |
---|---|
private static int |
attNum
|
private static java.util.HashMap |
complexTypesDepth
|
private static int |
elemNum
|
private static java.util.HashSet |
ignorableDeclarations
|
protected static java.util.logging.Logger |
logger
|
private static int |
MAX_DEPTH
|
private static java.util.HashMap |
namedAttributeGroups
|
private static java.util.HashMap |
namedAttributes
|
private static java.util.HashMap |
namedElements
|
private static java.util.HashMap |
namedModelGroups
|
private static java.util.HashMap |
namedTypes
|
private static java.lang.String |
prefix
|
private static java.util.List |
primitiveTypes
|
Constructor Summary | |
---|---|
private |
XMLDSSFromXMLSchema()
|
Method Summary | |
---|---|
private static void |
addMixedContent(org.w3c.dom.Document xmldss,
org.w3c.dom.Element xmldssElement)
|
private static org.w3c.dom.Element |
appendChildElement(org.w3c.dom.Document xmldss,
org.w3c.dom.Node parent,
java.lang.String name)
|
private static void |
appendChildText(org.w3c.dom.Document xmldss,
org.w3c.dom.Node xmldssElement)
|
private static org.w3c.dom.Element |
getChildElementByTagName(org.w3c.dom.Node parent,
java.lang.String name)
|
static org.w3c.dom.Document |
getXMLDSSDoc(java.lang.String URI,
java.lang.String schemaName,
java.lang.String xsdRootName)
|
private static void |
preProcessing(org.w3c.dom.Document xsd,
java.lang.String URI,
java.lang.String schemaName,
java.lang.String xsdRootName)
|
private static void |
processComplexContentDeclaration(org.w3c.dom.Document xmldss,
org.w3c.dom.Element complexContentElement,
org.w3c.dom.Element xmldssElement)
|
private static void |
processComplexTypeDeclaration(org.w3c.dom.Document xmldss,
org.w3c.dom.Element xmldssElement,
org.w3c.dom.Element complexType)
|
private static void |
processElementDeclaration(org.w3c.dom.Document xmldss,
org.w3c.dom.Element xsdElement,
org.w3c.dom.Element xmldssElement)
If element does not reference a named type, process its type Else, find the referenced type and process it. |
private static void |
processGroupContentDeclaration(org.w3c.dom.Document xmldss,
org.w3c.dom.Element groupContentElement,
org.w3c.dom.Element xmldssElement)
|
private static void |
processNamedType(org.w3c.dom.Document xmldss,
org.w3c.dom.Element xmldssElement,
java.lang.String typeName)
Depending on the type of an element (primitive, simple, complex), different type processing occurs |
private static void |
processSimpleContentDeclaration(org.w3c.dom.Document xmldss,
org.w3c.dom.Element simpleContentElement,
org.w3c.dom.Element xmldssElement)
Simple content means that the element has only character data content, with no children (may have attributes). |
private static void |
processSimpleTypeDeclaration(org.w3c.dom.Element xmldssElement,
org.w3c.dom.Element simpleType)
|
private static void |
processUnnamedType(org.w3c.dom.Document xmldss,
org.w3c.dom.Element xsdElement,
org.w3c.dom.Element xmldssElement)
|
private static void |
setAttribute(org.w3c.dom.Element xmldssElement,
java.lang.String attName,
java.lang.String attValue)
|
private static void |
showHashMap(java.lang.String s,
java.util.HashMap m)
|
private static org.w3c.dom.Document |
translate(org.w3c.dom.Document xsd,
java.lang.String xsdRootName)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.logging.Logger logger
private static java.util.HashMap namedElements
private static java.util.HashMap namedAttributes
private static java.util.HashMap namedTypes
private static java.util.HashMap namedModelGroups
private static java.util.HashMap namedAttributeGroups
private static java.util.HashSet ignorableDeclarations
private static java.lang.String prefix
private static int MAX_DEPTH
private static java.util.HashMap complexTypesDepth
private static java.util.List primitiveTypes
private static int elemNum
private static int attNum
Constructor Detail |
---|
private XMLDSSFromXMLSchema()
Method Detail |
---|
public static org.w3c.dom.Document getXMLDSSDoc(java.lang.String URI, java.lang.String schemaName, java.lang.String xsdRootName) throws XMLException
XMLException
private static void preProcessing(org.w3c.dom.Document xsd, java.lang.String URI, java.lang.String schemaName, java.lang.String xsdRootName) throws XMLException
XMLException
private static org.w3c.dom.Document translate(org.w3c.dom.Document xsd, java.lang.String xsdRootName) throws XMLException
xsd
- the XML Schema to be translated into XMLDSS
XMLException
private static void processElementDeclaration(org.w3c.dom.Document xmldss, org.w3c.dom.Element xsdElement, org.w3c.dom.Element xmldssElement) throws XMLException
XMLException
private static void processNamedType(org.w3c.dom.Document xmldss, org.w3c.dom.Element xmldssElement, java.lang.String typeName) throws XMLException
xmldssElement
- the element with type typeNametypeName
- the name of the type
XMLException
private static void processUnnamedType(org.w3c.dom.Document xmldss, org.w3c.dom.Element xsdElement, org.w3c.dom.Element xmldssElement) throws XMLException
XMLException
private static void processSimpleTypeDeclaration(org.w3c.dom.Element xmldssElement, org.w3c.dom.Element simpleType)
private static void processComplexTypeDeclaration(org.w3c.dom.Document xmldss, org.w3c.dom.Element xmldssElement, org.w3c.dom.Element complexType) throws XMLException
XMLException
private static void setAttribute(org.w3c.dom.Element xmldssElement, java.lang.String attName, java.lang.String attValue)
private static void processGroupContentDeclaration(org.w3c.dom.Document xmldss, org.w3c.dom.Element groupContentElement, org.w3c.dom.Element xmldssElement) throws XMLException
XMLException
private static void processSimpleContentDeclaration(org.w3c.dom.Document xmldss, org.w3c.dom.Element simpleContentElement, org.w3c.dom.Element xmldssElement) throws XMLException
XMLException
private static void processComplexContentDeclaration(org.w3c.dom.Document xmldss, org.w3c.dom.Element complexContentElement, org.w3c.dom.Element xmldssElement) throws XMLException
XMLException
private static void addMixedContent(org.w3c.dom.Document xmldss, org.w3c.dom.Element xmldssElement)
private static org.w3c.dom.Element getChildElementByTagName(org.w3c.dom.Node parent, java.lang.String name)
private static org.w3c.dom.Element appendChildElement(org.w3c.dom.Document xmldss, org.w3c.dom.Node parent, java.lang.String name)
parent
- the parent node (element or document)name
- the name of the node to be created and appended as a child to argument parent
private static void appendChildText(org.w3c.dom.Document xmldss, org.w3c.dom.Node xmldssElement)
private static void showHashMap(java.lang.String s, java.util.HashMap m)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |