Chords

XmlExportVisitor
in package
implements VisitorInterface

Saves a song as a Song 1.0 XML document.

Interfaces, Classes, Traits and Enums

VisitorInterface
Visitor pattern for song objects.

Table of Contents

DTD_PUBLIC  = '-//JABURJAK//DTD Song 1.0//EN'
Public DTD identifier of a Song 1.0 document.
DTD_SYSTEM  = 'https://chords.jaburjak.cz/dtd/song-1.dtd'
System DTD identifier of a Song 1.0 document.
REPEAT_COUNT_DEFAULT  = 2
Default value of `count` attribute of `<repeat>`.
XML_ENCODING  = 'UTF-8'
Document encoding.
XML_NAMESPACE  = 'https://chords.jaburjak.cz/schema/song-1.xsd'
URI of the Song 1.0 XML schema.
XML_VERSION  = '1.0'
Version of the XML (not Song) specification.
$dom  : DOMDocument
XML document.
$fragmentStack  : SplStack
Current hierarchical structure of the built XML.
__construct()  : mixed
saveXml()  : string
visitChord()  : void
Process a chord.
visitParagraph()  : void
Process a paragraph.
visitRepeat()  : void
Process a repeat.
visitSong()  : void
Process entire song.
visitSongInfo()  : void
Process song metadata.
visitSongLyrics()  : void
Process song lyrics.
visitStrophe()  : void
Process a strophe.
visitStropheReference()  : void
Process a strophe reference.
visitText()  : void
Process plain text.
visitVerse()  : void
Process a verse.

Constants

DTD_PUBLIC

Public DTD identifier of a Song 1.0 document.

private string DTD_PUBLIC = '-//JABURJAK//DTD Song 1.0//EN'

DTD_SYSTEM

System DTD identifier of a Song 1.0 document.

private string DTD_SYSTEM = 'https://chords.jaburjak.cz/dtd/song-1.dtd'

REPEAT_COUNT_DEFAULT

Default value of `count` attribute of `<repeat>`.

private int REPEAT_COUNT_DEFAULT = 2

XML_NAMESPACE

URI of the Song 1.0 XML schema.

private string XML_NAMESPACE = 'https://chords.jaburjak.cz/schema/song-1.xsd'

XML_VERSION

Version of the XML (not Song) specification.

private string XML_VERSION = '1.0'

Properties

$fragmentStack

Current hierarchical structure of the built XML.

private SplStack $fragmentStack

Example: At the bottom of the stack is <song>. When <lyrics> starts to get processed, it is added onto the stack. When a <strophe> starts to get processed, it is added onto the stack. Same for other elements, lets say it ends with <verse>. When the verse is processed, it is removed from the stack and another can be added. When the entire paragraph is processed, it is removed from the stack and another one can be added onto the strophe that has come to the top of the stack.

Methods

visitChord()

Process a chord.

public visitChord(Chord $chord) : void
Parameters
$chord : Chord

chord

Tags
inheritdoc
Return values
void

visitParagraph()

Process a paragraph.

public visitParagraph(Paragraph $paragraph) : void
Parameters
$paragraph : Paragraph

paragraph

Tags
inheritdoc
Return values
void

visitRepeat()

Process a repeat.

public visitRepeat(Repeat $repeat) : void
Parameters
$repeat : Repeat

repeat

Tags
inheritdoc
Return values
void

visitSong()

Process entire song.

public visitSong(Song $song) : void
Parameters
$song : Song

song

Tags
inheritdoc
Return values
void

visitSongInfo()

Process song metadata.

public visitSongInfo(SongInfo $info) : void
Parameters
$info : SongInfo

metadata

Tags
inheritdoc
Return values
void

visitStrophe()

Process a strophe.

public visitStrophe(Strophe $strophe) : void
Parameters
$strophe : Strophe

strophe

Tags
inheritdoc
Return values
void

visitText()

Process plain text.

public visitText(Text $text) : void
Parameters
$text : Text

text

Tags
inheritdoc
Return values
void

visitVerse()

Process a verse.

public visitVerse(Verse $verse) : void
Parameters
$verse : Verse

verse

Tags
inheritdoc
Return values
void

Search results