Package org.eclipse.lemminx.extensions.xsd.utils

## 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
`static class` `XSDUtils.BindingType` Binding type of xs attribute.

### Field Summary

Fields
`static String` `NAMESPACE_ATTR`
`static String` `SCHEMA_LOCATION_ATTR`
`static String` `TARGET_NAMESPACE_ATTR`
`static String` `XS_IMPORT_TAG`
`static String` `XS_SCHEMA_TAG`

### Constructor Summary

Constructors
`XSDUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static FilesChangedTracker` `createFilesChangedTracker​(Set<org.apache.xerces.impl.xs.SchemaGrammar> grammars)`
`static FilesChangedTracker` `createFilesChangedTracker​(org.apache.xerces.impl.xs.SchemaGrammar grammar)`
`static DOMAttr` `findSchemaLocationAttrByURI​(DOMDocument document, String grammarURI)` Returns the xsd:import/@schemaLocation or xsd:include/@schemaLocation declared in the given `document` by the given `grammarURI` and null otherwise.
`static XSDUtils.BindingType` `getBindingType​(DOMAttr originAttr)` Returns the binding type of the origin attribute which bounds an another target attribute.
`static DOMAttr` `getSchemaLocation​(DOMElement element)`
`static boolean` `isXSAttribute​(DOMElement element)`
`static boolean` `isXSComplexType​(Element element)`
`static boolean` `isXSElement​(Element element)`
`static boolean` `isXSGroup​(Element element)`
`static boolean` `isXSImport​(Element element)`
`static boolean` `isXSInclude​(Element element)`
`static boolean` `isXSSchema​(Element element)`
`static boolean` `isXSSimpleType​(Element element)`
`static boolean` `isXSTargetElement​(Element element)`
`static void` `searchXSOriginAttributes​(DOMNode targetNode, BiConsumer<DOMAttr,​DOMAttr> collector, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker)` Search origin attributes from the given target node..
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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

### Constructor Detail

#### XSDUtils

    public XSDUtils()

### 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 node
  `collector` - 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 given `document` by the given `grammarURI` and null otherwise.

Parameters:
  `document` - the XSD document
  `grammarURI` - the grammar URI to retreive.
Returns:
  the xsd:import/@schemaLocation or xsd:include/@schemaLocation declared in the given `document` by the given `grammarURI` and null otherwise