jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/DTDEvent.java
changeset 42802 2a03abb03c06
parent 25868 686eef1e7a79
equal deleted inserted replaced
42801:b6efd9c4f416 42802:2a03abb03c06
     1 /*
     1 /*
     2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.xml.internal.stream.events;
    26 package com.sun.xml.internal.stream.events;
    27 
    27 
       
    28 import java.util.List;
    28 import javax.xml.stream.events.DTD;
    29 import javax.xml.stream.events.DTD;
       
    30 import javax.xml.stream.events.EntityDeclaration;
       
    31 import javax.xml.stream.events.NotationDeclaration;
    29 import javax.xml.stream.events.XMLEvent;
    32 import javax.xml.stream.events.XMLEvent;
    30 
    33 
    31 /**
    34 /**
    32  *
    35  *
    33  * @author  Neeraj Bajaj, Sun Microsystesm.
    36  * @author Neeraj Bajaj, Sun Microsystesm.
    34  *
    37  *
    35  */
    38  */
    36 public class DTDEvent extends DummyEvent implements DTD{
    39 public class DTDEvent extends DummyEvent implements DTD {
    37 
    40 
    38     private String fDoctypeDeclaration;
    41     private String fDoctypeDeclaration;
    39     private java.util.List fNotations;
    42     private List<NotationDeclaration> fNotations;
    40     private java.util.List fEntities;
    43     private List<EntityDeclaration> fEntities;
    41 
    44 
    42     /** Creates a new instance of DTDEvent */
    45     /**
       
    46      * Creates a new instance of DTDEvent
       
    47      */
    43     public DTDEvent() {
    48     public DTDEvent() {
    44         init();
    49         init();
    45     }
    50     }
    46 
    51 
    47     public DTDEvent(String doctypeDeclaration){
    52     public DTDEvent(String doctypeDeclaration) {
    48         init();
    53         init();
    49         fDoctypeDeclaration = doctypeDeclaration;
    54         fDoctypeDeclaration = doctypeDeclaration;
    50     }
    55     }
    51 
    56 
    52     public void setDocumentTypeDeclaration(String doctypeDeclaration){
    57     public void setDocumentTypeDeclaration(String doctypeDeclaration) {
    53         fDoctypeDeclaration = doctypeDeclaration;
    58         fDoctypeDeclaration = doctypeDeclaration;
    54     }
    59     }
    55 
    60 
       
    61     @Override
    56     public String getDocumentTypeDeclaration() {
    62     public String getDocumentTypeDeclaration() {
    57         return fDoctypeDeclaration;
    63         return fDoctypeDeclaration;
    58     }
    64     }
    59 
    65 
    60     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
    66     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
    61     //and then convert that DT to list format here. That way callee dont need to bother about conversion
    67     //and then convert that DT to list format here. That way callee dont need to bother about conversion
    62 
    68     public void setEntities(List<EntityDeclaration> entites) {
    63     public void setEntities(java.util.List entites){
       
    64         fEntities = entites;
    69         fEntities = entites;
    65     }
    70     }
    66 
    71 
    67     public java.util.List getEntities() {
    72     @Override
       
    73     public List<EntityDeclaration> getEntities() {
    68         return fEntities;
    74         return fEntities;
    69     }
    75     }
    70 
    76 
    71     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
    77     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
    72     //and then convert that DT to list format here. That way callee dont need to bother about conversion
    78     //and then convert that DT to list format here. That way callee dont need to bother about conversion
    73 
    79     public void setNotations(List<NotationDeclaration> notations) {
    74     public void setNotations(java.util.List notations){
       
    75         fNotations = notations;
    80         fNotations = notations;
    76     }
    81     }
    77 
    82 
    78     public java.util.List getNotations() {
    83     @Override
       
    84     public List<NotationDeclaration> getNotations() {
    79         return fNotations;
    85         return fNotations;
    80     }
    86     }
    81 
    87 
    82     /**
    88     /**
    83      *Returns an implementation defined representation of the DTD.
    89      * Returns an implementation defined representation of the DTD. This method
    84      * This method may return null if no representation is available.
    90      * may return null if no representation is available.
    85      *
    91      *
    86      */
    92      */
       
    93     @Override
    87     public Object getProcessedDTD() {
    94     public Object getProcessedDTD() {
    88         return null;
    95         return null;
    89     }
    96     }
    90 
    97 
    91     protected void init(){
    98     protected final void init() {
    92         setEventType(XMLEvent.DTD);
    99         setEventType(XMLEvent.DTD);
    93     }
   100     }
    94 
   101 
    95     public String toString(){
   102     @Override
    96         return fDoctypeDeclaration ;
   103     public String toString() {
       
   104         return fDoctypeDeclaration;
    97     }
   105     }
    98 
   106 
       
   107     @Override
    99     protected void writeAsEncodedUnicodeEx(java.io.Writer writer)
   108     protected void writeAsEncodedUnicodeEx(java.io.Writer writer)
   100     throws java.io.IOException
   109             throws java.io.IOException {
   101     {
       
   102         writer.write(fDoctypeDeclaration);
   110         writer.write(fDoctypeDeclaration);
   103     }
   111     }
   104 }
   112 }