home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / parser.jar / com / sun / xml / tree / XmlWriteContext.class (.txt) < prev   
Encoding:
Java Class File  |  2000-02-23  |  1.3 KB  |  58 lines

  1. package com.sun.xml.tree;
  2.  
  3. import java.io.IOException;
  4. import java.io.Writer;
  5.  
  6. public class XmlWriteContext {
  7.    private Writer writer;
  8.    private int indentLevel;
  9.    private boolean prettyOutput;
  10.  
  11.    public XmlWriteContext(Writer var1) {
  12.       this.writer = var1;
  13.    }
  14.  
  15.    public XmlWriteContext(Writer var1, int var2) {
  16.       this.writer = var1;
  17.       this.prettyOutput = true;
  18.       this.indentLevel = var2;
  19.    }
  20.  
  21.    public int getIndentLevel() {
  22.       return this.indentLevel;
  23.    }
  24.  
  25.    public Writer getWriter() {
  26.       return this.writer;
  27.    }
  28.  
  29.    public boolean isEntityDeclared(String var1) {
  30.       return "amp".equals(var1) || "lt".equals(var1) || "gt".equals(var1) || "quot".equals(var1) || "apos".equals(var1);
  31.    }
  32.  
  33.    public boolean isPrettyOutput() {
  34.       return this.prettyOutput;
  35.    }
  36.  
  37.    public void printIndent() throws IOException {
  38.       int var1 = this.indentLevel;
  39.       if (this.prettyOutput) {
  40.          this.writer.write(XmlDocument.eol);
  41.  
  42.          while(var1 >= 8) {
  43.             this.writer.write(9);
  44.             var1 -= 8;
  45.          }
  46.  
  47.          while(var1-- > 0) {
  48.             this.writer.write(32);
  49.          }
  50.  
  51.       }
  52.    }
  53.  
  54.    public void setIndentLevel(int var1) {
  55.       this.indentLevel = var1;
  56.    }
  57. }
  58.