mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
propagating qualified name changes
This commit is contained in:
parent
4af8e6472e
commit
e33535905a
1 changed files with 19 additions and 13 deletions
|
@ -140,6 +140,8 @@ class libxml2_wrapper :
|
||||||
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
||||||
typedef typename XMLReaderT::template Property<declHandlerT*> getDeclHandlerT;
|
typedef typename XMLReaderT::template Property<declHandlerT*> getDeclHandlerT;
|
||||||
typedef typename XMLReaderT::template Property<declHandlerT&> setDeclHandlerT;
|
typedef typename XMLReaderT::template Property<declHandlerT&> setDeclHandlerT;
|
||||||
|
typedef XML::QualifiedName<string_type, string_adaptor> qualifiedNameT;
|
||||||
|
|
||||||
libxml2_wrapper();
|
libxml2_wrapper();
|
||||||
~libxml2_wrapper();
|
~libxml2_wrapper();
|
||||||
|
|
||||||
|
@ -203,7 +205,7 @@ class libxml2_wrapper :
|
||||||
virtual void SAXentityDecl(const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content);
|
virtual void SAXentityDecl(const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content);
|
||||||
virtual xmlParserInputPtr SAXresolveEntity(const xmlChar* publicId, const xmlChar* systemId);
|
virtual xmlParserInputPtr SAXresolveEntity(const xmlChar* publicId, const xmlChar* systemId);
|
||||||
|
|
||||||
typename NamespaceSupport<string_type, string_adaptor>::Parts processName(const string_type& qName, bool isAttribute);
|
qualifiedNameT processName(const string_type& qName, bool isAttribute);
|
||||||
void reportError(const std::string& message, bool fatal = false);
|
void reportError(const std::string& message, bool fatal = false);
|
||||||
void checkNotParsing(const string_type& type, const string_type& name) const;
|
void checkNotParsing(const string_type& type, const string_type& name) const;
|
||||||
|
|
||||||
|
@ -375,11 +377,10 @@ void libxml2_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name
|
||||||
} // doSetProperty
|
} // doSetProperty
|
||||||
|
|
||||||
template<class string_type, class T0, class T1>
|
template<class string_type, class T0, class T1>
|
||||||
typename SAX::NamespaceSupport<string_type, typename libxml2_wrapper<string_type, T0, T1>::string_adaptor>::Parts libxml2_wrapper<string_type, T0, T1>::processName(const string_type& qName, bool isAttribute)
|
typename XML::QualifiedName<string_type, typename libxml2_wrapper<string_type, T0, T1>::string_adaptor> libxml2_wrapper<string_type, T0, T1>::processName(const string_type& qName, bool isAttribute)
|
||||||
{
|
{
|
||||||
typename NamespaceSupport<string_type, string_adaptor>::Parts p =
|
qualifiedNameT p = nsSupport_.processName(qName, isAttribute);
|
||||||
nsSupport_.processName(qName, isAttribute);
|
if(string_adaptor::empty(p.namespaceUri()) && !string_adaptor::empty(p.prefix()))
|
||||||
if(string_adaptor::empty(p.URI) && !string_adaptor::empty(p.prefix))
|
|
||||||
reportError(std::string("Undeclared prefix ") + string_adaptor::asStdString(qName));
|
reportError(std::string("Undeclared prefix ") + string_adaptor::asStdString(qName));
|
||||||
return p;
|
return p;
|
||||||
} // processName
|
} // processName
|
||||||
|
@ -580,10 +581,10 @@ void libxml2_wrapper<string_type, T0, T1>::SAXstartElement(const xmlChar* qName,
|
||||||
// declaration?
|
// declaration?
|
||||||
if(string_adaptor::find(attQName, nsc_.xmlns) != 0)
|
if(string_adaptor::find(attQName, nsc_.xmlns) != 0)
|
||||||
{
|
{
|
||||||
typename NamespaceSupport<string_type, string_adaptor>::Parts attName = processName(attQName, true);
|
qualifiedNameT attName = processName(attQName, true);
|
||||||
attributes.addAttribute(attName.URI,
|
attributes.addAttribute(attName.namespaceUri(),
|
||||||
attName.localName,
|
attName.localName(),
|
||||||
attName.rawName,
|
attName.rawName(),
|
||||||
attributeTypeT::CDATA,
|
attributeTypeT::CDATA,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
@ -591,8 +592,11 @@ void libxml2_wrapper<string_type, T0, T1>::SAXstartElement(const xmlChar* qName,
|
||||||
} // if ...
|
} // if ...
|
||||||
|
|
||||||
// at last! report the event
|
// at last! report the event
|
||||||
typename NamespaceSupport<string_type, string_adaptor>::Parts name = processName(string_adaptor::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
qualifiedNameT name = processName(string_adaptor::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
||||||
contentHandler_->startElement(name.URI, name.localName, name.rawName, attributes);
|
contentHandler_->startElement(name.namespaceUri(),
|
||||||
|
name.localName(),
|
||||||
|
name.rawName(),
|
||||||
|
attributes);
|
||||||
} // SAXstartElement
|
} // SAXstartElement
|
||||||
|
|
||||||
template<class string_type, class T0, class T1>
|
template<class string_type, class T0, class T1>
|
||||||
|
@ -630,8 +634,10 @@ void libxml2_wrapper<string_type, T0, T1>::SAXendElement(const xmlChar* qName)
|
||||||
return;
|
return;
|
||||||
} // if(!namespaces_)
|
} // if(!namespaces_)
|
||||||
|
|
||||||
typename NamespaceSupport<string_type, string_adaptor>::Parts name = processName(string_adaptor::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
qualifiedNameT name = processName(string_adaptor::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
||||||
contentHandler_->endElement(name.URI, name.localName, name.rawName);
|
contentHandler_->endElement(name.namespaceUri(),
|
||||||
|
name.localName(),
|
||||||
|
name.rawName());
|
||||||
typename NamespaceSupport<string_type, string_adaptor>::stringListT prefixes = nsSupport_.getDeclaredPrefixes();
|
typename NamespaceSupport<string_type, string_adaptor>::stringListT prefixes = nsSupport_.getDeclaredPrefixes();
|
||||||
for(size_t i = 0, end = prefixes.size(); i < end; ++i)
|
for(size_t i = 0, end = prefixes.size(); i < end; ++i)
|
||||||
contentHandler_->endPrefixMapping(prefixes[i]);
|
contentHandler_->endPrefixMapping(prefixes[i]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue