home *** CD-ROM | disk | FTP | other *** search
/ Online Today 2000 January / Onto0100.iso / pc / JAVA / MSJAVX86.EXE / xmldso.cab / com / ms / xml / parser / Notation.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  1.6 KB  |  67 lines

  1. package com.ms.xml.parser;
  2.  
  3. import com.ms.xml.om.Element;
  4. import com.ms.xml.om.ElementImpl;
  5. import com.ms.xml.util.Atom;
  6. import com.ms.xml.util.Name;
  7. import com.ms.xml.util.XMLOutputStream;
  8. import java.io.IOException;
  9.  
  10. public class Notation extends ElementImpl {
  11.    Name name;
  12.    String url;
  13.    String pubid;
  14.    int type;
  15.    Element schema = null;
  16.    static Name nameNAME = Name.create("NAME");
  17.    static Name nameSYSTEMID = Name.create("SYSTEMID");
  18.    static Name namePUBLICID = Name.create("PUBLICID");
  19.    static Name nameNOTATION = Name.create("NOTATION");
  20.  
  21.    Notation(Name var1) {
  22.       super(var1, 8);
  23.       this.name = var1;
  24.    }
  25.  
  26.    public Element toSchema() {
  27.       if (this.schema == null) {
  28.          ElementImpl var1 = new ElementImpl(nameNOTATION, 0);
  29.          var1.setAttribute(nameNAME, this.name.toString());
  30.          if (this.url != null) {
  31.             var1.setAttribute(nameSYSTEMID, this.url);
  32.          }
  33.  
  34.          if (this.pubid != null) {
  35.             var1.setAttribute(namePUBLICID, this.pubid);
  36.          }
  37.  
  38.          this.schema = var1;
  39.       }
  40.  
  41.       return this.schema;
  42.    }
  43.  
  44.    public void save(XMLOutputStream var1) throws IOException {
  45.       var1.writeIndent();
  46.       var1.writeChars("<!NOTATION ");
  47.       var1.writeQualifiedName(this.name, (Atom)null);
  48.       var1.writeChars(" ");
  49.       if (this.type == -100) {
  50.          var1.writeChars("PUBLIC ");
  51.          var1.writeQuotedString(this.pubid);
  52.          var1.write(32);
  53.          var1.writeQuotedString(this.url);
  54.       } else {
  55.          var1.writeChars("SYSTEM ");
  56.          var1.writeQuotedString(this.url);
  57.       }
  58.  
  59.       var1.write(62);
  60.       var1.writeNewLine();
  61.    }
  62.  
  63.    void setURL(String var1) {
  64.       this.url = var1;
  65.    }
  66. }
  67.