01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.dom;
20:
21: import org.w3c.dom.DOMException;
22: import org.w3c.dom.Node;
23:
24: /**
25: * This class implements the {@link org.w3c.dom.Attr} interface with
26: * support for namespaces.
27: *
28: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
29: * @version $Id: GenericAttrNS.java 475685 2006-11-16 11:16:05Z cam $
30: */
31: public class GenericAttrNS extends AbstractAttrNS {
32:
33: /**
34: * Is this attribute immutable?
35: */
36: protected boolean readonly;
37:
38: /**
39: * Creates a new Attr object.
40: */
41: protected GenericAttrNS() {
42: }
43:
44: /**
45: * Creates a new Attr object.
46: * @param nsURI The element namespace URI.
47: * @param qname The attribute qualified name for validation purposes.
48: * @param owner The owner document.
49: * @exception DOMException
50: * INVALID_CHARACTER_ERR: Raised if the specified qualified name
51: * contains an illegal character.
52: * <br> NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
53: * malformed, if the <code>qualifiedName</code> has a prefix and the
54: * <code>namespaceURI</code> is <code>null</code> or an empty string,
55: * if the <code>qualifiedName</code> has a prefix that is "xml" and the
56: * <code>namespaceURI</code> is different from
57: * "http://www.w3.org/XML/1998/namespace", if the
58: * <code>qualifiedName</code> has a prefix that is "xmlns" and the
59: * <code>namespaceURI</code> is different from
60: * "http://www.w3.org/2000/xmlns/", or if the <code>qualifiedName</code>
61: * is "xmlns" and the <code>namespaceURI</code> is different from
62: * "http://www.w3.org/2000/xmlns/".
63: */
64: public GenericAttrNS(String nsURI, String qname,
65: AbstractDocument owner) throws DOMException {
66: super (nsURI, qname, owner);
67: setNodeName(qname);
68: }
69:
70: /**
71: * Tests whether this node is readonly.
72: */
73: public boolean isReadonly() {
74: return readonly;
75: }
76:
77: /**
78: * Sets this node readonly attribute.
79: */
80: public void setReadonly(boolean v) {
81: readonly = v;
82: }
83:
84: /**
85: * Returns a new uninitialized instance of this object's class.
86: */
87: protected Node newNode() {
88: return new GenericAttrNS();
89: }
90: }
|