KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > nava > informa > core > WithElementsAndAttributesMIF


1 //
2
// Informa -- RSS Library for Java
3
// Copyright (c) 2002 by Niko Schmuck
4
//
5
// Niko Schmuck
6
// http://sourceforge.net/projects/informa
7
// mailto:niko_schmuck@users.sourceforge.net
8
//
9
// This library is free software.
10
//
11
// You may redistribute it and/or modify it under the terms of the GNU
12
// Lesser General Public License as published by the Free Software Foundation.
13
//
14
// Version 2.1 of the license should be included with this distribution in
15
// the file LICENSE. If the license is not included with this distribution,
16
// you may find a copy at the FSF web site at 'www.gnu.org' or 'www.fsf.org',
17
// or you may write to the Free Software Foundation, 675 Mass Ave, Cambridge,
18
// MA 02139 USA.
19
//
20
// This library is distributed in the hope that it will be useful,
21
// but WITHOUT ANY WARRANTY; without even the implied waranty of
22
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
// Lesser General Public License for more details.
24
//
25

26 package de.nava.informa.core;
27
28 /**
29  * Meta-, or markerinterface, specifying objects, having <strong>nested
30  * elements &amp; attributes</strong>.
31  *
32  * @author <a HREF="mailto:alexei@matiouchkine.de">Alexei Matiouchkine</a>
33  * @version $Id: WithElementsAndAttributesMIF.java,v 1.2 2004/01/30 20:36:06 niko_schmuck Exp $
34  */

35 public interface WithElementsAndAttributesMIF {
36   /**
37    * Returns the value of the Channel's child element reached by the given path.
38    * <br>For example, getElementValue("image/title") will return the title of the Channel's image element.
39    *
40    * @param path a path to the child. Paths are specified as element names, separated by a "/".
41    * Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee".
42    *
43    * @return the value of the child.
44    * Returns <code>null</code> if path is <code>null</code>.
45    */

46   String JavaDoc getElementValue(final String JavaDoc path);
47
48   /**
49    * Returns the values of the specified sub-elements of the Channel's child reached by the given path.
50    * This is useful in cases where a child has several children.
51    * <br>For example,
52    * getElementValues("image", new String[] {"title", "url", "link", "width", "height", "description"} )
53    * will return the specified sub-elements of the "image" element.
54    *
55    * @param path a path to the child. Paths are specified as element names, separated by a "/".
56    * Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee".
57    * @param elements An array of element names. May contain namespace specifiers.
58    *
59    * @return an array containing the value of each element.
60    * <br>If <code>path</code> is <code>null</code>, returns the specified sub-elements for the Channel.
61    * If <code>elements</code> is <code>null</code>, returns <code>null</code>.
62    */

63   String JavaDoc[] getElementValues(final String JavaDoc path, final String JavaDoc[] elements);
64
65   /**
66    * Returns the value of the attribute of the Channel's child element reached by the given path.
67    * <br>For example, getAttributeValue("admin:generatorAgent", "rdf:resource")
68    * will return the "rdf:resource" attribute of the Channel's "admin:generatorAgent" element.
69    *
70    * @param path a path to the root of the elements. Paths are specified as element names, separated by a "/".
71    * @param attribute the attribute. May contain a namespace specifier e.g. "rdf:resource".
72    *
73    * @return the value of the attribute.
74    * <br>If <code>path</code> is <code>null</code>, returns the specified attribute for the Channel.
75    * If <code>attribute</code> is <code>null</code>, returns <code>null</code>.
76    *
77    */

78   String JavaDoc getAttributeValue(final String JavaDoc path, final String JavaDoc attribute);
79
80   /**
81    * Returns the values of the specified attributes of the Channel's child element reached by the given path.
82    * This is useful in cases where a child has several attributes.
83    *
84    * @param path a path to the child. Paths are specified as element names, separated by a "/".
85    * Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee".
86    * @param attributes An array of element names. May contain namespace specifiers.
87    *
88    * @return an array containing the value of each attribute.
89    * <br>If <code>path</code> is <code>null</code>, returns the specified attributes for the Channel.
90    * If <code>attributes</code> is <code>null</code>, returns <code>null</code>.
91    */

92   String JavaDoc[] getAttributeValues(final String JavaDoc path, final String JavaDoc[] attributes);
93 }
94
Popular Tags