1
19
20 package com.liferay.portal.xml;
21
22 import com.liferay.portal.kernel.xml.Document;
23 import com.liferay.portal.kernel.xml.Element;
24 import com.liferay.util.xml.XMLFormatter;
25
26 import java.io.IOException;
27
28
34 public class DocumentImpl extends BranchImpl implements Document {
35
36 public DocumentImpl(org.dom4j.Document document) {
37 super(document);
38
39 _document = document;
40 }
41
42 public Document addComment(String comment) {
43 _document.addComment(comment);
44
45 return this;
46 }
47
48 public Document addDocType(String name, String publicId, String systemId) {
49 _document.addDocType(name, publicId, systemId);
50
51 return this;
52 }
53
54 public boolean equals(Object obj) {
55 org.dom4j.Document document = ((DocumentImpl)obj).getWrappedDocument();
56
57 return _document.equals(document);
58 }
59
60 public String formattedString() throws IOException {
61 return XMLFormatter.toString(_document);
62 }
63
64 public String formattedString(String indent) throws IOException {
65 return XMLFormatter.toString(_document, indent);
66 }
67
68 public String formattedString(String indent, boolean expandEmptyElements)
69 throws IOException {
70
71 return XMLFormatter.toString(_document, indent, expandEmptyElements);
72 }
73
74 public Element getRootElement() {
75 return new ElementImpl(_document.getRootElement());
76 }
77
78 public org.dom4j.Document getWrappedDocument() {
79 return _document;
80 }
81
82 public String getXMLEncoding() {
83 return _document.getXMLEncoding();
84 }
85
86 public int hashCode() {
87 return _document.hashCode();
88 }
89
90 public void setRootElement(Element rootElement) {
91 ElementImpl rootElementImpl = (ElementImpl)rootElement;
92
93 _document.setRootElement(rootElementImpl.getWrappedElement());
94 }
95
96 public void setXMLEncoding(String encoding) {
97 _document.setXMLEncoding(encoding);
98 }
99
100 private org.dom4j.Document _document;
101
102 }