Class Namespaced

java.lang.Object
org.openrewrite.xml.trait.Namespaced
All Implemented Interfaces:
org.openrewrite.trait.Trait<org.openrewrite.xml.tree.Xml>

public class Namespaced extends Object implements org.openrewrite.trait.Trait<org.openrewrite.xml.tree.Xml>
  • Field Details

  • Constructor Details

    • Namespaced

      public Namespaced()
  • Method Details

    • getName

      public Optional<String> getName()
    • getLocalName

      public Optional<String> getLocalName()
    • getNamespacePrefix

      public Optional<String> getNamespacePrefix()
    • getNamespaceUri

      public Optional<String> getNamespaceUri()
    • getNamespaces

      public Map<String,String> getNamespaces()
    • getSchemaLocations

      public List<org.openrewrite.xml.tree.Xml.Attribute> getSchemaLocations()
    • getAttributes

      public List<org.openrewrite.xml.tree.Xml.Attribute> getAttributes()
    • attributePrefixes

      public List<String> attributePrefixes()
    • getAllNamespaces

      public Map<String,String> getAllNamespaces()
      Returns:
      All namespaces in the current scope, including those defined in parent scopes.
    • isNamespaceDefinitionAttribute

      public static boolean isNamespaceDefinitionAttribute(String name)
    • getAttributeNameForPrefix

      public static String getAttributeNameForPrefix(String namespacePrefix)
    • extractPrefixFromNamespaceDefinition

      public static @Nullable String extractPrefixFromNamespaceDefinition(String name)
      Extract the namespace prefix from a namespace definition attribute name (xmlns* attributes).
      Parameters:
      name - the attribute name or null if not a namespace definition attribute
      Returns:
      the namespace prefix
    • extractNamespacePrefix

      public static String extractNamespacePrefix(String name)
      Extract the namespace prefix from a tag or attribute name.
      Parameters:
      name - the tag or attribute name
      Returns:
      the namespace prefix (empty string for the default namespace)
    • extractLocalName

      public static String extractLocalName(String name)
      Extract the local name from a tag or attribute name.
      Parameters:
      name - the tag or attribute name
      Returns:
      the local name
    • matcher

      public static Namespaced.Matcher matcher()