Class XSDUtils
- java.lang.Object
-
- org.eclipse.lemminx.extensions.xsd.utils.XSDUtils
-
public class XSDUtils extends Object
XSD utilities.- Author:
- Angelo ZERR
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXSDUtils.BindingTypeBinding type of xs attribute.
-
Field Summary
Fields Modifier and Type Field Description static StringNAMESPACE_ATTRstatic StringSCHEMA_LOCATION_ATTRstatic StringTARGET_NAMESPACE_ATTRstatic StringXS_IMPORT_TAGstatic StringXS_SCHEMA_TAG
-
Constructor Summary
Constructors Constructor Description XSDUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilesChangedTrackercreateFilesChangedTracker(Set<org.apache.xerces.impl.xs.SchemaGrammar> grammars)static FilesChangedTrackercreateFilesChangedTracker(org.apache.xerces.impl.xs.SchemaGrammar grammar)static DOMAttrfindSchemaLocationAttrByURI(DOMDocument document, String grammarURI)Returns the xsd:import/@schemaLocation or xsd:include/@schemaLocation declared in the givendocumentby the givengrammarURIand null otherwise.static XSDUtils.BindingTypegetBindingType(DOMAttr originAttr)Returns the binding type of the origin attribute which bounds an another target attribute.static DOMAttrgetSchemaLocation(DOMElement element)static booleanisXSAttribute(DOMElement element)static booleanisXSComplexType(Element element)static booleanisXSElement(Element element)static booleanisXSGroup(Element element)static booleanisXSImport(Element element)static booleanisXSInclude(Element element)static booleanisXSSchema(Element element)static booleanisXSSimpleType(Element element)static booleanisXSTargetElement(Element element)static voidsearchXSOriginAttributes(DOMNode targetNode, BiConsumer<DOMAttr,DOMAttr> collector, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker)Search origin attributes from the given target node..static voidsearchXSTargetAttributes(DOMAttr originAttr, XSDUtils.BindingType bindingType, boolean matchAttr, boolean searchInExternalSchema, BiConsumer<String,DOMAttr> collector)Collect XSD target attributes declared in the XML Schema according the given attribute and binding type.
-
-
-
Field Detail
-
SCHEMA_LOCATION_ATTR
public static final String SCHEMA_LOCATION_ATTR
- See Also:
- Constant Field Values
-
TARGET_NAMESPACE_ATTR
public static final String TARGET_NAMESPACE_ATTR
- See Also:
- Constant Field Values
-
NAMESPACE_ATTR
public static final String NAMESPACE_ATTR
- See Also:
- Constant Field Values
-
XS_IMPORT_TAG
public static final String XS_IMPORT_TAG
- See Also:
- Constant Field Values
-
XS_SCHEMA_TAG
public static final String XS_SCHEMA_TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
getBindingType
public static XSDUtils.BindingType getBindingType(DOMAttr originAttr)
Returns the binding type of the origin attribute which bounds an another target attribute.- Parameters:
originAttr- the origin attribute- Returns:
- the binding type of the origin attribute which bounds an another target attribute.
-
searchXSTargetAttributes
public static void searchXSTargetAttributes(DOMAttr originAttr, XSDUtils.BindingType bindingType, boolean matchAttr, boolean searchInExternalSchema, BiConsumer<String,DOMAttr> collector)
Collect XSD target attributes declared in the XML Schema according the given attribute and binding type.- Parameters:
originAttr- the origin attribute.matchAttr- true if the attribute value must match the value of target attribute value and false otherwise.searchInExternalSchema- true if search must be done in included XML Schema (xs:include) and false otherwise.collector- collector to collect XSD target attributes.
-
searchXSOriginAttributes
public static void searchXSOriginAttributes(DOMNode targetNode, BiConsumer<DOMAttr,DOMAttr> collector, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker)
Search origin attributes from the given target node..- Parameters:
targetNode- the referenced nodecollector- the collector to collect reference between an origin and target attribute.
-
isXSComplexType
public static boolean isXSComplexType(Element element)
-
isXSSimpleType
public static boolean isXSSimpleType(Element element)
-
isXSElement
public static boolean isXSElement(Element element)
-
isXSGroup
public static boolean isXSGroup(Element element)
-
isXSInclude
public static boolean isXSInclude(Element element)
-
isXSImport
public static boolean isXSImport(Element element)
-
isXSTargetElement
public static boolean isXSTargetElement(Element element)
-
isXSAttribute
public static boolean isXSAttribute(DOMElement element)
-
isXSSchema
public static boolean isXSSchema(Element element)
-
createFilesChangedTracker
public static FilesChangedTracker createFilesChangedTracker(org.apache.xerces.impl.xs.SchemaGrammar grammar)
-
createFilesChangedTracker
public static FilesChangedTracker createFilesChangedTracker(Set<org.apache.xerces.impl.xs.SchemaGrammar> grammars)
-
getSchemaLocation
public static DOMAttr getSchemaLocation(DOMElement element)
-
findSchemaLocationAttrByURI
public static DOMAttr findSchemaLocationAttrByURI(DOMDocument document, String grammarURI)
Returns the xsd:import/@schemaLocation or xsd:include/@schemaLocation declared in the givendocumentby the givengrammarURIand null otherwise.- Parameters:
document- the XSD documentgrammarURI- the grammar URI to retreive.- Returns:
- the xsd:import/@schemaLocation or xsd:include/@schemaLocation
declared in the given
documentby the givengrammarURIand null otherwise
-
-