Documentation

RdfXmlSerializer
in package
implements Serializer Uses TmpStreamSerializerTrait

Simple RDF-XML serializer. It is optimized for speed and low memory footprint.

This means it doesn't perform any preprocessing of the serialized data. As a consequence:

  • All namespaces which aren't passed to the serializeStream()/serialize() methods using the $nmsp parameter are just declared in-place in each XML tag in which they are needed.
  • The tag representing the subject is reused only if subsequent triples being serialized share the same subject. For the sake of simplicity, speed and low memory usage this class doesn't try to reorder triples in a way each subject in the graph has only single XML tag representing it.

Other limitations:

  • Only triples can be serialized as the RDF-XML serialization format is defined only for the base RDF.
  • This class naivly shortens predicate URIs splitting on the last hash, slash, star or semicolon. This doesn't guarantee generation of a proper XML PrefixedName. The simplest corner case is just an URI ending with a number like http://foo/123 which is shortened to ns:123 which is invalid in XML.
Tags
author

zozlak

Interfaces, Classes, Traits and Enums

Serializer

Table of Contents

$prefixes  : array<string|int, mixed>
$prettyPrint  : bool
__construct()  : mixed
serialize()  : string
serializeStream()  : void
e()  : string
shorten()  : array<string|int, string>

Properties

Methods

__construct()

public __construct([bool $prettyPrint = true ]) : mixed
Parameters
$prettyPrint : bool = true

should output XML be pretty-formatted?

Return values
mixed

e()

private e(string $value) : string
Parameters
$value : string
Return values
string

shorten()

private shorten(string $uri) : array<string|int, string>
Parameters
$uri : string
Return values
array<string|int, string>

Search results