Files
Brainstorm/Foundation/src/com/foundation/util/xml/Comment.java

62 lines
2.0 KiB
Java
Raw Normal View History

2014-05-30 10:31:51 -07:00
/*
* Copyright (c) 2002,2008 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.foundation.util.xml;
public class Comment extends Element implements IComment {
private String text = null;
/**
* Comment constructor.
*/
public Comment() {
super();
}//Comment()//
/**
* Comment constructor.
* @param comment The initial text of the comment.
*/
public Comment(String comment) {
super();
setText(comment);
}//Comment()//
/* (non-Javadoc)
* @see com.foundation.util.xml.IComment#getText()
*/
public String getText() {
return text;
}//getText()//
/* (non-Javadoc)
* @see com.foundation.util.xml.Element#isComment()
*/
public boolean isComment() {
return true;
}//isComment()//
/* (non-Javadoc)
* @see com.foundation.util.xml.IComment#setText(java.lang.String)
*/
public void setText(String text) {
this.text = text;
}//setText()//
/**
* Writes the element to the buffer.
* @param out The output stream that will be given the formatted element data.
* @param builder The document builder that will provide guidance.
* @param prepend The string that will be added before any other characters in a perticular line.
* @param postpend The string that will be added after any other characters in a perticular line.
* @param compact Whether the output should be kept compact, or should include formatting characters.
*/
public void write(XmlOutputStream out, DocumentBuilder builder, String prepend, String postpend, boolean compact) throws java.io.IOException {
if(!builder.getIgnoreComments().booleanValue() && !compact) {
out.write(prepend);
out.write("<!--");
out.write(builder.getIgnoreTextWhitespace().booleanValue() ? getText().trim() : getText());
out.write("-->");
out.write(postpend);
}//if//
}//write()//
}//Comment//