#ifndef ARABICA_XSLT_STYLESHEETPARSER_HPP #define ARABICA_XSLT_STYLESHEETPARSER_HPP #include #include #include namespace Arabica { namespace XSLT { class StylesheetParser { public: StylesheetParser() { } void setContentHandler(SAX::ContentHandler& handler) { namespace_tracker_.setContentHandler(handler); } // setContentHandler SAX::ContentHandler& contentHandler() { return text_coalescer_; } // contentHandler void parse(SAX::InputSource& source) { SAX::XMLReader base_parser; text_coalescer_.setParent(base_parser); xmlbase_tracker_.setParent(text_coalescer_); namespace_tracker_.setParent(xmlbase_tracker_); namespace_tracker_.parse(source); } // parse std::string namespaceURI(const std::string& prefix) const { return namespace_tracker_.getURI(prefix); } // namespaceURI std::pair processQName(const std::string& qName) const { return namespace_tracker_.process(qName); } // processQName std::map inScopeNamespaces() const { return namespace_tracker_.inScopeNamespaces(); } // inScopeNamespaces std::string setBase(const std::string& loc) { std::string current = currentBase(); xmlbase_tracker_.setDocumentLocation(loc); return current; } // setBase std::string currentBase() const { return xmlbase_tracker_.currentBase(); } // currentBase std::string makeAbsolute(const std::string& href) { return xmlbase_tracker_.makeAbsolute(href); } // makeAbsolute private: SAX::TextCoalescer text_coalescer_; SAX::XMLBaseTracker xmlbase_tracker_; SAX::NamespaceTracker namespace_tracker_; StylesheetParser(const StylesheetParser&); StylesheetParser operator=(const StylesheetParser&); bool operator==(const StylesheetParser&); }; // class StylesheetParser } // namespace XSLT } // namespace Arabica #endif // ARABICA_XSLT_STYLESHEETPARSER_HPP