mirror of
https://github.com/jezhiggins/arabica
synced 2024-11-17 07:48:50 +01:00
fixes to namespace processing
This commit is contained in:
parent
a067295ae1
commit
02bbe4c6e6
1 changed files with 13 additions and 22 deletions
|
@ -510,16 +510,16 @@ void libxml2_wrapper<stringT, string_adaptorT>::SAXstartElement(const xmlChar* q
|
|||
|
||||
// OK we're doing Namespaces
|
||||
nsSupport_.pushContext();
|
||||
bool seenDecl = false;
|
||||
SAX::basic_AttributesImpl<stringT> attributes;
|
||||
|
||||
// take a first pass and copy all the attributes, noting any declarations
|
||||
if(atts && *atts != 0)
|
||||
{
|
||||
while(*atts != 0)
|
||||
const xmlChar** a1 = atts;
|
||||
while(*a1 != 0)
|
||||
{
|
||||
stringT attQName = SA_.makeStringT(reinterpret_cast<const char*>(*atts++));
|
||||
stringT value = SA_.makeStringT(reinterpret_cast<const char*>(*atts++));
|
||||
stringT attQName = SA_.makeStringT(reinterpret_cast<const char*>(*a1++));
|
||||
stringT value = SA_.makeStringT(reinterpret_cast<const char*>(*a1++));
|
||||
|
||||
// declaration?
|
||||
if(attQName.find(nsc_.xmlns) == 0)
|
||||
|
@ -537,9 +537,16 @@ void libxml2_wrapper<stringT, string_adaptorT>::SAXstartElement(const xmlChar* q
|
|||
attQName,
|
||||
emptyString_,
|
||||
value);
|
||||
seenDecl = true;
|
||||
}
|
||||
else
|
||||
} // while
|
||||
|
||||
while(*atts != 0)
|
||||
{
|
||||
stringT attQName = SA_.makeStringT(reinterpret_cast<const char*>(*atts++));
|
||||
stringT value = SA_.makeStringT(reinterpret_cast<const char*>(*atts++));
|
||||
|
||||
// declaration?
|
||||
if(attQName.find(nsc_.xmlns) != 0)
|
||||
{
|
||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts attName = processName(attQName, true);
|
||||
attributes.addAttribute(attName.URI, attName.localName, attName.rawName, emptyString_, value);
|
||||
|
@ -547,22 +554,6 @@ void libxml2_wrapper<stringT, string_adaptorT>::SAXstartElement(const xmlChar* q
|
|||
} // while ...
|
||||
} // if ...
|
||||
|
||||
// if there was a Namespace decl we have to go around again
|
||||
if(seenDecl)
|
||||
{
|
||||
int length = attributes.getLength();
|
||||
for(int i = 0; i < length; ++i)
|
||||
{
|
||||
stringT attQName = attributes.getQName(i);
|
||||
if(attQName.find(nsc_.xmlns))
|
||||
{
|
||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts attName = processName(attQName, true);
|
||||
attributes.setURI(i, attName.URI);
|
||||
attributes.setLocalName(i, attName.localName);
|
||||
} // if ...
|
||||
} // for ...
|
||||
} // if(seenDecl)
|
||||
|
||||
// at last! report the event
|
||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts name = processName(SA_.makeStringT(reinterpret_cast<const char*>(qName)), false);
|
||||
contentHandler_->startElement(name.URI, name.localName, name.rawName, attributes);
|
||||
|
|
Loading…
Reference in a new issue