- 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.cpp
//
// $Id: //poco/1.4/XML/src/XMLWriter.cpp#3 $
// $Id: //poco/1.4/XML/src/XMLWriter.cpp#5 $
//
// Library: XML
// Package: XML
@@ -321,6 +321,7 @@ void XMLWriter::emptyElement(const XMLString& namespaceURI, const XMLString& loc
_contentWritten = false;
writeMarkup("/");
closeStartTag();
_namespaces.popContext();
}
@@ -617,7 +618,7 @@ void XMLWriter::writeStartElement(const XMLString& namespaceURI, const XMLString
XMLString prefix;
if (!namespaceURI.empty() && !_namespaces.isMapped(namespaceURI))
{
prefix = newPrefix();
prefix = uniquePrefix();
_namespaces.declarePrefix(prefix, namespaceURI);
}
else prefix = _namespaces.getPrefix(namespaceURI);
@@ -702,7 +703,7 @@ void XMLWriter::declareAttributeNamespaces(const Attributes& attributes)
if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI);
if (prefix.empty() && !namespaceURI.empty() && !_namespaces.isMapped(namespaceURI))
{
prefix = newPrefix();
prefix = uniquePrefix();
_namespaces.declarePrefix(prefix, namespaceURI);
}
@@ -882,7 +883,7 @@ std::string XMLWriter::nameToString(const XMLString& localName, const XMLString&
}
XMLString XMLWriter::newPrefix()
XMLString XMLWriter::uniquePrefix()
{
std::ostringstream str;
str << "ns" << ++_prefix;
@@ -890,4 +891,10 @@ XMLString XMLWriter::newPrefix()
}
bool XMLWriter::isNamespaceMapped(const std::string& namespc) const
{
return _namespaces.isMapped(namespc);
}
} } // namespace Poco::XML