Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // Copyright 2004, 2005 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
 package org.apache.tapestry;
 
Defines an object that can write markup (XML, HTML, XHTML) style output. A IMarkupWriter handles translation from unicode to the markup language (escaping characters such as '<' and '>' to their entity equivalents, '&lt;' and '&gt;') as well as assisting with nested elements, closing tags, etc.

Author(s):
Howard Ship, David Solis
 
 
 public interface IMarkupWriter
 {
    
Writes an integer attribute into the currently open tag.

Throws:
java.lang.IllegalStateException if there is no open tag.
 
 
     void attribute(String nameint value);

    
Writes a boolean attribute into the currently open tag.

Throws:
java.lang.IllegalStateException if there is no open tag.
Since:
3.0
 
 
     void attribute(String nameboolean value);

    
Writes an attribute into the most recently opened tag. This must be called after begin(java.lang.String)and before any other kind of writing (which closes the tag).

The value may be null.

Throws:
java.lang.IllegalStateException if there is no open tag.
 
 
     void attribute(String nameString value);

    
Similar to attribute(java.lang.String,java.lang.String)but no escaping of invalid elements is done for the value.

Throws:
java.lang.IllegalStateException if there is no open tag.
Since:
3.0
 
 
     void attributeRaw(String nameString value);
    
    
Appends an integer attribute to the current attribute with a matching name key, if one exists.

Throws:
java.lang.IllegalStateException if there is no open tag.
 
 
     void appendAttribute(String nameint value);

    
Appends a boolean attribute into the currently open tag.

Throws:
java.lang.IllegalStateException if there is no open tag.
Since:
3.0
 
 
     void appendAttribute(String nameboolean value);

    
Appends an attribute into the most recently opened tag. This must be called after begin(java.lang.String) and before any other kind of writing (which closes the tag).

The value may be null.

Throws:
java.lang.IllegalStateException if there is no open tag.
    void appendAttribute(String nameString value);

    
Similar to attribute(java.lang.String,java.lang.String) but no escaping of invalid elements is done for the value.

Throws:
java.lang.IllegalStateException if there is no open tag.
Since:
3.0
    void appendAttributeRaw(String nameString value);
    
    
Checks if the current tag has an attribute keyed off of name.

Parameters:
name The name of the attribute to check for existance of.
Returns:
True if the attribute exists, false otherwise.
Throws:
java.lang.IllegalStateException If there is no open tag.
    boolean hasAttribute(String name);
    
    
Gets the attribute matching name from the current open tag, if it exists.

Parameters:
name The attribute to get the value of by name.
Returns:
The attribute value, or null if it doesn't exist.
Throws:
java.lang.IllegalStateException If there is no open tag.
    Attribute getAttribute(String name);
    
    
Removes the attribute specified with a matching name if one exists.

Parameters:
name The attribute to remove.
Returns:
The removed attribute, null if one didn't exist.
Throws:
java.lang.IllegalStateException If there is no open tag.
    Attribute removeAttribute(String name);
    
    
Removes all current attributes on the open tag, if any.

Throws:
java.lang.IllegalStateException If there is no open tag.
    void clearAttributes();
    
    
Closes any existing tag then starts a new element. The new element is pushed onto the active element stack.
    void begin(String name);

    
Starts an element that will not later be matched with an end() call. This is useful for elements that do not need closing tags.
    void beginEmpty(String name);

    
Invokes checkError() on the PrintWriter used to format output.
    boolean checkError();

    
Closes this IMarkupWriter. Close tags are written for any active elements. The PrintWriter is then sent close(). A nested writer will commit its buffer to its containing writer.
    void close();

    
Closes the most recently opened element by writing the '>' that ends it. Once this is invoked, the attribute() methods may not be used until a new element is opened with begin(java.lang.String)or or beginEmpty(java.lang.String).
    void closeTag();

    
Writes an XML/HTML comment. Any open tag is first closed. The method takes care of providing the <!-- and -->, and provides a blank line after the close of the comment.

Most characters are valid inside a comment, so no check of the contents is made (much like printRaw(java.lang.String).

    void comment(String value);

    
Ends the element most recently started by begin(java.lang.String). The name of the tag is popped off of the active element stack and used to form an HTML close tag.
    void end();

    
Ends the most recently started element with the given name. This will also end any other intermediate elements. This is very useful for easily ending a table or even an entire page.
    void end(String name);

    
Forwards flush() to this IMarkupWriter's PrintWriter.
    void flush();

    
Returns a nested writer, one that accumulates its changes in a buffer. When the nested writer is closed, it writes its buffer of markup into its containing IMarkupWriter using printRaw(java.lang.String).
Version of print(char[],int,int,boolean) that assumes filter is enabled.
    void print(char[] dataint offsetint length);

    
The primary print() method, used by most other methods.

Prints the character array, first closing any open tag. Problematic characters ('<', '>' and '&') are converted to appropriate entities.

Does nothing if data is null.

Closes any open tag.

Parameters:
data contains the characters to print, or null to not print anything
offset offset into the array to start printing from
length number of characters to print
raw if true, filtering is disabled
Since:
4.0
    void print(char[] dataint offsetint lengthboolean raw);

    
Prints a single character, or its equivalent entity.

Closes any open tag.

    void print(char value);

    
Prints an integer.

Closes any open tag.

    void print(int value);

    
As with print(char[],int,int,boolean), but the data to print is defined by the String. Assumes filtering is enabled.
    void print(String value);

    
As with print(char[],int,int,boolean), but the data to print is defined by the String.
    void print(String valueboolean raw);

    
Closes the open tag (if any), then prints a line seperator to the output stream.
    void println();

    
Version of print(char[],int,int,boolean)that assumes filter is enabled.
    void printRaw(char[] bufferint offsetint length);

    
As with print(char[],int,int,boolean), but the data to print is defined by the String. Assumes filtering is disabled.
    void printRaw(String value);

    
Returns the type of content generated by this response writer, as a MIME type.
New to GrepCode? Check out our FAQ X