Class MSVExpressionInformation


  • public class MSVExpressionInformation
    extends Object
    Gather information from one MSV expression like:
    • which attributes are mandatory
    • which child elements are singletons
    • can it have text content
    • Constructor Detail

      • MSVExpressionInformation

        public MSVExpressionInformation​(com.sun.msv.grammar.Expression exp,
                                        String schemaFileName)
    • Method Detail

      • getSingletons

        public Set<com.sun.msv.grammar.Expression> getSingletons()
        Returns all singleton child elements
        Returns:
        All child elements which can only occur one time
      • getMultiples

        public Set<com.sun.msv.grammar.Expression> 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

        public boolean isMandatory​(Collection<com.sun.msv.grammar.Expression> equallyNamedChildren)
        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