001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.xml;
016    
017    import java.io.IOException;
018    import java.io.Serializable;
019    import java.io.Writer;
020    
021    import java.util.List;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public interface Node extends Serializable {
027    
028            public <T, V extends Visitor<T>> T accept(V visitor);
029    
030            public String asXML();
031    
032            public Node asXPathResult(Element parent);
033    
034            public String compactString() throws IOException;
035    
036            public Node detach();
037    
038            public String formattedString() throws IOException;
039    
040            public String formattedString(String indent) throws IOException;
041    
042            public String formattedString(String indent, boolean expandEmptyElements)
043                    throws IOException;
044    
045            public String formattedString(
046                            String indent, boolean expandEmptyElements, boolean trimText)
047                    throws IOException;
048    
049            public Document getDocument();
050    
051            public String getName();
052    
053            public Element getParent();
054    
055            public String getPath();
056    
057            public String getPath(Element context);
058    
059            public String getStringValue();
060    
061            public String getText();
062    
063            public String getUniquePath();
064    
065            public String getUniquePath(Element context);
066    
067            public boolean hasContent();
068    
069            public boolean isReadOnly();
070    
071            public boolean matches(String xPathExpression);
072    
073            public Number numberValueOf(String xPathExpression);
074    
075            public List<Node> selectNodes(String xPathExpression);
076    
077            public List<Node> selectNodes(
078                    String xPathExpression, String comparisonXPathExpression);
079    
080            public List<Node> selectNodes(
081                    String xPathExpression, String comparisonXPathExpression,
082                    boolean removeDuplicates);
083    
084            public Object selectObject(String xPathExpression);
085    
086            public Node selectSingleNode(String xPathExpression);
087    
088            public void setName(String name);
089    
090            public void setText(String text);
091    
092            public boolean supportsParent();
093    
094            public String valueOf(String xPathExpression);
095    
096            public void write(Writer writer) throws IOException;
097    
098    }