2 * Copyright 2001-2007 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 * Advanced anyType implementation suitable for deep processing of unknown content.
24 #include "exceptions.h"
25 #include "impl/AnyElement.h"
27 #include "util/XMLHelper.h"
29 #include <xercesc/util/XMLUniDefs.hpp>
31 using namespace xmltooling;
34 XMLObject* AnyElementImpl::clone() const {
35 auto_ptr<XMLObject> domClone(AbstractDOMCachingXMLObject::clone());
36 AnyElementImpl* ret=dynamic_cast<AnyElementImpl*>(domClone.get());
42 return new AnyElementImpl(*this);
45 AnyElementImpl::AnyElementImpl(const AnyElementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src),
46 AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src) {
47 const vector<XMLObject*>& children = src.getUnknownXMLObjects();
48 for (vector<XMLObject*>::const_iterator i=children.begin(); i!=children.end(); ++i)
49 getUnknownXMLObjects().push_back((*i)->clone());
52 void AnyElementImpl::marshallAttributes(DOMElement* domElement) const {
53 marshallExtensionAttributes(domElement);
56 void AnyElementImpl::processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
57 getUnknownXMLObjects().push_back(childXMLObject);
60 void AnyElementImpl::processAttribute(const DOMAttr* attribute) {
61 unmarshallExtensionAttribute(attribute);
64 XMLObject* AnyElementBuilder::buildObject(
65 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType
67 return new AnyElementImpl(nsURI, localName, prefix, schemaType);