Chaste
Release::3.4
|
#include <XmlTools.hpp>
Classes | |
class | Finalizer |
Static Public Member Functions | |
static xsd::cxx::xml::dom::auto_ptr < xercesc::DOMDocument > | ReadXmlFile (const std::string &rFileName, const ::xsd::cxx::tree::properties< char > &rProps, bool validate=true) |
static void | Finalize () |
static xsd::cxx::xml::dom::auto_ptr < xercesc::DOMDocument > | ReadFileToDomDocument (const std::string &rFileName,::xsd::cxx::xml::error_handler< char > &rErrorHandler, const ::xsd::cxx::tree::properties< char > &rProps, bool validate=true) |
static void | PrintNode (const std::string &rMsg, xercesc::DOMNode *pNode, bool showChildren=false) |
static xercesc::DOMElement * | SetNamespace (xercesc::DOMDocument *pDocument, xercesc::DOMElement *pElement, const std::string &rNamespace) |
static xercesc::DOMElement * | SetNamespace (xercesc::DOMDocument *pDocument, xercesc::DOMElement *pElement, const XMLCh *pNamespace) |
static void | WrapContentInElement (xercesc::DOMDocument *pDocument, xercesc::DOMElement *pElement, const XMLCh *pNewElementLocalName) |
static std::vector < xercesc::DOMElement * > | GetChildElements (const xercesc::DOMElement *pElement) |
static std::vector < xercesc::DOMElement * > | FindElements (const xercesc::DOMElement *pContextElement, const std::string &rPath) |
static void | FindElements (const xercesc::DOMElement *pContextElement, const std::vector< std::string > &rNames, std::vector< xercesc::DOMElement * > &rResults, unsigned depth=0) |
static std::string | EscapeSpaces (const std::string &rPath) |
A class of utility methods for processing XML files, using Xerces and CodeSynthesis XSD.
Definition at line 70 of file XmlTools.hpp.
|
static |
Helper method for URL-escaping spaces in file paths, to avoid confusing Xerces regarding schema locations. Note that this is a very specific fix: it doesn't do general URL-escaping.
rPath | the path to escape |
Definition at line 444 of file XmlTools.cpp.
Referenced by HeartConfig::ReadFile().
|
static |
Must be called after you have finished working with a document returned by the ReadXmlFile methods. An alternative is to instantiate
just before calling ReadXmlFile, provided that you will do all your processing within that scope. The finalizer object will call Finalize in its destructor.
Definition at line 105 of file XmlTools.cpp.
Referenced by ReadXmlFile(), and XmlTools::Finalizer::~Finalizer().
|
static |
pContextElement | the root element to search from |
rPath | where to search. This should be a '/'-separated path of element names. |
Definition at line 386 of file XmlTools.cpp.
Referenced by XmlTransforms::CheckForIluPreconditioner(), FindElements(), XmlTransforms::MoveConductivityHeterogeneities(), XmlTransforms::SetDefaultVisualizer(), XmlTransforms::TransformArchiveDirectory(), and XmlTransforms::TransformIonicModelDefinitions().
|
static |
Find all elements matching the given path from this context element.
pContextElement | the root element to search from |
rNames | a list of element names, the first of which is looked for as children of pContextElement; the next as children of those, etc. |
rResults | vector to be filled in with matching elements |
depth | for managing recursion; should not be provided by users |
Definition at line 361 of file XmlTools.cpp.
References FindElements().
|
static |
pElement | the parent element |
Definition at line 345 of file XmlTools.cpp.
Referenced by SetNamespace().
|
static |
Display key info about an XML node for debugging.
rMsg | message to prepend to the report |
pNode | the node to display |
showChildren | whether to recursive display the node's children |
Definition at line 264 of file XmlTools.cpp.
|
static |
Read an XML file into a DOM document. Useful for figuring out what version of the parameters file we're dealing with, so we can construct the right version of the object model.
Requires the Xerces runtime to have been initialised.
rFileName | the file to read |
rErrorHandler | handler for any parsing errors |
rProps | properties that specify fixed schema locations, if wanted |
validate | whether to perform schema validation |
Definition at line 127 of file XmlTools.cpp.
Referenced by ReadXmlFile().
|
static |
Read an XML file into a DOM document, turning parsing errors into Chaste Exceptions. Handles initialising the Xerces runtime.
rFileName | the file to read |
rProps | properties that specify fixed schema locations, if wanted |
validate | whether to perform schema validation |
Definition at line 55 of file XmlTools.cpp.
References EXCEPTION, Finalize(), and ReadFileToDomDocument().
Referenced by HeartConfig::ReadFile().
|
static |
Fake having a namespace in older configuration files, by setting the namespace on each element in a tree.
pDocument | the DOM document containing the tree to be transformed |
pElement | the root of the tree to be transformed |
rNamespace | the namespace to put elements in |
Definition at line 337 of file XmlTools.cpp.
Referenced by HeartConfig::ReadFile(), and SetNamespace().
|
static |
Fake having a namespace in older configuration files, by setting the namespace on each element in a tree.
pDocument | the DOM document containing the tree to be transformed |
pElement | the root of the tree to be transformed |
pNamespace | the namespace to put elements in |
Definition at line 293 of file XmlTools.cpp.
References GetChildElements(), and SetNamespace().
|
static |
Wrap the content (children) of an element within a new element. The new element becomes the sole child of the original element.
pDocument | the DOM document containing the tree to be transformed |
pElement | the element whose content is to be wrapped |
pNewElementLocalName | the local name (i.e. without namespace prefix) of the wrapping element (the namespace of pElement will be used). |
Definition at line 411 of file XmlTools.cpp.
Referenced by XmlTransforms::TransformIonicModelDefinitions().