Package org.xmlet.xsdparser.xsdelements
Class XsdAttribute
- java.lang.Object
-
public class XsdAttribute extends XsdNamedElements
A class representing the xsd:attribute element. It can have a ref attribute and therefore extends fromXsdNamedElements, which serves as a base to every element type that can have a ref attribute. For more information checkXsdNamedElements.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringdefaultElementA default value for the currentXsdAttributeinstance.private java.lang.StringfixedSpecifies a fixed value for the currentXsdAttributeinstance.private FormEnumformSpecifies if the currentXsdAttributeattribute is "qualified" or "unqualified".private ReferenceBasesimpleTypeAXsdSimpleTypeinstance wrapped in aReferenceBaseobject which indicate any restrictions that may be present in the currentXsdAttributeinstance.static java.lang.StringTAGprivate java.lang.StringtypeSpecifies either a built-in data type for the currentXsdAttributeinstance or serves as a reference to aXsdSimpleTypeinstance.private UsageEnumuseSpecifies how thisXsdAttributeshould be used.static java.lang.StringXS_TAGstatic java.lang.StringXSD_TAG-
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 Modifier Constructor Description privateXsdAttribute(XsdParserCore parser, java.util.Map<java.lang.String,java.lang.String> attributesMap, java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)privateXsdAttribute(XsdAbstractElement parent, XsdParserCore parser, java.util.Map<java.lang.String,java.lang.String> attributesMap, 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.XsdAttributeclone(java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes)Performs a copy of the current object for replacing purposes.java.util.List<XsdRestriction>getAllRestrictions()java.lang.StringgetFixed()java.lang.StringgetForm()private static java.lang.StringgetFormDefaultValue(XsdAbstractElement parent)java.lang.StringgetType()java.lang.StringgetUse()XsdSimpleTypegetXsdSimpleType()static ReferenceBaseparse(ParseData parseData)voidreplaceUnsolvedElements(NamedConcreteElement elementWrapper)Receives aNamedConcreteElementthat should be the one requested earlierprivate voidrule2()Asserts if the current object has the fixed and default attributes at the same time, which isn't allowed, throwing an exception in that case.private voidrule3()Asserts if the current object has a ref attribute at the same time as either a simpleType as children, a form attribute or a type attribute.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
-
simpleType
private ReferenceBase simpleType
AXsdSimpleTypeinstance wrapped in aReferenceBaseobject which indicate any restrictions that may be present in the currentXsdAttributeinstance.
-
defaultElement
private java.lang.String defaultElement
A default value for the currentXsdAttributeinstance. This value andfixedshouldn't be present at the same time.
-
fixed
private java.lang.String fixed
Specifies a fixed value for the currentXsdAttributeinstance. This value anddefaultElementshouldn't be present at the same time.
-
type
private java.lang.String type
Specifies either a built-in data type for the currentXsdAttributeinstance or serves as a reference to aXsdSimpleTypeinstance. In the case of being used as a reference to aXsdSimpleTypeinstance its value is used to create anUnsolvedReferenceusing its value as ref to be resolved later in the parsing process.
-
form
private FormEnum form
Specifies if the currentXsdAttributeattribute is "qualified" or "unqualified".
-
use
private UsageEnum use
Specifies how thisXsdAttributeshould be used. The possible values are: required, prohibited, optional.
-
-
Constructor Detail
-
XsdAttribute
private XsdAttribute(@NotNull XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> attributesMap, @NotNull java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
XsdAttribute
private XsdAttribute(XsdAbstractElement parent, @NotNull XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> attributesMap, @NotNull java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
-
Method Detail
-
getFormDefaultValue
private static java.lang.String getFormDefaultValue(XsdAbstractElement parent)
-
validateSchemaRules
public void validateSchemaRules()
Runs verifications on each concrete element to ensure that the XSD schema rules are verified.- Overrides:
validateSchemaRulesin classXsdNamedElements
-
rule3
private void rule3()
Asserts if the current object has a ref attribute at the same time as either a simpleType as children, a form attribute or a type attribute. Throws an exception in that case.
-
rule2
private void rule2()
Asserts if the current object has the fixed and default attributes at the same time, 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 XsdAttribute 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 elementWrapper)
Receives aNamedConcreteElementthat should be the one requested earlier. * In theXsdAttributeconstructor: this.simpleType = new UnsolvedReference(type, placeHolder); XsdParser.getInstance().addUnsolvedReference((UnsolvedReference) this.simpleType); This implies that the object being received is the object that is being referred with thetypeString.- Overrides:
replaceUnsolvedElementsin classXsdAbstractElement- Parameters:
elementWrapper- The object that should be wrapping the requestedXsdSimpleTypeobject.
-
setSimpleType
public void setSimpleType(ReferenceBase simpleType)
-
getXsdSimpleType
public XsdSimpleType getXsdSimpleType()
-
getType
public java.lang.String getType()
-
getUse
public java.lang.String getUse()
-
getForm
public java.lang.String getForm()
-
getFixed
public java.lang.String getFixed()
-
getAllRestrictions
public java.util.List<XsdRestriction> getAllRestrictions()
-
parse
public static ReferenceBase parse(@NotNull ParseData parseData)
-
-