andyLib v0.9

it.andynaz.utils
Class UtilsXML

java.lang.Object
  extended by it.andynaz.utils.UtilsXML

Deprecated.

@Deprecated
public class UtilsXML
extends Object

Useful methods for an elementary management of XML files. To read and write XML files, methods in the UtilsIO class can be used.

Version:
2013/09/17
Author:
andynaz

Constructor Summary
private UtilsXML()
          Deprecated.  
 
Method Summary
static String readTag(File file, String tag)
          Deprecated. Read the content of a tag from an XML file.
static String readTag(String fileContent, String tag)
          Deprecated. Read the content of a tag from an XML file.
static void replaceTag(File file, String tag, String content)
          Deprecated. Replace the content of a tag.
static String replaceTag(String fileContent, String tag, String content)
          Deprecated. Replace the content of a tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtilsXML

private UtilsXML()
Deprecated. 
Method Detail

replaceTag

public static void replaceTag(File file,
                              String tag,
                              String content)
Deprecated. 
Replace the content of a tag. Uses the replaceTag(java.lang.String, java.lang.String, java.lang.String) method.

The method does not throw any Exception; if an error occours it writes a log on the standard output.

Parameters:
file - an XML file
tag - tag name
content - new tag content

replaceTag

public static String replaceTag(String fileContent,
                                String tag,
                                String content)
Deprecated. 
Replace the content of a tag. It is necessary for the tag to be present in the fileContent.

Note: only the first occourrence will be replaced.

Parameters:
fileContent - content of the XML file
tag - tag name
content - new tag content
Returns:
the new content of the XML file

readTag

public static String readTag(File file,
                             String tag)
                      throws IOException
Deprecated. 
Read the content of a tag from an XML file. Uses the readTag(java.lang.String, java.lang.String) method.

Note: only the first occourrence of the tag is read.

Parameters:
file - an XML file
tag - tag name
Returns:
the content of the tag, or an empty string if the file or the tag cannot be found
Throws:
IOException - if I/O errors occour

readTag

public static String readTag(String fileContent,
                             String tag)
Deprecated. 
Read the content of a tag from an XML file.

Note: only the first occourrence of the tag is read.

Parameters:
fileContent - content of an XML file
tag - tag name
Returns:
the content of the tag, or an empty string if the file or the tag cannot be found
Throws:
NullPointerException - if the tag parameter is empty

andyLib v0.9

© 2013 andynaz - http://andynaz.altervista.org