mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +01:00
fix segfault using MSXML
This commit is contained in:
parent
4e7340caff
commit
a1ed87da31
15 changed files with 24 additions and 37 deletions
|
@ -47,9 +47,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:apply-imports");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:apply-imports element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -83,9 +83,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:apply-templates");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:apply-templates element can only contain xsl:sort and xsl:with-param elements.");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
return;
|
return;
|
||||||
} // if(localName == "with-param")
|
} // if(localName == "with-param")
|
||||||
|
|
||||||
throw SAX::SAXException("xsl:apply-templates can only contain xsl:sort and xsl:with-param elements.");
|
throw SAX::SAXException("xsl:call-template can only contain xsl:sort and xsl:with-param elements.");
|
||||||
} // startElement
|
} // startElement
|
||||||
|
|
||||||
virtual void endElement(const std::string& /* namespaceURI */,
|
virtual void endElement(const std::string& /* namespaceURI */,
|
||||||
|
|
|
@ -146,9 +146,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:choose");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:choose element may not contain text. Only xsl:when and xsl:otherwise are allowed");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -67,9 +67,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:copy-of");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:copy-of element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "xslt_constants.hpp"
|
#include "xslt_constants.hpp"
|
||||||
#include "xslt_value_validation.hpp"
|
|
||||||
|
|
||||||
namespace Arabica
|
namespace Arabica
|
||||||
{
|
{
|
||||||
|
@ -104,7 +103,7 @@ public:
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
if(no_content_)
|
if(no_content_)
|
||||||
throw SAX::SAXException("xsl:include/xsl:import must be empty");
|
verifyNoCharacterData(ch, "xsl:include/xsl:import");
|
||||||
context_->parentHandler().characters(ch);
|
context_->parentHandler().characters(ch);
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "xslt_create_handler.hpp"
|
#include "xslt_create_handler.hpp"
|
||||||
#include "../xslt_text.hpp"
|
#include "../xslt_text.hpp"
|
||||||
#include "xslt_value_validation.hpp"
|
|
||||||
|
|
||||||
namespace Arabica
|
namespace Arabica
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,9 +49,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:key");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:key element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -61,9 +61,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:namespace-alias");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:namespace-alias element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef ARABICA_XSLT_OUTPUT_HANDLER_HPP
|
#ifndef ARABICA_XSLT_OUTPUT_HANDLER_HPP
|
||||||
#define ARABICA_XSLT_OUTPUT_HANDLER_HPP
|
#define ARABICA_XSLT_OUTPUT_HANDLER_HPP
|
||||||
|
|
||||||
#include "xslt_value_validation.hpp"
|
|
||||||
|
|
||||||
namespace Arabica
|
namespace Arabica
|
||||||
{
|
{
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
|
@ -54,9 +52,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:output");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:output element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -67,9 +67,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:sort");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:sort element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -48,9 +48,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator i = ch.begin(), e = ch.end(); i != e; ++i)
|
verifyNoCharacterData(ch, "xsl:value-of");
|
||||||
if(!Arabica::XML::is_space(*i))
|
|
||||||
throw SAX::SAXException("xsl:value-of element must be empty");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -89,6 +89,17 @@ std::map<std::string, std::string> gatherAttributes(const std::string& parentEle
|
||||||
return results;
|
return results;
|
||||||
} // validateAttributes
|
} // validateAttributes
|
||||||
|
|
||||||
|
void verifyNoCharacterData(const std::string& ch,
|
||||||
|
const std::string& name)
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
for(std::string::const_iterator i = ch.begin(), e = ch.end(); ok && i != e; ++i)
|
||||||
|
ok = Arabica::XML::is_space(*i);
|
||||||
|
|
||||||
|
if(!ok)
|
||||||
|
throw SAX::SAXException(name + " element can not contain character data.");
|
||||||
|
} // verifyNoCharacterContent
|
||||||
|
|
||||||
} // namespace XSLT
|
} // namespace XSLT
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define ARABICA_XSLT_SORT_HPP
|
#define ARABICA_XSLT_SORT_HPP
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "handler/xslt_value_validation.hpp"
|
|
||||||
|
|
||||||
namespace Arabica
|
namespace Arabica
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "xslt_stylesheet_parser.hpp"
|
#include "xslt_stylesheet_parser.hpp"
|
||||||
#include "xslt_compiled_stylesheet.hpp"
|
#include "xslt_compiled_stylesheet.hpp"
|
||||||
#include "xslt_compilation_context.hpp"
|
#include "xslt_compilation_context.hpp"
|
||||||
|
#include "handler/xslt_value_validation.hpp"
|
||||||
#include "handler/xslt_template_handler.hpp"
|
#include "handler/xslt_template_handler.hpp"
|
||||||
#include "handler/xslt_include_handler.hpp"
|
#include "handler/xslt_include_handler.hpp"
|
||||||
#include "handler/xslt_output_handler.hpp"
|
#include "handler/xslt_output_handler.hpp"
|
||||||
|
@ -67,9 +68,7 @@ public:
|
||||||
|
|
||||||
virtual void characters(const std::string& ch)
|
virtual void characters(const std::string& ch)
|
||||||
{
|
{
|
||||||
for(std::string::const_iterator s = ch.begin(), e = ch.end(); s != e; ++s)
|
verifyNoCharacterData(ch, "xsl:stylesheet/xsl:transform");
|
||||||
if(!Arabica::XML::is_space(*s))
|
|
||||||
throw SAX::SAXException("stylesheet element can not contain character data :'" + ch +"'");
|
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
virtual void endDocument()
|
virtual void endDocument()
|
||||||
|
|
Loading…
Reference in a new issue