Package org.xmlet.xsdparser.xsdelements
Class XsdElement
- java.lang.Object
-
public class XsdElement extends XsdNamedElements
A class representing the xsd:element element. ExtendsXsdNamedElementsbecause it's one of theXsdAbstractElementconcrete classes that can have aXsdNamedElements.nameattribute.- See Also:
- xsd:element description and usage at w3c
-
-
Field Summary
Fields Modifier and Type Field Description private booleanabstractObjSpecifies whether the element can be used in an instance document.private BlockEnumblockPrevents an element with a specified type of derivation from being used in place of thisXsdElementelement.private ReferenceBasecomplexTypeTheXsdComplexTypeinstance wrapped in aReferenceBaseobject.private java.lang.StringdefaultObjSpecifies a default value for the element.private FinalEnumfinalObjPrevents other elements to derive depending on its value.private java.lang.StringfixedSpecifies a fixed value for the element.private FormEnumformSpecifies if the currentXsdElementattribute is "qualified" or "unqualified".private java.lang.StringmaxOccursSpecifies the maximum number of times this element can occur in the parent element.private java.lang.IntegerminOccursSpecifies the minimum number of times this element can occur in the parent element.private booleannillableSpecifies if the thisXsdElementsupport a null value.private ReferenceBasesimpleTypeTheXsdSimpleTypeinstance wrapped in aReferenceBaseobject.private ReferenceBasesubstitutionGroupSpecifies the name of an element that can be substituted with this element.static java.lang.StringTAGprivate ReferenceBasetypeThe type of the current element.static java.lang.StringXS_TAGstatic java.lang.StringXSD_TAGprivate static java.lang.StringxsdElementIsXsdSchema-
Fields inherited from class org.xmlet.xsdparser.xsdelements.XsdNamedElements
name
-
Fields inherited from class org.xmlet.xsdparser.xsdelements.XsdAbstractElement
ABSTRACT_TAG, ATTRIBUTE_FORM_DEFAULT, attributesMap, BASE_TAG, BLOCK_DEFAULT, BLOCK_TAG, cloneOf, DEFAULT_ELEMENT_TAG, DEFAULT_TAG, ELEMENT_FORM_DEFAULT, FINAL_DEFAULT, FINAL_TAG, FIXED_TAG, FORM_TAG, ID_TAG, ITEM_TYPE_TAG, MAX_OCCURS_TAG, MEMBER_TYPES_TAG, MIN_OCCURS_TAG, MIXED_TAG, NAME_TAG, NAMESPACE, NILLABLE_TAG, parent, parentAvailable, parser, REF_TAG, SCHEMA_LOCATION, SOURCE_TAG, SUBSTITUTION_GROUP_TAG, TARGET_NAMESPACE, TYPE_TAG, USE_TAG, VALUE_TAG, VERSION, visitor, visitorFunction, XML_LANG_TAG, XMLNS
-
-
Constructor Summary
Constructors Constructor Description XsdElement(XsdParserCore parser, java.util.Map<java.lang.String,java.lang.String> attributesMap, java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)XsdElement(XsdAbstractElement parent, XsdParserCore parser, java.util.Map<java.lang.String,java.lang.String> elementFieldsMapParam, java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(XsdAbstractElementVisitor visitorParam)Base method for all accept methods.XsdElementclone(java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes)Performs a copy of the current object for replacing purposes.java.lang.StringgetBlock()java.lang.StringgetFinal()java.lang.StringgetForm()java.lang.StringgetMaxOccurs()java.lang.IntegergetMinOccurs()ReferenceBasegetSubstitutionGroup()java.lang.StringgetType()XsdBuiltInDataTypegetTypeAsBuiltInDataType()XsdComplexTypegetTypeAsComplexType()XsdSimpleTypegetTypeAsSimpleType()XsdNamedElementsgetTypeAsXsd()XsdComplexTypegetXsdComplexType()private XsdComplexTypegetXsdComplexTypeFromType()XsdSimpleTypegetXsdSimpleType()private XsdSimpleTypegetXsdSimpleTypeFromType()XsdElementgetXsdSubstitutionGroup()booleanisAbstractObj()booleanisNillable()static ReferenceBaseparse(ParseData parseData)voidreplaceUnsolvedElements(NamedConcreteElement element)This method aims to replace the previously createdUnsolvedReferencein case that the type of the currentXsdElementinstance is not a built-in type.private voidrule2()Asserts if the current object is a direct child of the top level XsdSchema element and doesn't have a name, which isn't allowed, throwing an exception in that case.private voidrule3()Asserts if the current object has a ref attribute while being a direct child of the top level XsdSchema element, which isn't allowed, throwing an exception in that case.private voidrule4()Asserts if the current object isn't a direct child of the top level XsdSchema and has a value for the substitutionGroup, which isn't allowed, throwing an exception in that case.private voidrule5()private voidrule6()private voidrule7()Asserts if the current object has a form attribute while being a direct child of the top level XsdSchema element, which isn't allowed, throwing an exception in that case.voidsetComplexType(ReferenceBase complexType)voidsetSimpleType(ReferenceBase simpleType)voidvalidateSchemaRules()Runs verifications on each concrete element to ensure that the XSD schema rules are verified.-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdNamedElements
getName, getRawName, setName
-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdAnnotatedElements
getAnnotation, setAnnotation
-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdIdentifierElements
getId
-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdAbstractElement
clone, compareReference, compareReference, convertNodeMap, getAttributesMap, getCloneOf, getElements, getParent, getParent, getParser, getVisitor, getXsdElements, getXsdSchema, getXsdSchema, setCloneOf, setParent, setParentAvailable, xsdParseSkeleton, xsdRawContentParse
-
-
-
-
Field Detail
-
XSD_TAG
public static final java.lang.String XSD_TAG
- See Also:
- Constant Field Values
-
XS_TAG
public static final java.lang.String XS_TAG
- See Also:
- Constant Field Values
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
complexType
private ReferenceBase complexType
TheXsdComplexTypeinstance wrapped in aReferenceBaseobject.
-
simpleType
private ReferenceBase simpleType
TheXsdSimpleTypeinstance wrapped in aReferenceBaseobject.
-
type
private ReferenceBase type
The type of the current element. Either specified a built in data type or is a reference to a existentXsdComplexTypeor aXsdSimpleTypeinstances.
-
substitutionGroup
private ReferenceBase substitutionGroup
Specifies the name of an element that can be substituted with this element. Only should be present if thisXsdElementis a top level element, i.e. his parent is a XsdSchema element.
-
defaultObj
private java.lang.String defaultObj
Specifies a default value for the element. It's only available if the type contents are text only type defined by a simpleType.
-
fixed
private java.lang.String fixed
Specifies a fixed value for the element. It's only available if the type contents are text only type defined by a simpleType.
-
form
private FormEnum form
Specifies if the currentXsdElementattribute is "qualified" or "unqualified".
-
nillable
private boolean nillable
Specifies if the thisXsdElementsupport a null value.
-
abstractObj
private boolean abstractObj
Specifies whether the element can be used in an instance document.
-
block
private BlockEnum block
Prevents an element with a specified type of derivation from being used in place of thisXsdElementelement. Possible values are: extension - prevents elements derived by extension; restriction - prevents elements derived by restriction; substitution - prevents elements derived by substitution; #all - all of the above.
-
finalObj
private FinalEnum finalObj
Prevents other elements to derive depending on its value. This attribute cannot be present unless thisXsdElementis a top level element, i.e. his parent is a XsdSchema element. extension - prevents elements derived by extension; restriction - prevents elements derived by restriction; #all - all of the above.
-
minOccurs
private java.lang.Integer minOccurs
Specifies the minimum number of times this element can occur in the parent element. The value can be any number bigger or equal to 0. Default value is 1. This attribute cannot be used if the parent element is the XsdSchema element.
-
maxOccurs
private java.lang.String maxOccurs
Specifies the maximum number of times this element can occur in the parent element. The value can be any number bigger or equal to 0, or if you want to set no limit on the maximum number, use the value "unbounded". Default value is 1. This attribute cannot be used if the parent element is the XsdSchema element.
-
xsdElementIsXsdSchema
private static java.lang.String xsdElementIsXsdSchema
-
-
Constructor Detail
-
XsdElement
public XsdElement(@NotNull XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> attributesMap, @NotNull java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
XsdElement
public XsdElement(XsdAbstractElement parent, @NotNull XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> elementFieldsMapParam, @NotNull java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
-
Method Detail
-
validateSchemaRules
public void validateSchemaRules()
Runs verifications on each concrete element to ensure that the XSD schema rules are verified.- Overrides:
validateSchemaRulesin classXsdNamedElements
-
rule7
private void rule7()
Asserts if the current object has a form attribute while being a direct child of the top level XsdSchema element, which isn't allowed, throwing an exception in that case.
-
rule6
private void rule6()
-
rule5
private void rule5()
-
rule4
private void rule4()
Asserts if the current object isn't a direct child of the top level XsdSchema and has a value for the substitutionGroup, which isn't allowed, throwing an exception in that case.
-
rule3
private void rule3()
Asserts if the current object has a ref attribute while being a direct child of the top level XsdSchema element, which isn't allowed, throwing an exception in that case.
-
rule2
private void rule2()
Asserts if the current object is a direct child of the top level XsdSchema element and doesn't have a name, which isn't allowed, throwing an exception in that case.
-
accept
public void accept(XsdAbstractElementVisitor visitorParam)
Description copied from class:XsdAbstractElementBase method for all accept methods. It serves as a way to guarantee that every accept call assigns the parent field.- Overrides:
acceptin classXsdAbstractElement- Parameters:
visitorParam- The visitor that is visiting the current instance.
-
clone
public XsdElement clone(@NotNull java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes)
Performs a copy of the current object for replacing purposes. The cloned objects are used to replaceUnsolvedReferenceobjects in the reference solving process.- Overrides:
clonein classXsdAbstractElement- Parameters:
placeHolderAttributes- The additional attributes to add to the clone.- Returns:
- A copy of the object from which is called upon.
-
replaceUnsolvedElements
public void replaceUnsolvedElements(NamedConcreteElement element)
This method aims to replace the previously createdUnsolvedReferencein case that the type of the currentXsdElementinstance is not a built-in type.- Overrides:
replaceUnsolvedElementsin classXsdAbstractElement- Parameters:
element- A concrete element with a name that will replace theUnsolvedReferenceobject created in theXsdElementconstructor. TheUnsolvedReferenceis only replaced if there is a match between theUnsolvedReference.refand theNamedConcreteElement.name.
-
getXsdComplexType
public XsdComplexType getXsdComplexType()
-
getXsdSimpleType
public XsdSimpleType getXsdSimpleType()
-
getXsdComplexTypeFromType
private XsdComplexType getXsdComplexTypeFromType()
-
getXsdSimpleTypeFromType
private XsdSimpleType getXsdSimpleTypeFromType()
-
getTypeAsXsd
public XsdNamedElements getTypeAsXsd()
-
getTypeAsComplexType
public XsdComplexType getTypeAsComplexType()
-
getTypeAsSimpleType
public XsdSimpleType getTypeAsSimpleType()
-
getTypeAsBuiltInDataType
public XsdBuiltInDataType getTypeAsBuiltInDataType()
-
parse
public static ReferenceBase parse(@NotNull ParseData parseData)
-
getFinal
public java.lang.String getFinal()
-
isNillable
public boolean isNillable()
-
getMinOccurs
public java.lang.Integer getMinOccurs()
-
getMaxOccurs
public java.lang.String getMaxOccurs()
-
isAbstractObj
public boolean isAbstractObj()
-
setComplexType
public void setComplexType(ReferenceBase complexType)
-
setSimpleType
public void setSimpleType(ReferenceBase simpleType)
-
getBlock
public java.lang.String getBlock()
-
getForm
public java.lang.String getForm()
-
getType
public java.lang.String getType()
-
getSubstitutionGroup
public ReferenceBase getSubstitutionGroup()
-
getXsdSubstitutionGroup
public XsdElement getXsdSubstitutionGroup()
-
-