java.lang.Object
org.eclipse.lemminx.extensions.xsd.utils.XSDUtils

public class XSDUtils extends Object
XSD utilities.
Author:
Angelo ZERR
  • Field Details

  • Constructor Details

    • XSDUtils

      public XSDUtils()
  • Method Details

    • 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