X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2FXMLObjectBuilder.cpp;h=ec08c163f6312cf94dd8084afd870e352bf023d2;hb=c73d95072f73521bd4b881214631c59adf79f41a;hp=c8eeda88298d0d2a263172661adaeec7e8b606e6;hpb=bd026f07e729e66127b3efd48aee443fba815af3;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/XMLObjectBuilder.cpp b/xmltooling/XMLObjectBuilder.cpp index c8eeda8..ec08c16 100644 --- a/xmltooling/XMLObjectBuilder.cpp +++ b/xmltooling/XMLObjectBuilder.cpp @@ -1,17 +1,21 @@ -/* - * 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. - * You may obtain a copy of the License at +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + * + * UCAID licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the + * License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** @@ -34,7 +38,7 @@ using xercesc::DOMDocument; using xercesc::DOMElement; map XMLObjectBuilder::m_map; -XMLObjectBuilder* XMLObjectBuilder::m_default=NULL; +XMLObjectBuilder* XMLObjectBuilder::m_default = nullptr; XMLObjectBuilder::XMLObjectBuilder() { @@ -51,8 +55,9 @@ XMLObject* XMLObjectBuilder::buildFromQName(const QName& q) const XMLObject* XMLObjectBuilder::buildFromElement(DOMElement* element, bool bindDocument) const { + auto_ptr schemaType(XMLHelper::getXSIType(element)); auto_ptr ret( - buildObject(element->getNamespaceURI(),element->getLocalName(),element->getPrefix(),XMLHelper::getXSIType(element)) + buildObject(element->getNamespaceURI(),element->getLocalName(),element->getPrefix(),schemaType.get()) ); ret->unmarshall(element,bindDocument); return ret.release(); @@ -66,13 +71,13 @@ XMLObject* XMLObjectBuilder::buildFromDocument(DOMDocument* doc, bool bindDocume XMLObject* XMLObjectBuilder::buildOneFromElement(xercesc::DOMElement* element, bool bindDocument) { const XMLObjectBuilder* b=getBuilder(element); - return b ? b->buildFromElement(element,bindDocument) : NULL; + return b ? b->buildFromElement(element,bindDocument) : nullptr; } const XMLObjectBuilder* XMLObjectBuilder::getBuilder(const QName& key) { map::const_iterator i=m_map.find(key); - return (i==m_map.end()) ? NULL : i->second; + return (i==m_map.end()) ? nullptr : i->second; } const XMLObjectBuilder* XMLObjectBuilder::getBuilder(const DOMElement* domElement) @@ -83,7 +88,7 @@ const XMLObjectBuilder* XMLObjectBuilder::getBuilder(const DOMElement* domElemen Category& log=Category::getInstance(XMLTOOLING_LOGCAT".XMLObject.Builder"); auto_ptr schemaType(XMLHelper::getXSIType(domElement)); - const XMLObjectBuilder* xmlObjectBuilder = schemaType.get() ? getBuilder(*(schemaType.get())) : NULL; + const XMLObjectBuilder* xmlObjectBuilder = schemaType.get() ? getBuilder(*(schemaType.get())) : nullptr; if (xmlObjectBuilder) { if (log.isDebugEnabled()) { log.debug("located XMLObjectBuilder for schema type: %s", schemaType->toString().c_str()); @@ -137,7 +142,7 @@ void XMLObjectBuilder::deregisterBuilder(const QName& builderKey) void XMLObjectBuilder::deregisterDefaultBuilder() { delete m_default; - m_default=NULL; + m_default = nullptr; } void XMLObjectBuilder::destroyBuilders()