equal
deleted
inserted
replaced
169 node |
169 node |
170 case Text(txt) => doc.createTextNode(txt) |
170 case Text(txt) => doc.createTextNode(txt) |
171 } |
171 } |
172 DOM(tree) |
172 DOM(tree) |
173 } |
173 } |
174 |
|
175 def document(tree: Tree, styles: String*): Document = |
|
176 { |
|
177 val doc = DocumentBuilderFactory.newInstance.newDocumentBuilder.newDocument |
|
178 doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\"")) |
|
179 |
|
180 for (style <- styles) { |
|
181 doc.appendChild(doc.createProcessingInstruction("xml-stylesheet", |
|
182 "href=\"" + style + "\" type=\"text/css\"")) |
|
183 } |
|
184 val root_elem = tree match { |
|
185 case Elem(_, _, _) => document_node(doc, tree) |
|
186 case Text(_) => document_node(doc, (Elem(Markup.ROOT, Nil, List(tree)))) |
|
187 } |
|
188 doc.appendChild(root_elem) |
|
189 doc |
|
190 } |
|
191 } |
174 } |