1   package org.daisy.pipeline.tts;
2   
3   import java.util.Collection;
4   
5   import net.sf.saxon.s9api.XdmNode;
6   
7   public interface SSMLMarkSplitter {
8   
9   	/**
10  	 * @return a list of SSML chunks, XML document or otherwise.
11  	 */
12  	Collection<Chunk> split(XdmNode xdmNode);
13  
14  	static class Chunk {
15  		public Chunk(XdmNode ssml) {
16  			this.ssml = ssml;
17  		}
18  
19  		/**
20  		 * @param ssml the piece of SSML, XML document or otherwise.
21  		 * @param leftmark can be null if there is mark on the left of the chunk
22  		 */
23  		public Chunk(XdmNode ssml, String leftmark) {
24  			this.ssml = ssml;
25  			this.leftmark = leftmark;
26  		}
27  
28  		public boolean mostLeftChunk() {
29  			return leftmark == null;
30  		}
31  
32  		/**
33  		 * @return null if there is no mark on the left of the Chunk
34  		 */
35  		public String leftMark() {
36  			return leftmark;
37  		}
38  
39  		public XdmNode ssml() {
40  			return ssml;
41  		}
42  
43  		private String leftmark;
44  		private XdmNode ssml;
45  
46  		@Override
47  		public String toString() {
48  			return "Chunk{" + leftmark + "}";
49  		}
50  	}
51  
52  }