1 /*
2 * Copyright 2008 Members of the EGEE Collaboration.
3 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.opensaml.xml;
19
20 import java.util.Collections;
21 import java.util.List;
22
23 import javax.xml.namespace.QName;
24
25 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
26 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
27
28 /**
29 * AbstractElementExtensible is an element of type <code>xs:any</code>, but without <code>xs:anyAttribute</code>
30 * attribute or text content.
31 */
32 public abstract class AbstractElementExtensibleXMLObject extends AbstractValidatingXMLObject implements
33 ElementExtensibleXMLObject {
34
35 /** xs:any {@link XMLObject} child elements. */
36 private IndexedXMLObjectChildrenList<XMLObject> anyXMLObjects;
37
38 /**
39 * Constructor.
40 *
41 * @param namespaceURI the namespace the element is in
42 * @param elementLocalName the local name of the XML element this Object represents
43 * @param namespacePrefix the prefix for the given namespace
44 */
45 public AbstractElementExtensibleXMLObject(String namespaceURI, String elementLocalName, String namespacePrefix) {
46 super(namespaceURI, elementLocalName, namespacePrefix);
47 anyXMLObjects = new IndexedXMLObjectChildrenList<XMLObject>(this);
48 }
49
50 /** {@inheritDoc} */
51 public List<XMLObject> getOrderedChildren() {
52 return Collections.unmodifiableList(anyXMLObjects);
53 }
54
55 /** {@inheritDoc} */
56 public List<XMLObject> getUnknownXMLObjects() {
57 return anyXMLObjects;
58 }
59
60 /** {@inheritDoc} */
61 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
62 return (List<XMLObject>) anyXMLObjects.subList(typeOrName);
63 }
64 }