Package schema2template.grammar
Class MSVExpressionInformation
java.lang.Object
schema2template.grammar.MSVExpressionInformation
Gather information from one MSV expression like:
- which attributes are mandatory
- which child elements are singletons
- can it have text content
-
Constructor Summary
ConstructorDescriptionMSVExpressionInformation
(com.sun.msv.grammar.Expression exp, String schemaFileName) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Can the MSV expression have text content?Set<com.sun.msv.grammar.Expression>
Returns all child elements which are no singletonsgetPathsContaining
(com.sun.msv.grammar.Expression exp) Gets all paths leading from this.getExpression() to exp (but not necessarily ending in exp).Set<com.sun.msv.grammar.Expression>
Returns all singleton child elementsboolean
isMandatory
(Collection<com.sun.msv.grammar.Expression> equallyNamedChildren) Determines whether an Element or Attribute child is mandatory.
-
Constructor Details
-
MSVExpressionInformation
-
-
Method Details
-
getSingletons
Returns all singleton child elements- Returns:
- All child elements which can only occur one time
-
getMultiples
Returns all child elements which are no singletons- Returns:
- All child elements which can only occur one time
-
getPathsContaining
public List<List<com.sun.msv.grammar.Expression>> getPathsContaining(com.sun.msv.grammar.Expression exp) Gets all paths leading from this.getExpression() to exp (but not necessarily ending in exp). A path always starts with this.getExpression() and ends in someChildDefinition.getExpression().- Parameters:
exp
- The MSV Expression. If you use this.getExpression() you get all paths starting from this.getExpression(). If you use someChildDefinition.getExpression() you get all paths from this.getExpression() to the Expression of the Child Definition.- Returns:
- A List of paths containing exp or null if there are no such paths
-
canHaveText
public boolean canHaveText()Can the MSV expression have text content?- Returns:
- true if the node defined by this can have text content
-
isMandatory
Determines whether an Element or Attribute child is mandatory.If there are multiples of child (other equally named expressions) providing only one of those Expressions will determine whether exactly this expression is mandatory. In most cases this will return false, and in most cases this is not what you want to know. Therefore, you can provide a Collection of (equally named) child expressions.
- Returns:
- whether child is mandatory
-