projects
/
shibboleth
/
cpp-xmltooling.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Distinguish between visibly used and unused namespaces.
[shibboleth/cpp-xmltooling.git]
/
xmltooling
/
AbstractXMLObject.cpp
diff --git
a/xmltooling/AbstractXMLObject.cpp
b/xmltooling/AbstractXMLObject.cpp
index
58efeda
..
9944a96
100644
(file)
--- a/
xmltooling/AbstractXMLObject.cpp
+++ b/
xmltooling/AbstractXMLObject.cpp
@@
-1,5
+1,5
@@
/*
/*
-* Copyright 2001-20
09
Internet2
+* Copyright 2001-20
10
Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-60,7
+60,8
@@
AbstractXMLObject::AbstractXMLObject(const XMLCh* nsURI, const XMLCh* localName,
addNamespace(Namespace(nsURI, prefix));
if (schemaType) {
m_typeQname = new QName(*schemaType);
addNamespace(Namespace(nsURI, prefix));
if (schemaType) {
m_typeQname = new QName(*schemaType);
- addNamespace(Namespace(m_typeQname->getNamespaceURI(), m_typeQname->getPrefix()));
+ // Attach a non-visibly used namespace.
+ addNamespace(Namespace(m_typeQname->getNamespaceURI(), m_typeQname->getPrefix(), false, false));
}
}
}
}
@@
-133,8
+134,12
@@
void AbstractXMLObject::addNamespace(const Namespace& ns) const
std::set<Namespace>::iterator i = m_namespaces.find(ns);
if (i == m_namespaces.end())
m_namespaces.insert(ns);
std::set<Namespace>::iterator i = m_namespaces.find(ns);
if (i == m_namespaces.end())
m_namespaces.insert(ns);
- else if (ns.alwaysDeclare())
- const_cast<Namespace&>(*i).setAlwaysDeclare(true);
+ else {
+ if (ns.alwaysDeclare())
+ const_cast<Namespace&>(*i).setAlwaysDeclare(true);
+ if (ns.visiblyUsed())
+ const_cast<Namespace&>(*i).setVisiblyUsed(true);
+ }
}
void AbstractXMLObject::removeNamespace(const Namespace& ns)
}
void AbstractXMLObject::removeNamespace(const Namespace& ns)
@@
-196,8
+201,8
@@
QName* AbstractXMLObject::prepareForAssignment(QName* oldValue, const QName* new
if (!oldValue) {
if (newValue) {
releaseThisandParentDOM();
if (!oldValue) {
if (newValue) {
releaseThisandParentDOM();
- Namespace newNamespace(newValue->getNamespaceURI(), newValue->getPrefix());
- addNamespace(
newNamespace
);
+ // Attach a non-visibly used namespace.
+ addNamespace(
Namespace(newValue->getNamespaceURI(), newValue->getPrefix(), false, false)
);
return new QName(*newValue);
}
return NULL;
return new QName(*newValue);
}
return NULL;
@@
-206,8
+211,8
@@
QName* AbstractXMLObject::prepareForAssignment(QName* oldValue, const QName* new
delete oldValue;
releaseThisandParentDOM();
if (newValue) {
delete oldValue;
releaseThisandParentDOM();
if (newValue) {
- Namespace newNamespace(newValue->getNamespaceURI(), newValue->getPrefix());
- addNamespace(
newNamespace
);
+ // Attach a non-visibly used namespace.
+ addNamespace(
Namespace(newValue->getNamespaceURI(), newValue->getPrefix(), false, false)
);
return new QName(*newValue);
}
return NULL;
return new QName(*newValue);
}
return NULL;