001    /**
002     * Copyright (c) 2000-2012 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 Node detach();
035    
036            public String formattedString() throws IOException;
037    
038            public String formattedString(String indent) throws IOException;
039    
040            public String formattedString(String indent, boolean expandEmptyElements)
041                    throws IOException;
042    
043            public Document getDocument();
044    
045            public String getName();
046    
047            public Element getParent();
048    
049            public String getPath();
050    
051            public String getPath(Element context);
052    
053            public String getStringValue();
054    
055            public String getText();
056    
057            public String getUniquePath();
058    
059            public String getUniquePath(Element context);
060    
061            public boolean hasContent();
062    
063            public boolean isReadOnly();
064    
065            public boolean matches(String xPathExpression);
066    
067            public Number numberValueOf(String xPathExpression);
068    
069            public List<Node> selectNodes(String xPathExpression);
070    
071            public List<Node> selectNodes(
072                    String xPathExpression, String comparisonXPathExpression);
073    
074            public List<Node> selectNodes(
075                    String xPathExpression, String comparisonXPathExpression,
076                    boolean removeDuplicates);
077    
078            public Object selectObject(String xPathExpression);
079    
080            public Node selectSingleNode(String xPathExpression);
081    
082            public void setName(String name);
083    
084            public void setText(String text);
085    
086            public boolean supportsParent();
087    
088            public String valueOf(String xPathExpression);
089    
090            public void write(Writer writer) throws IOException;
091    
092    }