From 4d9985da1e5f32f5c07300a9b7f15021f8674f4c Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Tue, 28 Mar 2023 17:52:10 +0800 Subject: [PATCH] add support of in book.xml --- assets/xsd/book.xsd | 2 ++ assets/xsd/configurations.xsd | 27 ++++++++++++++++++----- constant.php | 2 +- src/Element/BookContent/BookContented.php | 7 +++++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/assets/xsd/book.xsd b/assets/xsd/book.xsd index d8b0550..3fbcda8 100644 --- a/assets/xsd/book.xsd +++ b/assets/xsd/book.xsd @@ -14,6 +14,8 @@ + + diff --git a/assets/xsd/configurations.xsd b/assets/xsd/configurations.xsd index 7644fcf..05f336d 100644 --- a/assets/xsd/configurations.xsd +++ b/assets/xsd/configurations.xsd @@ -8,9 +8,9 @@ - - - + + + @@ -22,10 +22,25 @@ + + + + + + + + + + + + + + + - - - + + + diff --git a/constant.php b/constant.php index ab0f066..6e05ee5 100644 --- a/constant.php +++ b/constant.php @@ -2,6 +2,6 @@ const APP_NAME = "ph-Bookshelf"; -const VERSION = "0.5.0-alpha4"; +const VERSION = "0.5.0-alpha5"; const CHANNEL = "suk-ws"; const BRANCH = "config-v2.0"; diff --git a/src/Element/BookContent/BookContented.php b/src/Element/BookContent/BookContented.php index ad73d3c..4591fcf 100644 --- a/src/Element/BookContent/BookContented.php +++ b/src/Element/BookContent/BookContented.php @@ -5,6 +5,7 @@ namespace SukWs\Bookshelf\Element\BookContent; use DOMDocument; use DOMNode; use Exception; +use SukWs\Bookshelf\Element\Bookshelf; class BookContented { @@ -32,13 +33,17 @@ class BookContented { for ($child = $nodeBook->firstChild; $child != null; $child = $child->nextSibling) { switch ($child->nodeName) { case "book_name": - if (!empty($return->name)) throw new Exception("Duplicated contents in Book.xml"); + if (!empty($return->name)) throw new Exception("Duplicated book_name in Book.xml"); $return->name = $child->nodeValue; break; case "contents": if (!empty($return->children)) throw new Exception("Duplicated contents in Book.xml"); $return->children = Chapter::parse($child, null); break; + case "configurations": + if (!empty($return->children)) throw new Exception("Duplicated configurations in Book.xml"); + Bookshelf::parseConfiguration($child, $return->configurations); + break; case "#comment": case "#text": if (empty(trim($child->nodeValue))) break;