Package org.openrewrite.xml.trait
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>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringextractLocalName(String name) Extract the local name from a tag or attribute name.static StringextractNamespacePrefix(String name) Extract the namespace prefix from a tag or attribute name.static @Nullable StringExtract the namespace prefix from a namespace definition attribute name (xmlns* attributes).static StringgetAttributeNameForPrefix(String namespacePrefix) List<org.openrewrite.xml.tree.Xml.Attribute> getName()List<org.openrewrite.xml.tree.Xml.Attribute> static booleanstatic Namespaced.Matchermatcher()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.trait.Trait
getCursor, getTree
-
Field Details
-
XML_SCHEMA_INSTANCE_URI
- See Also:
-
-
Constructor Details
-
Namespaced
public Namespaced()
-
-
Method Details
-
getName
-
getLocalName
-
getNamespacePrefix
-
getNamespaceUri
-
getNamespaces
-
getSchemaLocations
-
getAttributes
-
attributePrefixes
-
getAllNamespaces
- Returns:
- All namespaces in the current scope, including those defined in parent scopes.
-
isNamespaceDefinitionAttribute
-
getAttributeNameForPrefix
-
extractPrefixFromNamespaceDefinition
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
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
Extract the local name from a tag or attribute name.- Parameters:
name- the tag or attribute name- Returns:
- the local name
-
matcher
-