/*
-* Copyright 2001-2007 Internet2
+* Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
xercesc::XMLString::release(&m_noNamespaceSchemaLocation);
}
-void XMLObject::setNil(const XMLCh* value) {
+void XMLObject::setNil(const XMLCh* value)
+{
if (value) {
switch (*value) {
case xercesc::chLatin_t:
}
}
+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);
+ else if (ns.alwaysDeclare())
+ const_cast<Namespace&>(*i).setAlwaysDeclare(true);
+}
+
XMLCh* AbstractXMLObject::prepareForAssignment(XMLCh* oldValue, const XMLCh* newValue)
{
if (!XMLString::equals(oldValue,newValue)) {
/*
-* Copyright 2001-2007 Internet2
+* Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return m_namespaces;
}
- void addNamespace(const Namespace& ns) const {
- 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);
- }
+ void addNamespace(const Namespace& ns) const;
void removeNamespace(const Namespace& ns) {
m_namespaces.erase(ns);
/*
-* Copyright 2001-2007 Internet2
+* Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const XMLCh* prefix=ns.getNamespacePrefix();
const XMLCh* uri=ns.getNamespaceURI();
+ // Check for xmlns:xml.
+ if (XMLString::equals(prefix, XML_PREFIX) && XMLString::equals(uri, XML_NS))
+ return;
+
// Check to see if the prefix is already declared properly above this node.
if (!ns.alwaysDeclare()) {
const XMLCh* declared=lookupNamespaceURI(domElement->getParentNode(),prefix);
XMLString::catString(xmlns,colon);
XMLString::catString(xmlns,prefix);
domElement->setAttributeNS(XMLNS_NS, xmlns, uri);
- XMLString::release(&xmlns);
+ delete[] xmlns;
}
else {
domElement->setAttributeNS(XMLNS_NS, XMLNS_PREFIX, uri);
/*
-* Copyright 2001-2007 Internet2
+* Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (XMLString::equals(attribute->getLocalName(),XMLNS_PREFIX)) {
m_log.debug("found default namespace declaration, adding it to the list of namespaces on the XMLObject");
addNamespace(Namespace(attribute->getValue(), NULL, true));
- continue;
+ }
+ else if (XMLString::equals(attribute->getLocalName(),XML_PREFIX) && XMLString::equals(attribute->getNodeValue(),XML_NS)) {
+ m_log.debug("found standard xml prefix declaration, ignoring as superfluous");
}
else {
m_log.debug("found namespace declaration, adding it to the list of namespaces on the XMLObject");
addNamespace(Namespace(attribute->getValue(), attribute->getLocalName(), true));
- continue;
}
+ continue;
}
else if (XMLString::equals(nsuri,XSI_NS)) {
static const XMLCh type[]= UNICODE_LITERAL_4(t,y,p,e);