File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ class Packaging {
5656
5757 this . spine = this . parseSpine ( spineNode , this . manifest ) ;
5858
59+ this . uniqueIdentifier = this . findUniqueIdentifier ( packageDocument ) ;
5960 this . metadata = this . parseMetadata ( metadataNode ) ;
6061
6162 this . metadata . direction = spineNode . getAttribute ( "page-progression-direction" ) ;
@@ -180,6 +181,29 @@ class Packaging {
180181 return spine ;
181182 }
182183
184+ /**
185+ * Find Unique Identifier
186+ * @private
187+ * @param {node } packageXml
188+ * @return {string } Unique Identifier text
189+ */
190+ findUniqueIdentifier ( packageXml ) {
191+ var uniqueIdentifierId = packageXml . documentElement . getAttribute ( "unique-identifier" ) ;
192+ if ( ! uniqueIdentifierId ) {
193+ return "" ;
194+ }
195+ var identifier = packageXml . getElementById ( uniqueIdentifierId ) ;
196+ if ( ! identifier ) {
197+ return "" ;
198+ }
199+
200+ if ( identifier . localName === "identifier" && identifier . namespaceURI === "http://purl.org/dc/elements/1.1/" ) {
201+ return identifier . childNodes [ 0 ] . nodeValue . trim ( ) ;
202+ }
203+
204+ return "" ;
205+ }
206+
183207 /**
184208 * Find TOC NAV
185209 * @private
You can’t perform that action at this time.
0 commit comments