Initial commit from SVN.
This commit is contained in:
62
Foundation/src/com/foundation/util/xml/Comment.java
Normal file
62
Foundation/src/com/foundation/util/xml/Comment.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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//
|
||||
Reference in New Issue
Block a user