org.codehaus.cargo.util
Interface XmlFileBuilder

All Known Implementing Classes:
Dom4JXmlFileBuilder

public interface XmlFileBuilder

This interface intends to remove hard-bindings to a specific xml api. Implementations of this interface will: 1. optionally load a file 2. insert some elements into the current document 3. write the file to disk

Version:
$Id$

Method Summary
 void insertElementsUnderXPath(String elementsToParse, String xpath)
          this will parse one or more elements from elementToParse and insert them under the xpath.
 void loadFile()
          load the current xml file into a Document.
 void setFile(String path)
          sets the name of the file we will read and write.
 void setNamespaces(Map namespaces)
          assign prefix to namespace mappings used for xpath and other xml operations.
 void writeFile()
          write the current xml to disk.
 

Method Detail

setFile

void setFile(String path)
sets the name of the file we will read and write.

Parameters:
path - - where the xml file will be read from or written to.

setNamespaces

void setNamespaces(Map namespaces)
assign prefix to namespace mappings used for xpath and other xml operations. Leave alone, or set to null, if you have no namespaces.

Parameters:
namespaces - - key is prefix value is url

loadFile

void loadFile()
load the current xml file into a Document.


insertElementsUnderXPath

void insertElementsUnderXPath(String elementsToParse,
                              String xpath)
this will parse one or more elements from elementToParse and insert them under the xpath. note: elementsToParse may not be well formed, but only in one way. The elements may be missing a parent. Example: the following is acceptable by this method elementsToParse = xpath = //parent In this case, both elements child1 and child2 would be placed under the first match for parent. s

Parameters:
elementsToParse - String containing one or more elements in textual format
xpath - where to place the above elements.

writeFile

void writeFile()
write the current xml to disk.



Copyright © 2004-2012 Codehaus. All Rights Reserved.