001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import java.io.IOException;
020    import java.io.Serializable;
021    import java.io.Writer;
022    
023    import java.util.List;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    @ProviderType
029    public interface Node extends Serializable {
030    
031            public <T, V extends Visitor<T>> T accept(V visitor);
032    
033            public String asXML();
034    
035            public Node asXPathResult(Element parent);
036    
037            public String compactString() throws IOException;
038    
039            public Node detach();
040    
041            public String formattedString() throws IOException;
042    
043            public String formattedString(String indent) throws IOException;
044    
045            public String formattedString(String indent, boolean expandEmptyElements)
046                    throws IOException;
047    
048            public String formattedString(
049                            String indent, boolean expandEmptyElements, boolean trimText)
050                    throws IOException;
051    
052            public Document getDocument();
053    
054            public String getName();
055    
056            public Element getParent();
057    
058            public String getPath();
059    
060            public String getPath(Element context);
061    
062            public String getStringValue();
063    
064            public String getText();
065    
066            public String getUniquePath();
067    
068            public String getUniquePath(Element context);
069    
070            public boolean hasContent();
071    
072            public boolean isReadOnly();
073    
074            public boolean matches(String xPathExpression);
075    
076            public Number numberValueOf(String xPathExpression);
077    
078            public List<Node> selectNodes(String xPathExpression);
079    
080            public List<Node> selectNodes(
081                    String xPathExpression, String comparisonXPathExpression);
082    
083            public List<Node> selectNodes(
084                    String xPathExpression, String comparisonXPathExpression,
085                    boolean removeDuplicates);
086    
087            public Object selectObject(String xPathExpression);
088    
089            public Node selectSingleNode(String xPathExpression);
090    
091            public void setName(String name);
092    
093            public void setText(String text);
094    
095            public boolean supportsParent();
096    
097            public String valueOf(String xPathExpression);
098    
099            public void write(Writer writer) throws IOException;
100    
101    }