Document
NAME LibXML::Class::Document
- document object
DESCRIPTION
The concept of LibXML::Class
document is mostly covered in LibXML::Class::Manual.
Attributes
LibXML::Document $.libxml-document
The instance of deserialized LibXML document.
LibXML::Class::Config:D $.config
An instance of
LibXML::Class
configuration object. Defaults to the global singleton.
Methods
proto method parse(|)
multi method parse(::?CLASS:U: LibXML::Class::Config :$config, |args)
This methods creates a new instance of
LibXML::Class::Document
using either the provided$config
, or the global singleton. Then$config.libxml-config
is used to get the class ofLibXML
document usingclass-from
method and then callparse
method on the class with arguments inargs
.At the end a new
LibXML::Class
document is created using the parsedLibXML
document and the config object.multi method parse(::?CLASS:D: |args)
Create a new
$.libxml-document
by using$.config.libxml-config
and calling methodparse
with arguments inargs
. Returns the invocator.
method add-deserialization(LibXML::Class::XML:D $deserialization)
Unless disabled by the configuration, adds
$deserialization
to the document registry for fast hash-indexed search.proto method has-deserialization(|)
multi method has-deserialization(LibXML::Element:D $element)
Tells if there is an entry for the
$element
in the global registry.multi method has-deserialization(Str:D $unique-key)
Tells if there is an entry for the
$unique-key
in the global registry.
method deserializations(LibXML::Element:D $element)
Returns all deserializations registered for the
$element
, or an empty list if there is none.method remove-deserialization(LibXML::Class::XML:D $deserialization)
Removes the
$deserialization
from the global registry.proto method find-deserializations(|)
method find-deserializations(LibXML::Node:D $node)
method find-deserializations(Iterable:D $nodes)
Returns a list of deserializations for a
$node
or multiple$nodes
. When lazy operations are on and a node is not deserialized yet then the method tries to determine the path to the node and deserialize it, possibly deserializing all its parents along the way.method findnodes(|args)
This is a wrapper method which first calls
$.libxml-document.findnodes(|args)
and then sends all found nodes to thefind-deserializations
method.Returns a
LibXML::Class::X::Deserialization::NoBacking
Failure if there is no$.libxml-document
meaning that the object is not a result of deserialization.
SEE ALSO
COPYRIGHT
(c) 2023, Vadim Belman [email protected]
LICENSE
Artistic License 2.0
See the LICENSE file in this distribution.