+ m_noNamespaceSchemaLocation(XMLString::replicate(src.m_noNamespaceSchemaLocation)), m_nil(src.m_nil),
+ m_parent(nullptr), m_elementQname(src.m_elementQname),
+ m_typeQname(src.m_typeQname.get() ? new QName(*src.m_typeQname) : nullptr)
+{
+}
+
+AbstractXMLObject::~AbstractXMLObject()
+{
+ xercesc::XMLString::release(&m_schemaLocation);
+ xercesc::XMLString::release(&m_noNamespaceSchemaLocation);
+}
+
+void AbstractXMLObject::detach()
+{
+ if (!getParent())
+ return;
+ else if (getParent()->hasParent())
+ throw XMLObjectException("Cannot detach an object whose parent is itself a child.");
+
+ // Pull ourselves out of the parent and then blast him.
+ getParent()->removeChild(this);
+ delete m_parent;
+ m_parent = nullptr;
+}
+
+const QName& AbstractXMLObject::getElementQName() const
+{
+ return m_elementQname;
+}
+
+const set<Namespace>& AbstractXMLObject::getNamespaces() const
+{
+ return m_namespaces;
+}
+
+void XMLObject::setNil(const XMLCh* value)
+{
+ if (value) {
+ switch (*value) {
+ case xercesc::chLatin_t:
+ nil(xmlconstants::XML_BOOL_TRUE);
+ break;
+ case xercesc::chLatin_f:
+ nil(xmlconstants::XML_BOOL_FALSE);
+ break;
+ case xercesc::chDigit_1:
+ nil(xmlconstants::XML_BOOL_ONE);
+ break;
+ case xercesc::chDigit_0:
+ nil(xmlconstants::XML_BOOL_ZERO);
+ break;
+ default:
+ nil(xmlconstants::XML_BOOL_NULL);
+ }
+ }
+ else {
+ nil(xmlconstants::XML_BOOL_NULL);
+ }
+}
+
+void AbstractXMLObject::addNamespace(const Namespace& ns) const
+{
+ for (set<Namespace>::const_iterator n = m_namespaces.begin(); n != m_namespaces.end(); ++n) {
+ // Look for the prefix in the existing set.
+ if (XMLString::equals(ns.getNamespacePrefix(), n->getNamespacePrefix())) {
+ // See if it's the same declaration, and overlay various properties if so.
+ if (XMLString::equals(ns.getNamespaceURI(), n->getNamespaceURI())) {
+ if (ns.alwaysDeclare())
+ const_cast<Namespace&>(*n).setAlwaysDeclare(true);
+ switch (ns.usage()) {
+ case Namespace::Indeterminate:
+ break;
+ case Namespace::VisiblyUsed:
+ const_cast<Namespace&>(*n).setUsage(Namespace::VisiblyUsed);
+ break;
+ case Namespace::NonVisiblyUsed:
+ if (n->usage() == Namespace::Indeterminate)
+ const_cast<Namespace&>(*n).setUsage(Namespace::NonVisiblyUsed);
+ break;
+ }
+ }
+ return;
+ }
+ }
+
+ // If the prefix is now, go ahead and add it.
+ m_namespaces.insert(ns);
+}
+
+void AbstractXMLObject::removeNamespace(const Namespace& ns)
+{
+ m_namespaces.erase(ns);
+}
+
+const QName* AbstractXMLObject::getSchemaType() const