xml.h revision 323bf6a10a0b2a254da0d1d04a570a061f77330d
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * IPRT - XML Helper APIs.
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * Copyright (C) 2007-2011 Oracle Corporation
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * available from http://www.virtualbox.org. This file is free software;
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * you can redistribute it and/or modify it under the terms of the GNU
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * General Public License (GPL) as published by the Free Software
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * The contents of this file may alternatively be used under the terms
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * of the Common Development and Distribution License Version 1.0
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * VirtualBox OSE distribution, in which case the provisions of the
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * CDDL are applicable instead of those of the GPL.
456f370fcde010d585d9174df045978a6c9893c1vboxsync * You may elect to license modified versions of this file under the
27537ffef7291d0bb3a24e459a6b94c65586defevboxsync * terms and conditions of either the GPL or the CDDL or both.
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync# error "There are no XML APIs available in Ring-0 Context!"
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync/** @defgroup grp_rt_cpp_xml C++ XML support
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @ingroup grp_rt_cpp
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync/* Forwards */
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @addtogroup grp_rt_cpp_xml
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync// Exceptions
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync//////////////////////////////////////////////////////////////////////////////
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync// Logical errors
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync//////////////////////////////////////////////////////////////////////////////
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncclass RT_DECL_CLASS ENotImplemented : public LogicError
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync ENotImplemented(const char *aMsg = NULL) : LogicError(aMsg) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync ENotImplemented(RT_SRC_POS_DECL) : LogicError(RT_SRC_POS_ARGS) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync EInvalidArg(const char *aMsg = NULL) : LogicError(aMsg) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync EInvalidArg(RT_SRC_POS_DECL) : LogicError(RT_SRC_POS_ARGS) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncclass RT_DECL_CLASS EDocumentNotEmpty : public LogicError
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync EDocumentNotEmpty(const char *aMsg = NULL) : LogicError(aMsg) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync EDocumentNotEmpty(RT_SRC_POS_DECL) : LogicError(RT_SRC_POS_ARGS) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncclass RT_DECL_CLASS ENodeIsNotElement : public LogicError
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync ENodeIsNotElement(const char *aMsg = NULL) : LogicError(aMsg) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync ENodeIsNotElement(RT_SRC_POS_DECL) : LogicError(RT_SRC_POS_ARGS) {}
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync// Runtime errors
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync//////////////////////////////////////////////////////////////////////////////
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncclass RT_DECL_CLASS EIPRTFailure : public RuntimeError
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync EIPRTFailure(int aRC, const char *pcszContext, ...);
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync int rc() const
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The Stream class is a base class for I/O streams.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Returns the current read/write position in the stream. The returned
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * position is a zero-based byte offset from the beginning of the file.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Throws ENotImplemented if this operation is not implemented for the
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * given stream.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Sets the current read/write position in the stream.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aPos Zero-based byte offset from the beginning of the stream.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Throws ENotImplemented if this operation is not implemented for the
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * given stream.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The Input class represents an input stream.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * This input stream is used to read the settings tree from.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * This is an abstract class that must be subclassed in order to fill it with
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * useful functionality.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Reads from the stream to the supplied buffer.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aBuf Buffer to store read data to.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aLen Buffer length.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @return Number of bytes read.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Writes to the stream from the supplied buffer.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aBuf Buffer to write data from.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aLen Buffer length.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @return Number of bytes written.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync virtual int write (const char *aBuf, int aLen) = 0;
ea196eaae4348f1908e5693c07f62d1759d870d1vboxsync * Truncates the stream from the current position and upto the end.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The new file size will become exactly #pos() bytes.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Throws ENotImplemented if this operation is not implemented for the
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * given stream.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync//////////////////////////////////////////////////////////////////////////////
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The File class is a stream implementation that reads from and writes to
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * regular files.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The File class uses IPRT File API for file operations. Note that IPRT File
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * API is not thread-safe. This means that if you pass the same RTFILE handle to
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * different File instances that may be simultaneously used on different
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * threads, you should care about serialization; otherwise you will get garbage
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * when reading from or writing to such File instances.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncclass RT_DECL_CLASS File : public Input, public Output
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Possible file access modes.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync enum Mode { Mode_Read, Mode_WriteCreate, Mode_Overwrite, Mode_ReadWrite };
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Opens a file with the given name in the given mode. If @a aMode is Read
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * or ReadWrite, the file must exist. If @a aMode is Write, the file must
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * not exist. Otherwise, an EIPRTFailure excetion will be thrown.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aMode File mode.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aFileName File name.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aFlushIt Whether to flush a writable file before closing it.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync File(Mode aMode, const char *aFileName, bool aFlushIt = false);
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Uses the given file handle to perform file operations. This file
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * handle must be already open in necessary mode (read, or write, or mixed).
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The read/write position of the given handle will be reset to the
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * beginning of the file on success.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Note that the given file handle will not be automatically closed upon
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * this object destruction.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @note It you pass the same RTFILE handle to more than one File instance,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * please make sure you have provided serialization in case if these
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * instasnces are to be simultaneously used by different threads.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Otherwise you may get garbage when reading or writing.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aHandle Open file handle.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aFileName File name (for reference).
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * @param aFlushIt Whether to flush a writable file before closing it.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync File(RTFILE aHandle, const char *aFileName = NULL, bool aFlushIt = false);
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Destroys the File object. If the object was created from a file name
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * the corresponding file will be automatically closed. If the object was
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * created from a file handle, it will remain open.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync const char *uri() const;
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * See Input::read(). If this method is called in wrong file mode,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * LogicError will be thrown.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * See Output::write(). If this method is called in wrong file mode,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * LogicError will be thrown.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * See Output::truncate(). If this method is called in wrong file mode,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * LogicError will be thrown.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync /* Obscure class data */
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync /* auto_ptr data doesn't have proper copy semantics */
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * The MemoryBuf class represents a stream implementation that reads from the
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * memory buffer.
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync MemoryBuf (const char *aBuf, size_t aLen, const char *aURI = NULL);
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync const char *uri() const;
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync /* Obscure class data */
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync /* auto_ptr data doesn't have proper copy semantics */
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * GlobalLock
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsynctypedef xmlParserInput* FNEXTERNALENTITYLOADER(const char *aURI,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync const char *aID,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsynctypedef FNEXTERNALENTITYLOADER *PFNEXTERNALENTITYLOADER;
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync void setExternalEntityLoader(PFNEXTERNALENTITYLOADER pFunc);
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync static xmlParserInput* callDefaultLoader(const char *aURI,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync const char *aID,
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync /* Obscure class data. */
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsynctypedef std::list<const ElementNode*> ElementNodesList;
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * Node base class. Cannot be used directly, but ElementNode, ContentNode and
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync * AttributeNode derive from this. This does implement useful public methods though.
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync const char* getName() const;
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync bool nameEquals(const char *pcszNamespace, const char *pcsz) const;
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync const char* getValue() const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync typedef enum {IsElement, IsAttribute, IsContent} EnumType;
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync xmlNode *m_plibNode; // != NULL if this is an element or content node
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync xmlAttr *m_plibAttr; // != NULL if this is an attribute node
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync const char *m_pcszNamespacePrefix; // not always set
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync const char *m_pcszNamespaceHref; // full http:// spec
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync const char *m_pcszName; // element or attribute name, points either into plibNode or plibAttr;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync // NULL if this is a content node
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync // hide the default constructor so people use only our factory methods
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync /* Obscure class data */
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync * Node subclass that represents an element.
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync * For elements, Node::getName() returns the element name, and Node::getValue()
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync * returns the text contents, if any.
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync * Since the Node constructor is private, one can create element nodes
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync * only through the following factory methods:
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync * -- Document::createRootElement()
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync * -- ElementNode::createChild()
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync const ElementNode* findChildElement(const char *pcszNamespace,
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync const char *pcszMatch) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync const ElementNode* findChildElement(const char *pcszMatch) const
1d258b8772ee104b5fab3d1743eabc2f5cfe2fa4vboxsync const ElementNode* findChildElementFromId(const char *pcszId) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync const AttributeNode* findAttribute(const char *pcszMatch) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync bool getAttributeValue(const char *pcszMatch, const char *&ppcsz) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync bool getAttributeValue(const char *pcszMatch, iprt::MiniString &str) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync bool getAttributeValuePath(const char *pcszMatch, iprt::MiniString &str) const;
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync bool getAttributeValue(const char *pcszMatch, int32_t &i) const;
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync bool getAttributeValue(const char *pcszMatch, uint32_t &i) const;
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync bool getAttributeValue(const char *pcszMatch, int64_t &i) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync bool getAttributeValue(const char *pcszMatch, uint64_t &i) const;
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync bool getAttributeValue(const char *pcszMatch, bool &f) const;
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync ElementNode* createChild(const char *pcszElementName);
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync ContentNode* addContent(const iprt::MiniString &strContent)
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync AttributeNode* setAttribute(const char *pcszName, const char *pcszValue);
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync AttributeNode* setAttribute(const char *pcszName, const iprt::MiniString &strValue)
df3d4c8e9c81584c535676a3d40c57d868ac61bbvboxsync AttributeNode* setAttributePath(const char *pcszName, const iprt::MiniString &strValue);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync AttributeNode* setAttribute(const char *pcszName, int32_t i);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync AttributeNode* setAttribute(const char *pcszName, uint32_t i);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync AttributeNode* setAttribute(const char *pcszName, int64_t i);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync AttributeNode* setAttribute(const char *pcszName, uint64_t i);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync AttributeNode* setAttributeHex(const char *pcszName, uint32_t i);
ea17f2e36383176db94ff3608f628a1e7432fa60vboxsync AttributeNode* setAttribute(const char *pcszName, bool f);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync // hide the default constructor so people use only our factory methods
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync ElementNode(const ElementNode *pelmRoot, Node *pParent, xmlNode *plibNode);
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync * Node subclass that represents content (non-element text).
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * Since the Node constructor is private, one can create new content nodes
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * only through the following factory methods:
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * -- ElementNode::addContent()
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync // hide the default constructor so people use only our factory methods
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * Node subclass that represents an attribute of an element.
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * For attributes, Node::getName() returns the attribute name, and Node::getValue()
9c59bcefe2993070fafaf0d6cee9673f48479128vboxsync * returns the attribute value, if any.
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * Since the Node constructor is private, one can create new attribute nodes
efbdd9fc22305720d20be7cc37b4f45f43146b09vboxsync * only through the following factory methods:
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * -- ElementNode::setAttribute()
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync // hide the default constructor so people use only our factory methods
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync const char **ppcszKey);
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync AttributeNode(const AttributeNode &x); // no copying
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync * Handy helper class with which one can loop through all or some children
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync * of a particular element. See NodesLoop::forAllNodes() for details.
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync NodesLoop(const ElementNode &node, const char *pcszMatch = NULL);
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync /* Obscure class data */
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync * The XML document class. An instance of this needs to be created by a user
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync * of the XML classes and then passed to
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * -- XmlMemParser or XmlFileParser to read an XML document; those classes then
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * fill the caller's Document with ElementNode, ContentNode and AttributeNode
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync * instances. The typical sequence then is:
13b516eac15d19e108e587a9d9ecc85e1961ac6dvboxsync Document doc;
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync XmlFileParser parser;
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync parser.read("file.xml", doc);
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync Element *pelmRoot = doc.getRootElement();
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync * -- XmlMemWriter or XmlFileWriter to write out an XML document after it has
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync * been created and filled. Example:
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync Document doc;
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync Element *pelmRoot = doc.createRootElement();
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync // add children
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync xml::XmlFileWriter writer(doc);
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync writer.write("file.xml", true);
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync ElementNode* createRootElement(const char *pcszRootElementName,
ae9aaa62489b8ace9ce2a0a15f0b2f7d3be340c6vboxsync /* Obscure class data */
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * XmlParserBase
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * XmlMemParser
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsyncclass RT_DECL_CLASS XmlMemParser : public XmlParserBase
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync void read(const void* pvBuf, size_t cbSize, const iprt::MiniString &strFilename, Document &doc);
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync * XmlFileParser
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsyncclass RT_DECL_CLASS XmlFileParser : public XmlParserBase
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync void read(const iprt::MiniString &strFilename, Document &doc);
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync /* Obscure class data */
76800c2d8e954bb5249d2d30f4af41c6ea03ad5evboxsync static int ReadCallback(void *aCtxt, char *aBuf, int aLen);
8dc3361c3de6b4f38230d57c547ab74b713f6ff1vboxsync * XmlMemParser
XmlMemWriter();
~XmlMemWriter();
void* m_pBuf;
~XmlFileWriter();
static const char * const s_pszTmpSuff;
static const char * const s_pszPrevSuff;
struct Data;
Data *m;
#if defined(_MSC_VER)