import { default } from "https://deno.land/x/xml_renderer@5.0.7/mod.ts";
Constructors
A class that you instantiate to contain "metadata" associated with certain XML nodes. The metadata could be anything, but in context of being an "xml renderer" you'll probably want to use it for templates or React components.
See also GenericRenderer and ReactRenderer which extend the Registry
class and add a .render()
method to it.
Render functions (metadata) are associated with XML nodes via an XPath test. For any given node, the renderer will use the metadata associated the most specific test that matches the node.
Properties
All test/value sets known to this registery. Is kept in descending order of test specificity because Registry.optimize is always called when modifying this set through public methods.
Methods
Reorders the sets based on XPath test specificity so that an Array#find
finds the closest matching test
first.
For example <b />
could match tests self::b
as well as self::b[not(child::*)]
, but the latter is more
specific so it wins.
This method is private because it is already called at all relevant times. Calling it again will normally not yield any different results.
Add a test/value set to the registry, and optimizes (Registry.optimize).
Retrieve the metadata that was associated with this node before. If there are several rules that match, .find
gives you only the value of the best match.
Merges other registry instances into this one, and optimizes (Registry.optimize) when done.
Remove a test/value set from the registry. This is the opposite of the Registry.add method.