~ubuntu-branches/ubuntu/karmic/libxerces2-java/karmic

« back to all changes in this revision

Viewing changes to src/org/apache/xerces/dom/DocumentTypeImpl.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-12-04 17:37:55 UTC
  • mfrom: (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20061204173755-hb6ybrrrk097zhx7
Tags: 2.8.1-1ubuntu1
* Merge with Debian unstable; remaining changes:
  - Build -gcj package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * The Apache Software License, Version 1.1
3
 
 *
4
 
 *
5
 
 * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
6
 
 * reserved.
7
 
 *
8
 
 * Redistribution and use in source and binary forms, with or without
9
 
 * modification, are permitted provided that the following conditions
10
 
 * are met:
11
 
 *
12
 
 * 1. Redistributions of source code must retain the above copyright
13
 
 *    notice, this list of conditions and the following disclaimer. 
14
 
 *
15
 
 * 2. Redistributions in binary form must reproduce the above copyright
16
 
 *    notice, this list of conditions and the following disclaimer in
17
 
 *    the documentation and/or other materials provided with the
18
 
 *    distribution.
19
 
 *
20
 
 * 3. The end-user documentation included with the redistribution,
21
 
 *    if any, must include the following acknowledgment:  
22
 
 *       "This product includes software developed by the
23
 
 *        Apache Software Foundation (http://www.apache.org/)."
24
 
 *    Alternately, this acknowledgment may appear in the software itself,
25
 
 *    if and wherever such third-party acknowledgments normally appear.
26
 
 *
27
 
 * 4. The names "Xerces" and "Apache Software Foundation" must
28
 
 *    not be used to endorse or promote products derived from this
29
 
 *    software without prior written permission. For written 
30
 
 *    permission, please contact apache@apache.org.
31
 
 *
32
 
 * 5. Products derived from this software may not be called "Apache",
33
 
 *    nor may "Apache" appear in their name, without prior written
34
 
 *    permission of the Apache Software Foundation.
35
 
 *
36
 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37
 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38
 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
 
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40
 
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42
 
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43
 
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44
 
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45
 
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46
 
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47
 
 * SUCH DAMAGE.
48
 
 * ====================================================================
49
 
 *
50
 
 * This software consists of voluntary contributions made by many
51
 
 * individuals on behalf of the Apache Software Foundation and was
52
 
 * originally based on software copyright (c) 1999, International
53
 
 * Business Machines, Inc., http://www.apache.org.  For more
54
 
 * information on the Apache Software Foundation, please see
55
 
 * <http://www.apache.org/>.
 
2
 * Copyright 1999-2002,2004,2006 The Apache Software Foundation.
 
3
 * 
 
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
 
7
 * 
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 * 
 
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.
56
15
 */
57
16
 
58
17
package org.apache.xerces.dom;
61
20
import org.w3c.dom.DocumentType;
62
21
import org.w3c.dom.Node;
63
22
import org.w3c.dom.NamedNodeMap;
 
23
import java.util.Hashtable;
 
24
import org.w3c.dom.UserDataHandler;
64
25
 
65
26
/**
66
27
 * This class represents a Document Type <em>declaraction</em> in
78
39
 * Most notably, absolutely no provision was made for storing
79
40
 * and using Element and Attribute information. Nor was the linkage
80
41
 * between Entities and Entity References nailed down solidly.
 
42
 * 
 
43
 * @xerces.internal
81
44
 *
82
45
 * @author Arnaud  Le Hors, IBM
83
46
 * @author Joe Kesselman, IBM
84
47
 * @author Andy Clark, IBM
85
 
 * @version $Id: DocumentTypeImpl.java,v 1.25 2004/01/16 16:23:50 elena Exp $
 
48
 * @version $Id: DocumentTypeImpl.java 380043 2006-02-23 05:23:19Z mrglavas $
86
49
 * @since  PR-DOM-Level-1-19980818.
87
50
 */
88
51
public class DocumentTypeImpl 
132
95
    //
133
96
    // Constructors
134
97
    //
135
 
 
 
98
    private Hashtable userData =  null;
136
99
    /** Factory method for creating a document type node. */
137
100
    public DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name) {
138
101
        super(ownerDocument);
325
288
                Node entNode2 =
326
289
                    argEntities.getNamedItem(entNode1.getNodeName());
327
290
 
328
 
                if (!((NodeImpl) entNode1).isEqualNode((NodeImpl) entNode2))
 
291
                if (!((NodeImpl) entNode1).isEqualNode(entNode2))
329
292
                    return false;
330
293
            }
331
294
        }
345
308
                Node noteNode2 =
346
309
                    argNotations.getNamedItem(noteNode1.getNodeName());
347
310
 
348
 
                if (!((NodeImpl) noteNode1).isEqualNode((NodeImpl) noteNode2))
 
311
                if (!((NodeImpl) noteNode1).isEqualNode(noteNode2))
349
312
                    return false;
350
313
            }
351
314
        }
358
321
     * NON-DOM
359
322
     * set the ownerDocument of this node and its children
360
323
     */
361
 
    void setOwnerDocument(CoreDocumentImpl doc) {
 
324
    protected void setOwnerDocument(CoreDocumentImpl doc) {
362
325
        super.setOwnerDocument(doc);
363
326
        entities.setOwnerDocument(doc);
364
327
        notations.setOwnerDocument(doc);
476
439
        return elements;
477
440
    }
478
441
    
 
442
    public Object setUserData(String key,
 
443
    Object data, UserDataHandler handler) {
 
444
        if(userData == null)
 
445
            userData = new Hashtable();
 
446
        if (data == null) {
 
447
            if (userData != null) {
 
448
                Object o = userData.remove(key);
 
449
                if (o != null) {
 
450
                    UserDataRecord r = (UserDataRecord) o;
 
451
                    return r.fData;
 
452
                }
 
453
            }
 
454
            return null;
 
455
        }
 
456
        else {
 
457
            Object o = userData.put(key, new UserDataRecord(data, handler));
 
458
            if (o != null) {
 
459
                UserDataRecord r = (UserDataRecord) o;
 
460
                return r.fData;
 
461
            }
 
462
        }
 
463
        return null;
 
464
    }
 
465
    
 
466
    public Object getUserData(String key) {
 
467
        if (userData == null) {
 
468
            return null;
 
469
        }
 
470
        Object o = userData.get(key);
 
471
        if (o != null) {
 
472
            UserDataRecord r = (UserDataRecord) o;
 
473
            return r.fData;
 
474
        }
 
475
        return null;
 
476
    }
 
477
    
 
478
    protected Hashtable getUserDataRecord(){
 
479
        return userData;
 
480
    }
 
481
    
479
482
} // class DocumentTypeImpl