com.cysols.iodef
Class XMLFileWriter

java.lang.Object
  extended by com.cysols.iodef.XMLFileWriter
Direct Known Subclasses:
IodefXMLFileWriter, IodefXMLValidator

public class XMLFileWriter
extends Object

Write the XML docuemnt to file.

Author:
cysol

Constructor Summary
XMLFileWriter()
           
 
Method Summary
protected  boolean createDirs(String filePath)
          Creats the parent directorys and the parent dir if the specified path or parent dir are not present.
 void write(String fileName, IElement element)
          Writes the specified element by xml to specified file.
 void write(String fileName, String rootName, IElement element)
          Writes the specified element with specified root name by xml to specified file.
 void write(String fileName, String rootName, IElement[] elements)
          Writes the specified element with specified root name by xml to specified file.
protected  void writeToFile(Document doc, String filePath)
           
protected  void writeToFile(Document doc, String filePath, String dtdFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFileWriter

public XMLFileWriter()
Method Detail

write

public void write(String fileName,
                  String rootName,
                  IElement[] elements)
           throws XMLWriteException
Writes the specified element with specified root name by xml to specified file.

Parameters:
fileName - a xml file name
rootName - root element name
elements - the array of element instance.
Throws:
XMLWriteException - if writing goes wrong

write

public void write(String fileName,
                  String rootName,
                  IElement element)
           throws XMLWriteException
Writes the specified element with specified root name by xml to specified file.

Parameters:
fileName - a xml file name
rootName - root element name
element - element instance.
Throws:
XMLWriteException - if writing goes wrong

write

public void write(String fileName,
                  IElement element)
           throws XMLWriteException
Writes the specified element by xml to specified file.

Parameters:
fileName - - xml file name
element - - element instance.
Throws:
XMLWriteException - if writing goes wrong

writeToFile

protected void writeToFile(Document doc,
                           String filePath)
                    throws XMLWriteException
Throws:
XMLWriteException

writeToFile

protected void writeToFile(Document doc,
                           String filePath,
                           String dtdFile)
                    throws XMLWriteException
Throws:
XMLWriteException

createDirs

protected boolean createDirs(String filePath)
Creats the parent directorys and the parent dir if the specified path or parent dir are not present.

Parameters:
filePath - file name to write.