- added Poco::XML::XMLWriter::depth() member function.

- added Poco::XML::XMLWriter::uniquePrefix() and Poco::XML::XMLWriter::isNamespaceMapped().
- Poco::FileChannel now supports a new rotateOnOpen property (true/false) which can be used
  to force rotation of the log file when it's opened.
- fixed a bug in Poco::XML::XMLWriter::emptyElement(): need to pop namespace context
This commit is contained in:
Guenter Obiltschnig
2012-11-10 11:49:39 +01:00
parent a628c56a01
commit 80c45c859d
2 changed files with 39 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
//
// XMLWriter.h
//
// $Id: //poco/1.4/XML/include/Poco/XML/XMLWriter.h#1 $
// $Id: //poco/1.4/XML/include/Poco/XML/XMLWriter.h#3 $
//
// Library: XML
// Package: XML
@@ -279,6 +279,24 @@ public:
static const std::string NEWLINE_CRLF;
static const std::string NEWLINE_LF;
// Namespace support.
XMLString uniquePrefix();
/// Creates and returns a unique namespace prefix that
/// can be used with startPrefixMapping().
bool isNamespaceMapped(const std::string& namespc) const;
/// Returns true if the given namespace has been mapped
/// to a prefix in the current element or its ancestors.
// Misc.
int depth() const;
/// Return the number of nested XML elements.
///
/// Will be -1 if no document or fragment has been started,
/// 0 if the document or fragment has been started,
/// 1 if the document element has been written and
/// > 1 for every element nested within the document element.
protected:
typedef std::map<XMLString, XMLString> AttributeMap;
@@ -298,7 +316,6 @@ protected:
void addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI);
void writeAttributes(const AttributeMap& attributeMap);
void prettyPrint() const;
XMLString newPrefix();
static std::string nameToString(const XMLString& localName, const XMLString& qname);
private:
@@ -357,6 +374,15 @@ private:
};
//
// inlines
//
inline int XMLWriter::depth() const
{
return _depth;
}
} } // namespace Poco::XML