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_ENCODING
Document encoding.
private
string
XML_ENCODING
= 'UTF-8'
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
$dom
XML document.
private
DOMDocument
$dom
$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
__construct()
public
__construct() : mixed
Return values
mixed —saveXml()
public
saveXml() : string
Return values
string —visitChord()
Process a chord.
public
visitChord(Chord $chord) : void
Parameters
- $chord : Chord
-
chord
Tags
Return values
void —visitParagraph()
Process a paragraph.
public
visitParagraph(Paragraph $paragraph) : void
Parameters
- $paragraph : Paragraph
-
paragraph
Tags
Return values
void —visitRepeat()
Process a repeat.
public
visitRepeat(Repeat $repeat) : void
Parameters
- $repeat : Repeat
-
repeat
Tags
Return values
void —visitSong()
Process entire song.
public
visitSong(Song $song) : void
Parameters
- $song : Song
-
song
Tags
Return values
void —visitSongInfo()
Process song metadata.
public
visitSongInfo(SongInfo $info) : void
Parameters
- $info : SongInfo
-
metadata
Tags
Return values
void —visitSongLyrics()
Process song lyrics.
public
visitSongLyrics(SongLyrics $lyrics) : void
Parameters
- $lyrics : SongLyrics
-
lyrics
Tags
Return values
void —visitStrophe()
Process a strophe.
public
visitStrophe(Strophe $strophe) : void
Parameters
- $strophe : Strophe
-
strophe
Tags
Return values
void —visitStropheReference()
Process a strophe reference.
public
visitStropheReference(StropheReference $reference) : void
Parameters
- $reference : StropheReference
-
strophe reference
Tags
Return values
void —visitText()
Process plain text.
public
visitText(Text $text) : void
Parameters
- $text : Text
-
text
Tags
Return values
void —visitVerse()
Process a verse.
public
visitVerse(Verse $verse) : void
Parameters
- $verse : Verse
-
verse