mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-25 10:09:36 +02:00
- 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user