Package org.xmlet.xsdparser.xsdelements
Class XsdAbstractElement
- java.lang.Object
-
- org.xmlet.xsdparser.xsdelements.XsdAbstractElement
-
- Direct Known Subclasses:
XsdAnnotationChildren,XsdIdentifierElements
public abstract class XsdAbstractElement extends java.lang.ObjectThis class serves as a base to every element class, i.e.XsdElement,XsdAttribute, etc.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringABSTRACT_TAGstatic java.lang.StringATTRIBUTE_FORM_DEFAULTprotected java.util.Map<java.lang.String,java.lang.String>attributesMapAMapobject containing the keys/values of the attributes that belong to the concrete element instance.static java.lang.StringBASE_TAGstatic java.lang.StringBLOCK_DEFAULTstatic java.lang.StringBLOCK_TAG(package private) XsdAbstractElementcloneOfIndicates the source from this object was cloned, if applicable.static java.lang.StringDEFAULT_ELEMENT_TAGstatic java.lang.StringDEFAULT_TAGstatic java.lang.StringELEMENT_FORM_DEFAULTstatic java.lang.StringFINAL_DEFAULTstatic java.lang.StringFINAL_TAGstatic java.lang.StringFIXED_TAGstatic java.lang.StringFORM_TAGstatic java.lang.StringID_TAGstatic java.lang.StringITEM_TYPE_TAGstatic java.lang.StringMAX_OCCURS_TAGstatic java.lang.StringMEMBER_TYPES_TAGstatic java.lang.StringMIN_OCCURS_TAGstatic java.lang.StringMIXED_TAGstatic java.lang.StringNAME_TAGstatic java.lang.StringNAMESPACEstatic java.lang.StringNILLABLE_TAG(package private) XsdAbstractElementparentThe instance which contains the present element.booleanparentAvailableIndicates if this element has the Parent available.(package private) XsdParserCoreparserTheXsdParserCoreinstance that parsed this element.static java.lang.StringREF_TAGstatic java.lang.StringSCHEMA_LOCATIONstatic java.lang.StringSOURCE_TAGstatic java.lang.StringSUBSTITUTION_GROUP_TAGstatic java.lang.StringTARGET_NAMESPACEstatic java.lang.StringTYPE_TAGstatic java.lang.StringUSE_TAGprotected static java.lang.StringVALUE_TAGstatic java.lang.StringVERSION(package private) XsdAbstractElementVisitorvisitorThe visitor instance for this element.protected java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor>visitorFunctionstatic java.lang.StringXML_LANG_TAGstatic java.lang.StringXMLNS
-
Constructor Summary
Constructors Modifier Constructor Description protectedXsdAbstractElement(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 xsdAbstractElementVisitor)Base method for all accept methods.XsdAbstractElementclone(java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes)Performs a copy of the current object for replacing purposes.XsdAbstractElementclone(java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes, XsdAbstractElement parent)Performs a copy of the current object for replacing purposes.(package private) static booleancompareReference(NamedConcreteElement element, java.lang.String unsolvedRef)static booleancompareReference(NamedConcreteElement element, UnsolvedReference reference)protected static java.util.Map<java.lang.String,java.lang.String>convertNodeMap(org.w3c.dom.NamedNodeMap nodeMap)Converts aNamedNodeMapto aMapobject.java.util.Map<java.lang.String,java.lang.String>getAttributesMap()XsdAbstractElementgetCloneOf()java.util.List<ReferenceBase>getElements()XsdAbstractElementgetParent()XsdAbstractElementgetParent(boolean enforceParentAvailability)XsdParserCoregetParser()XsdAbstractElementVisitorgetVisitor()Obtains the visitor of a concreteXsdAbstractElementinstance.java.util.stream.Stream<XsdAbstractElement>getXsdElements()XsdSchemagetXsdSchema()static XsdSchemagetXsdSchema(XsdAbstractElement element, java.util.List<XsdAbstractElement> hierarchy)voidreplaceUnsolvedElements(NamedConcreteElement element)This method iterates on the current element children and replaces anyUnsolvedReferenceobject that has a ref attribute that matches the receivingNamedConcreteElementname attribute.voidsetCloneOf(XsdAbstractElement cloneOf)Sets source of the clone of the currentXsdAbstractElementobject.voidsetParent(XsdAbstractElement parent)voidsetParentAvailable(boolean parentAvailable)voidvalidateSchemaRules()Runs verifications on each concrete element to ensure that the XSD schema rules are verified.static ReferenceBasexsdParseSkeleton(org.w3c.dom.Node node, XsdAbstractElement element)The base code for parsing anyXsdAbstractElement.(package private) static java.lang.StringxsdRawContentParse(org.w3c.dom.Node node)In special cases such asXsdAppInfoandXsdDocumentationthe contents are a simple text node, in which case this function is more suited than using thexsdParseSkeleton(org.w3c.dom.Node, org.xmlet.xsdparser.xsdelements.XsdAbstractElement)since those types of elements can't have children nodes.
-
-
-
Field Detail
-
attributesMap
protected java.util.Map<java.lang.String,java.lang.String> attributesMap
AMapobject containing the keys/values of the attributes that belong to the concrete element instance.
-
ATTRIBUTE_FORM_DEFAULT
public static final java.lang.String ATTRIBUTE_FORM_DEFAULT
- See Also:
- Constant Field Values
-
ELEMENT_FORM_DEFAULT
public static final java.lang.String ELEMENT_FORM_DEFAULT
- See Also:
- Constant Field Values
-
BLOCK_DEFAULT
public static final java.lang.String BLOCK_DEFAULT
- See Also:
- Constant Field Values
-
FINAL_DEFAULT
public static final java.lang.String FINAL_DEFAULT
- See Also:
- Constant Field Values
-
TARGET_NAMESPACE
public static final java.lang.String TARGET_NAMESPACE
- See Also:
- Constant Field Values
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
XMLNS
public static final java.lang.String XMLNS
- See Also:
- Constant Field Values
-
ID_TAG
public static final java.lang.String ID_TAG
- See Also:
- Constant Field Values
-
NAME_TAG
public static final java.lang.String NAME_TAG
- See Also:
- Constant Field Values
-
ABSTRACT_TAG
public static final java.lang.String ABSTRACT_TAG
- See Also:
- Constant Field Values
-
DEFAULT_ELEMENT_TAG
public static final java.lang.String DEFAULT_ELEMENT_TAG
- See Also:
- Constant Field Values
-
FIXED_TAG
public static final java.lang.String FIXED_TAG
- See Also:
- Constant Field Values
-
TYPE_TAG
public static final java.lang.String TYPE_TAG
- See Also:
- Constant Field Values
-
MIXED_TAG
public static final java.lang.String MIXED_TAG
- See Also:
- Constant Field Values
-
BLOCK_TAG
public static final java.lang.String BLOCK_TAG
- See Also:
- Constant Field Values
-
FINAL_TAG
public static final java.lang.String FINAL_TAG
- See Also:
- Constant Field Values
-
USE_TAG
public static final java.lang.String USE_TAG
- See Also:
- Constant Field Values
-
SUBSTITUTION_GROUP_TAG
public static final java.lang.String SUBSTITUTION_GROUP_TAG
- See Also:
- Constant Field Values
-
DEFAULT_TAG
public static final java.lang.String DEFAULT_TAG
- See Also:
- Constant Field Values
-
FORM_TAG
public static final java.lang.String FORM_TAG
- See Also:
- Constant Field Values
-
NILLABLE_TAG
public static final java.lang.String NILLABLE_TAG
- See Also:
- Constant Field Values
-
MIN_OCCURS_TAG
public static final java.lang.String MIN_OCCURS_TAG
- See Also:
- Constant Field Values
-
MAX_OCCURS_TAG
public static final java.lang.String MAX_OCCURS_TAG
- See Also:
- Constant Field Values
-
ITEM_TYPE_TAG
public static final java.lang.String ITEM_TYPE_TAG
- See Also:
- Constant Field Values
-
BASE_TAG
public static final java.lang.String BASE_TAG
- See Also:
- Constant Field Values
-
SOURCE_TAG
public static final java.lang.String SOURCE_TAG
- See Also:
- Constant Field Values
-
XML_LANG_TAG
public static final java.lang.String XML_LANG_TAG
- See Also:
- Constant Field Values
-
MEMBER_TYPES_TAG
public static final java.lang.String MEMBER_TYPES_TAG
- See Also:
- Constant Field Values
-
SCHEMA_LOCATION
public static final java.lang.String SCHEMA_LOCATION
- See Also:
- Constant Field Values
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
REF_TAG
public static final java.lang.String REF_TAG
- See Also:
- Constant Field Values
-
VALUE_TAG
protected static final java.lang.String VALUE_TAG
- See Also:
- Constant Field Values
-
parent
XsdAbstractElement parent
The instance which contains the present element.
-
parser
XsdParserCore parser
TheXsdParserCoreinstance that parsed this element.
-
visitor
XsdAbstractElementVisitor visitor
The visitor instance for this element.
-
cloneOf
XsdAbstractElement cloneOf
Indicates the source from this object was cloned, if applicable.
-
parentAvailable
public boolean parentAvailable
Indicates if this element has the Parent available. This was created as a way of indicating that the parent of the current element isn't present to avoid circular memory dependencies.
-
visitorFunction
protected final java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction
-
-
Constructor Detail
-
XsdAbstractElement
protected XsdAbstractElement(@NotNull XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> attributesMap, java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
-
Method Detail
-
getAttributesMap
public java.util.Map<java.lang.String,java.lang.String> getAttributesMap()
-
getVisitor
public XsdAbstractElementVisitor getVisitor()
Obtains the visitor of a concreteXsdAbstractElementinstance.- Returns:
- The concrete visitor instance.
-
validateSchemaRules
public void validateSchemaRules()
Runs verifications on each concrete element to ensure that the XSD schema rules are verified.
-
accept
public void accept(XsdAbstractElementVisitor xsdAbstractElementVisitor)
Base method for all accept methods. It serves as a way to guarantee that every accept call assigns the parent field.- Parameters:
xsdAbstractElementVisitor- The visitor that is visiting the current instance.
-
getElements
public java.util.List<ReferenceBase> getElements()
-
clone
public XsdAbstractElement 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.- Parameters:
placeHolderAttributes- The additional attributes to add to the clone.- Returns:
- A copy of the object from which is called upon.
-
clone
public XsdAbstractElement clone(@NotNull java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes, XsdAbstractElement parent)
Performs a copy of the current object for replacing purposes. The cloned objects are used to replaceUnsolvedReferenceobjects in the reference solving process.- Parameters:
placeHolderAttributes- The additional attributes to add to the clone.- Returns:
- A copy of the object from which is called upon.
-
getXsdElements
public java.util.stream.Stream<XsdAbstractElement> getXsdElements()
- Returns:
- All the
ConcreteElementobjects present in the concrete implementation of theXsdAbstractElementclass. It doesn't return theUnsolvedReferenceobjects.
-
getXsdSchema
public XsdSchema getXsdSchema()
-
getXsdSchema
public static XsdSchema getXsdSchema(XsdAbstractElement element, java.util.List<XsdAbstractElement> hierarchy)
-
xsdParseSkeleton
public static ReferenceBase xsdParseSkeleton(org.w3c.dom.Node node, XsdAbstractElement element)
The base code for parsing anyXsdAbstractElement. All the concrete implementations of this class should call this method in order to parse its children.- Parameters:
node- The node from where the element will be parsed.element- The concrete element that will be populated and returned.- Returns:
- A wrapper object that contains the parsed XSD object.
-
getParser
public XsdParserCore getParser()
-
convertNodeMap
protected static java.util.Map<java.lang.String,java.lang.String> convertNodeMap(org.w3c.dom.NamedNodeMap nodeMap)
Converts aNamedNodeMapto aMapobject. This is meant to simplify the manipulation of the information.- Parameters:
nodeMap- TheNamedNodeMapto convert to aMapobject.- Returns:
- The
Mapobject that was generated by the conversion.
-
replaceUnsolvedElements
public void replaceUnsolvedElements(NamedConcreteElement element)
This method iterates on the current element children and replaces anyUnsolvedReferenceobject that has a ref attribute that matches the receivingNamedConcreteElementname attribute.- Parameters:
element- A fully parsed element with a name that will replace anUnsolvedReferenceobject, if a match between theNamedConcreteElementname attribute and theUnsolvedReferenceref attribute.
-
compareReference
public static boolean compareReference(NamedConcreteElement element, UnsolvedReference reference)
-
compareReference
static boolean compareReference(NamedConcreteElement element, java.lang.String unsolvedRef)
-
getParent
public XsdAbstractElement getParent()
- Returns:
- The parent of the current
XsdAbstractElementobject.
-
getParent
public XsdAbstractElement getParent(boolean enforceParentAvailability)
- Returns:
- The parent of the current
XsdAbstractElementobject.
-
getCloneOf
public XsdAbstractElement getCloneOf()
- Returns:
- The source of the clone of the current
XsdAbstractElementobject.
-
setCloneOf
public void setCloneOf(XsdAbstractElement cloneOf)
Sets source of the clone of the currentXsdAbstractElementobject.
-
setParent
public void setParent(XsdAbstractElement parent)
-
setParentAvailable
public void setParentAvailable(boolean parentAvailable)
-
xsdRawContentParse
static java.lang.String xsdRawContentParse(org.w3c.dom.Node node)
In special cases such asXsdAppInfoandXsdDocumentationthe contents are a simple text node, in which case this function is more suited than using thexsdParseSkeleton(org.w3c.dom.Node, org.xmlet.xsdparser.xsdelements.XsdAbstractElement)since those types of elements can't have children nodes.- Parameters:
node- TheNodecontaining either aXsdAppInfoorXsdDocumentation.- Returns:
- The textual value contained in the
Nodeparameter.
-
-