Class RelaxNGUtils
- java.lang.Object
-
- org.eclipse.lemminx.extensions.relaxng.utils.RelaxNGUtils
-
public class RelaxNGUtils extends Object
RelaxNG utilities.- Author:
- Angelo ZERR
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRelaxNGUtils.BindingTypeBinding type of rng grammar
-
Field Summary
Fields Modifier and Type Field Description static StringGRAMMAR_TAGstatic StringNAME_ATTR
-
Constructor Summary
Constructors Constructor Description RelaxNGUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilesChangedTrackercreateFilesChangedTracker(RelaxNGGrammar grammar)static RelaxNGUtils.BindingTypegetBindingType(DOMAttr originAttr)Returns the binding type of the origin attribute (ex : ref/@name) which bounds an another target attribute (ex : define/@name).static DOMAttrgetHref(DOMElement element)static booleanisDefine(Element element)static booleanisExternalRef(Element element)static booleanisInclude(Element element)static booleanisRef(Element element)static booleanisRNGTargetElement(Element element)Returns true if the given element is an RNG target element (define element) and false otherwise.static voidsearchRNGOriginAttributes(DOMNode targetNode, BiConsumer<DOMAttr,DOMAttr> collector, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker)Search origin attributes from the given target node..static voidsearchRNGTargetAttributes(DOMAttr originAttr, RelaxNGUtils.BindingType bindingType, boolean matchAttr, boolean searchInExternalSchema, BiConsumer<String,DOMAttr> collector)Collect RNG target attributes declared in the RNG grammar according the given attribute and binding type.
-
-
-
Field Detail
-
GRAMMAR_TAG
public static final String GRAMMAR_TAG
- See Also:
- Constant Field Values
-
NAME_ATTR
public static final String NAME_ATTR
- See Also:
- Constant Field Values
-
-
Method Detail
-
createFilesChangedTracker
public static FilesChangedTracker createFilesChangedTracker(RelaxNGGrammar grammar)
-
getBindingType
public static RelaxNGUtils.BindingType getBindingType(DOMAttr originAttr)
Returns the binding type of the origin attribute (ex : ref/@name) which bounds an another target attribute (ex : define/@name).- Parameters:
originAttr- the origin attribute (ex : ref/@name)- Returns:
- the binding type of the origin attribute (ex : ref/@name) which bounds an another target attribute (ex : define/@name).
-
searchRNGTargetAttributes
public static void searchRNGTargetAttributes(DOMAttr originAttr, RelaxNGUtils.BindingType bindingType, boolean matchAttr, boolean searchInExternalSchema, BiConsumer<String,DOMAttr> collector)
Collect RNG target attributes declared in the RNG grammar 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 (include) and false otherwise.collector- collector to collect RNG target attributes.
-
searchRNGOriginAttributes
public static void searchRNGOriginAttributes(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.
-
isInclude
public static boolean isInclude(Element element)
-
isExternalRef
public static boolean isExternalRef(Element element)
-
isDefine
public static boolean isDefine(Element element)
-
isRef
public static boolean isRef(Element element)
-
isRNGTargetElement
public static boolean isRNGTargetElement(Element element)
Returns true if the given element is an RNG target element (define element) and false otherwise.- Parameters:
element- the DOM element.- Returns:
- true if the given element is an RNG target element (define element) and false otherwise.
-
getHref
public static DOMAttr getHref(DOMElement element)
-
-