|
jInfer | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.mff.ksi.jinfer.xsdimportdom.DOMHelper
public final class DOMHelper
Helper class for DOMHandler
, provides convenience methods used during parsing.
It is best NOT to use these methods outside this package.
Please read package info.
Method Summary | |
---|---|
static Element |
createSentinel(Element domElem,
List<String> context,
XSDAttribute useAsName)
Create an Element with type RegexpType.LAMBDA with proper constraints
and metadata containing sentinel info. |
static RegexpInterval |
determineInterval(Element node)
Create valid interval from current node. |
static String |
errorWrongNested(XSDTag child,
XSDTag parent)
Helper method for retrieving error message when tags are not nested correctly. |
static void |
extractSubnodesFromContainer(Element subtree,
Element destination,
String containerType)
Extract subnodes and attributes from subtree stored in container and put them directly under the destination element. |
static void |
finalizeElement(Element ret,
List<String> newContext)
Check if Element is properly defined; redefine it to lambda when it was empty,
or redefine it to token if it only contained a simple data type. |
static Map<String,Object> |
getAttributeMetadata(Element child)
Prepare metadata of attribute tag from the child node. |
static String |
getAttributeName(Element child)
Extract value of name or ref from an attribute tag. |
static Element |
getDOMElement(Node node)
Determine if given node is in fact a DOM.Element and return a type cast if so. |
static String |
warnUnsupported(XSDTag child,
XSDTag parent)
Helper method for retrieving warning message when unsupported structure occurs in schema. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Element getDOMElement(Node node)
node
is in fact a DOM.Element
and return a type cast if so.
node
- Entity to be checked.
DOM.Element
, or null
.Element
public static RegexpInterval determineInterval(Element node)
node
has attributes minOccurs or maxOccurs, their values are used.
Otherwise a default interval is returned (RegexpInterval.getOnce()
).
node
- Node from which the information is extracted.
XSDOccurences.createInterval(java.lang.String, java.lang.String)
public static String errorWrongNested(XSDTag child, XSDTag parent)
child
- Tag of the child node.parent
- Tag of the parent node.
public static String warnUnsupported(XSDTag child, XSDTag parent)
child
- Tag of the child node.parent
- Tag of the parent node.
public static Element createSentinel(Element domElem, List<String> context, XSDAttribute useAsName) throws XSDException
Element
with type RegexpType.LAMBDA
with proper constraints
and metadata containing sentinel info.
This kind of element is used when it was defined previously and it is unnecessary to
build a rule subtree for it again (it is either a reference, or a leaf in recursion).
domElem
- Node in the DOM tree from which the sentinel is made.context
- Context of the node in the rule tree.useAsName
- Name of the attribute to be used as a name of the new Element
.
XSDException
- Raise exception when schema contains errors.IGGUtils.METADATA_SENTINEL
public static void extractSubnodesFromContainer(Element subtree, Element destination, String containerType) throws XSDException
subtree
- Container element, from which the subnodes will be extracted.destination
- Destination element, where the subnodes are copied to.containerType
- Expected name of the subtree element, this is just a consistency check.
XSDException
- Raise exception when schema contains errors.public static void finalizeElement(Element ret, List<String> newContext)
Element
is properly defined; redefine it to lambda when it was empty,
or redefine it to token if it only contained a simple data type.
This method should be used only when the tag of a node was ELEMENT!
ret
- Element to be finalized.public static String getAttributeName(Element child)
child
- Node containing the attribute tag.
public static Map<String,Object> getAttributeMetadata(Element child)
child
- DOM node of the attribute tag.
|
jInfer | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |