SongLyricsXmlParser
in package
Song lyrics XML parser.
Table of Contents
- parse() : SongLyrics
- Parses song lyrics.
- extractLabeledStrophes() : array<string|int, Strophe>
- Returns strophes with a label.
- parseChord() : Chord
- Parses a chord.
- parseLyrics() : array<string|int, Node>
- Parses song lyrics.
- parseParagraph() : Paragraph
- Parses a paragraph.
- parseRepeat() : Strophe
- Parses a repeat element.
- parseStrophe() : Strophe
- Parses a strophe.
- parseVerse() : Verse
- Parses a verse.
Methods
parse()
Parses song lyrics.
public
parse(SimpleXMLElement $sxml) : SongLyrics
Parameters
- $sxml : SimpleXMLElement
-
lyrics element
Tags
Return values
SongLyrics —parsed object
extractLabeledStrophes()
Returns strophes with a label.
private
extractLabeledStrophes(SimpleXMLElement $sxml) : array<string|int, Strophe>
The keys of the returned array are strophe labels.
Parameters
- $sxml : SimpleXMLElement
-
lyrics element
Tags
Return values
array<string|int, Strophe> —labeled strophes
parseChord()
Parses a chord.
private
parseChord(DOMElement $dom) : Chord
Parameters
- $dom : DOMElement
-
chord element
Tags
Return values
Chord —parsed object
parseLyrics()
Parses song lyrics.
private
parseLyrics(SimpleXMLElement $sxml, array<string|int, Strophe> $labeledStrophes) : array<string|int, Node>
Parameters
- $sxml : SimpleXMLElement
-
lyrics element
- $labeledStrophes : array<string|int, Strophe>
-
already parsed strophes with labels
Tags
Return values
array<string|int, Node> —lyrics content
parseParagraph()
Parses a paragraph.
private
parseParagraph(SimpleXMLElement $sxml) : Paragraph
Parameters
- $sxml : SimpleXMLElement
-
paragraph element
Tags
Return values
Paragraph —parsed object
parseRepeat()
Parses a repeat element.
private
parseRepeat(SimpleXMLElement $sxml, array<string|int, mixed> $context) : Strophe
Parameters
- $sxml : SimpleXMLElement
-
repeat element
- $context : array<string|int, mixed>
-
context where the repeat element appeared
Tags
Return values
Strophe —parsed object
parseStrophe()
Parses a strophe.
private
parseStrophe(SimpleXMLElement $sxml) : Strophe
Parameters
- $sxml : SimpleXMLElement
-
strophe element
Tags
Return values
Strophe —parsed object
parseVerse()
Parses a verse.
private
parseVerse(SimpleXMLElement $sxml) : Verse
Parameters
- $sxml : SimpleXMLElement
-
verse element
Tags
Return values
Verse —parsed object