jInfer

cz.cuni.mff.ksi.jinfer.xsdimportsax.utils
Class SAXDocumentElement

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.xsdimportsax.utils.SAXDocumentElement

public class SAXDocumentElement
extends Object

Wrapper class for tags read by SAX parser.


Constructor Summary
SAXDocumentElement(String QName)
          Constructs a new instance with empty attribute list.
 
Method Summary
 void associate()
          Couples the current instance with a "named complex type".
 RegexpInterval determineInterval()
          Create an interval using attributes minOccurs and maxOccurs of current instance.
 RegexpType determineRegexpType()
          Match tag of current instance to a RegexpType.
 String getAttributeValue(XSDAttribute attribute)
          Gets the value of specified attribute.
 Map<String,SAXAttributeData> getAttrs()
          Returns the whole attribute list for this tag.
 String getName()
          Returns case sensitive name without namespace prefix.
 String getNameOrRefValue()
          Returns value of name attribute or ref attribute if any of them can be used.
 XSDTag getTag()
          Returns tag matching the name.
 boolean hasAttribute(XSDAttribute attribute)
          Checks if current instance has a non empty attribute specified by the parameter.
 boolean isAssociated()
          Checks if current instance was paired with its parent's container.
 boolean isComplexType()
          Checks if instance is wrapping a complexType tag.
 boolean isOrderIndicator()
          Check if tag of current instance is one of choice, sequence, all.
 boolean isSchema()
          Checks if instance is wrapping a schema tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXDocumentElement

public SAXDocumentElement(String QName)
Constructs a new instance with empty attribute list. QName is trimmed of its namespace prefix.

Parameters:
QName - Name of the schema element, should be set in lowercase.
Method Detail

getAttrs

public Map<String,SAXAttributeData> getAttrs()
Returns the whole attribute list for this tag.

Returns:
Attribute list of this tag.

getName

public String getName()
Returns case sensitive name without namespace prefix.

Returns:
Name of this instance.

getTag

public XSDTag getTag()
Returns tag matching the name.

Returns:
Valid tag or INVALID

hasAttribute

public boolean hasAttribute(XSDAttribute attribute)
Checks if current instance has a non empty attribute specified by the parameter.

Returns:
true if there is an attribute with the specified name defined and it is not empty, false otherwise.

getAttributeValue

public String getAttributeValue(XSDAttribute attribute)
Gets the value of specified attribute.

Returns:
Value of specified attribute or empty string if attribute value is absent.

getNameOrRefValue

public String getNameOrRefValue()
Returns value of name attribute or ref attribute if any of them can be used.

Returns:
Value of either attribute or empty string if neither value is present.

associate

public void associate()
               throws XSDException
Couples the current instance with a "named complex type". This means that current instance is a direct successor of the complexType tag and it should not create its own container for sub-nodes, but pass all sub-nodes to its parent.

Throws:
XSDException - When current instance is not an order indicator.

isAssociated

public boolean isAssociated()
Checks if current instance was paired with its parent's container.

Returns:
true if associate method was called previously, false otherwise.

isComplexType

public boolean isComplexType()
Checks if instance is wrapping a complexType tag.

Returns:
true if current tag is complexType.

isSchema

public boolean isSchema()
Checks if instance is wrapping a schema tag.

Returns:
true if current tag is schema.

isOrderIndicator

public boolean isOrderIndicator()
Check if tag of current instance is one of choice, sequence, all.

Returns:
true if it is, false otherwise.

determineRegexpType

public RegexpType determineRegexpType()
Match tag of current instance to a RegexpType.

Returns:
RegexpType.ALTERNATION, RegexpType.CONCATENATION, RegexpType.PERMUTATION or null if instance is not an order indicator.

determineInterval

public RegexpInterval determineInterval()
Create an interval using attributes minOccurs and maxOccurs of current instance.

Returns:
Valid or default interval.
See Also:
XSDOccurences.createInterval(java.lang.String, java.lang.String)

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011