Skip to content
Daniele Orlando edited this page Nov 8, 2023 · 10 revisions

Functions

function fluidxml($root?, array $options?);  // Concise syntax for: new FluidXml().

function fluidify($file);                    // Concise syntax for: FluidXml::load().

function fluidns($id, $uri, $mode?);         // Concise syntax for: new FluidNamespace().

FluidXml class

class FluidXml
{
    //  Static Methods  ////////////////////////////////////////////////////////

    ::load($file);

    ::new($root?, array $options?);              // Alias of __construct(), requires PHP 7.


    //  Instance Methods  //////////////////////////////////////////////////////

    __construct($root?, array $options?);

    //  Namespaces  ////////////////////////////////////////////////////////////

    ->namespace(...$namespace);

    ->namespaces();

    //  Querying  //////////////////////////////////////////////////////////////

    ->__invoke(...$query);                       // Concise syntax.
    ->query(...$query);                          // Extended syntax.

    //  Manipulation  //////////////////////////////////////////////////////////

    ->add($child, ...$optionals);                // Concise.
    ->addChild($child, ...$optionals);           // Extended.

    ->prepend($sibling, ...$optionals);          // Concise.
    ->prependSibling($sibling, ...$optionals);   // Extended.

    ->append($sibling, ...$optionals);           // Concise.
    ->appendSibling($sibling, ...$optionals);    // Extended.

    ->attr(...$arguments);                       // Concise.
    ->setAttribute(...$arguments);               // Extended.

    ->text($text);                               // Concise.
    ->setText($text);                            // Extended.

    ->addText($text);

    ->cdata($text);                              // Concise.
    ->setCdata($text);                           // Extended.

    ->addCdata($text);

    ->comment($text);                            // Concise.
    ->setComment($text);                         // Extended.

    ->addComment($text);

    ->remove(...$query);

    //  Iteration  /////////////////////////////////////////////////////////////

    ->each(callable $fn);

    ->filter(callable $fn);

    ->map(callable $fn);

    ->times($times);
    ->times($times, callable $fn);

    ->size();                                    // Concise.
    ->length();                                  // Extended.

    //  Export  ////////////////////////////////////////////////////////////////

    ->array();

    ->dom();

    ->__toString();                              // Concise.
    ->xml($strip = false);                       // Extended.

    ->html($strip = false);

    ->save($file, $strip = false);
}

FluidNamespace class

class FluidNamespace
{
    __construct($id, $uri, $mode?);

    ->id();

    ->uri();

    ->mode();

    ->querify($xpath);
}

The complete API documentation can be generated executing:

./support/tools/gendoc      # Generated under 'documents/api/'.