com.ociweb.xml
Class WAX

java.lang.Object
  extended by com.ociweb.xml.WAX
All Implemented Interfaces:
CommonWAX, ElementWAX, PrologOrElementWAX, PrologWAX, StartTagWAX

public class WAX
extends java.lang.Object
implements PrologOrElementWAX, StartTagWAX

This class provides methods that make outputting XML easy, fast and efficient in terms of memory utilization.

A WAX object should not be used from multiple threads!

For more information, see http://www.ociweb.com/wax/.

Copyright (c) 2008, R. Mark Volkmann
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Author:
R. Mark Volkmann, Object Computing, Inc.

Field Summary
static java.lang.String MAC_LINE_SEPARATOR
           
static java.lang.String UNIX_LINE_SEPARATOR
           
static java.lang.String WINDOWS_LINE_SEPARATOR
           
 
Constructor Summary
WAX()
          Creates a WAX that writes to stdout.
WAX(java.io.OutputStream os)
          Creates a WAX that writes to a given OutputStream.
WAX(java.io.OutputStream os, Version version)
           
WAX(java.lang.String filePath)
          Creates a WAX that writes to a given file path.
WAX(java.lang.String filePath, Version version)
           
WAX(Version version)
           
WAX(java.io.Writer writer)
          Creates a WAX that writes to a given Writer.
WAX(java.io.Writer writer, Version version)
           
 
Method Summary
 StartTagWAX attr(java.lang.String name, java.lang.Object value)
          Writes an attribute for the currently open element start tag.
 StartTagWAX attr(java.lang.String prefix, java.lang.String name, java.lang.Object value)
          Writes an attribute for the currently open element start tag.
 StartTagWAX attr(java.lang.String prefix, java.lang.String name, java.lang.Object value, boolean newLine)
          Writes an attribute for the currently open element start tag.
 ElementWAX blankLine()
          Writes a blank line to increase readability of the XML.
 ElementWAX cdata(java.lang.String text)
          Writes a CDATA section in the content of the current element.
 ElementWAX cdata(java.lang.String text, boolean newLine)
          Writes a CDATA section in the content of the current element.
 ElementWAX child(java.lang.String name)
          A convenience method that is a shortcut for start(name).end().
 ElementWAX child(java.lang.String name, java.lang.String text)
          A convenience method that is a shortcut for start(name).text(text).end().
 ElementWAX child(java.lang.String prefix, java.lang.String name, java.lang.String text)
          A convenience method that is a shortcut for start(prefix, name).text(text).end().
 void close()
          Terminates all unterminated elements, closes the Writer that is being used to output XML, and insures that nothing else can be written.
 PrologOrElementWAX comment(java.lang.String text)
          Writes a comment (<!-- text -->).
 PrologOrElementWAX comment(java.lang.String text, boolean newLine)
          Writes a comment (<!-- text -->).
 StartTagWAX commentedStart(java.lang.String name)
          Writes a commented start tag for a given element name, but doesn't terminate it.
 StartTagWAX commentedStart(java.lang.String prefix, java.lang.String name)
          Writes a commented start tag for a given element name, but doesn't terminate it.
 StartTagWAX defaultNamespace(java.lang.String uri)
          Writes a namespace declaration for the default namespace in the start tag of the current element.
 StartTagWAX defaultNamespace(java.lang.String uri, java.lang.String schemaPath)
          Writes a namespace declaration for the default namespace in the start tag of the current element.
 StartTagWAX defaultNS(java.lang.String uri)
          Shorthand name for the defaultNamespace method.
 StartTagWAX defaultNS(java.lang.String uri, java.lang.String schemaPath)
          Shorthand name for the defaultNamespace method.
 PrologWAX dtd(java.lang.String systemId)
          Writes a DOCTYPE that associates a DTD with the XML document.
 PrologWAX dtd(java.lang.String publicId, java.lang.String systemId)
          Writes a DOCTYPE that associates a DTD with the XML document.
 ElementWAX end()
          Terminates the current element.
 ElementWAX end(boolean verbose)
          Terminates the current element.
 PrologWAX entityDef(java.lang.String name, java.lang.String value)
          Adds an entity definition to the internal subset of the DOCTYPE.
 WAX excludeFinalNewline()
          Indicate that WAX should not add a final newline when closing this WAX.
 PrologWAX externalEntityDef(java.lang.String name, java.lang.String filePath)
          Adds an external entity definition to the internal subset of the DOCTYPE.
 java.lang.String getIndent()
          Gets the indentation characters being used.
 java.lang.String getLineSeparator()
          Gets the line separator characters currently being used.
 java.lang.String getSchemaVersion()
          Gets the part of the xsi namespace URI that specifies the version of XML Schema being used.
 WAX includeFinalNewline()
          Indicate that WAX should add a final newline when closing this WAX.
 boolean isSpaceInEmptyElements()
          Indicates whether a space is added before the slash in empty elements.
 boolean isTrustMe()
          Gets whether "trust me" mode is enabled.
 StartTagWAX namespace(java.lang.String prefix, java.lang.String uri)
          Writes a namespace declaration in the start tag of the current element.
 StartTagWAX namespace(java.lang.String prefix, java.lang.String uri, java.lang.String schemaPath)
          Writes a namespace declaration in the start tag of the current element.
 void noIndentsOrLineSeparators()
          Don't output indent output or write line separators.
 StartTagWAX ns(java.lang.String prefix, java.lang.String uri)
          Shorthand name for the namespace method.
 StartTagWAX ns(java.lang.String prefix, java.lang.String uri, java.lang.String schemaPath)
          Shorthand name for the namespace method.
 PrologOrElementWAX pi(java.lang.String target, java.lang.String data)
          Shorthand name for the processingInstruction method.
 PrologOrElementWAX processingInstruction(java.lang.String target, java.lang.String data)
          Writes a processing instruction.
 void setIndent(int numSpaces)
          Sets the number of spaces to use for indentation.
 void setIndent(java.lang.String indent)
          Sets the indentation characters to use.
 void setLineSeparator(java.lang.String lineSeparator)
          Sets the line separator characters to be used.
 void setSchemaVersion(java.lang.String version)
          Sets the part of the xsi namespace URI that specifies the version of XML Schema being used.
 void setSpaceInEmptyElements(boolean spaceInEmptyElements)
          Sets whether a space will be added before the closing slash in empty elements.
 void setTrustMe(boolean trustMe)
          Sets whether "trust me" mode is enabled.
 StartTagWAX start(java.lang.String name)
          Writes the start tag for a given element name, but doesn't terminate it.
 StartTagWAX start(java.lang.String prefix, java.lang.String name)
          Writes the start tag for a given element name, but doesn't terminate it.
 ElementWAX text(java.lang.String text)
          Writes text inside the content of the current element.
 ElementWAX text(java.lang.String text, boolean newLine)
          Writes text inside the content of the current element.
 StartTagWAX unescapedAttr(java.lang.String name, java.lang.Object value)
          Same as the attr method, but special characters in the value aren't escaped.
 StartTagWAX unescapedAttr(java.lang.String prefix, java.lang.String name, java.lang.Object value)
          Same as the attr method, but special characters in the value aren't escaped.
 StartTagWAX unescapedAttr(java.lang.String prefix, java.lang.String name, java.lang.Object value, boolean newLine)
          Same as the attr method, but special characters in the value aren't escaped.
 ElementWAX unescapedText(java.lang.String text)
          Same as the text method, but special characters in the value aren't escaped.
 ElementWAX unescapedText(java.lang.String text, boolean newLine)
          Same as the text method, but special characters in the value aren't escaped.
 PrologWAX xslt(java.lang.String filePath)
          Writes an "xml-stylesheet" processing instruction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAC_LINE_SEPARATOR

public static final java.lang.String MAC_LINE_SEPARATOR
See Also:
Constant Field Values

UNIX_LINE_SEPARATOR

public static final java.lang.String UNIX_LINE_SEPARATOR
See Also:
Constant Field Values

WINDOWS_LINE_SEPARATOR

public static final java.lang.String WINDOWS_LINE_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

WAX

public WAX()
Creates a WAX that writes to stdout.


WAX

public WAX(Version version)

WAX

public WAX(java.io.OutputStream os)
Creates a WAX that writes to a given OutputStream. The stream will be closed by the close method of this class.

Parameters:
os - the OutputStream

WAX

public WAX(java.io.OutputStream os,
           Version version)

WAX

public WAX(java.lang.String filePath)
Creates a WAX that writes to a given file path.

Parameters:
filePath - the file path
Throws:
WAXIOException - if the named file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason.

WAX

public WAX(java.lang.String filePath,
           Version version)

WAX

public WAX(java.io.Writer writer)
Creates a WAX that writes to a given Writer. The writer will be closed by the close method of this class.

Parameters:
writer - the Writer

WAX

public WAX(java.io.Writer writer,
           Version version)
Method Detail

includeFinalNewline

public WAX includeFinalNewline()
Indicate that WAX should add a final newline when closing this WAX.

Returns:
this WAX object.

excludeFinalNewline

public WAX excludeFinalNewline()
Indicate that WAX should not add a final newline when closing this WAX.

Returns:
this WAX object.

attr

public StartTagWAX attr(java.lang.String name,
                        java.lang.Object value)
Writes an attribute for the currently open element start tag.

Specified by:
attr in interface StartTagWAX
Parameters:
name - the attribute name
value - the attribute value
Returns:
the calling object to support chaining
See Also:
attr(String, Object)

attr

public StartTagWAX attr(java.lang.String prefix,
                        java.lang.String name,
                        java.lang.Object value)
Writes an attribute for the currently open element start tag.

Specified by:
attr in interface StartTagWAX
Parameters:
prefix - the namespace prefix for the attribute
name - the attribute name
value - the attribute value
Returns:
the calling object to support chaining
See Also:
attr(String, String, Object)

attr

public StartTagWAX attr(java.lang.String prefix,
                        java.lang.String name,
                        java.lang.Object value,
                        boolean newLine)
Writes an attribute for the currently open element start tag.

Specified by:
attr in interface StartTagWAX
Parameters:
prefix - the namespace prefix for the attribute
name - the attribute name
value - the attribute value
newLine - true to write on a new line; false otherwise
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - unless we have a start tag open, for writing XML attributes.
See Also:
attr(String, String, Object, boolean)

blankLine

public ElementWAX blankLine()
Writes a blank line to increase readability of the XML.

Specified by:
blankLine in interface ElementWAX
Returns:
the calling object to support chaining
See Also:
blankLine()

cdata

public ElementWAX cdata(java.lang.String text)
Writes a CDATA section in the content of the current element.

Specified by:
cdata in interface ElementWAX
Parameters:
text - the text
Returns:
the calling object to support chaining
See Also:
cdata(String)

cdata

public ElementWAX cdata(java.lang.String text,
                        boolean newLine)
Writes a CDATA section in the content of the current element.

Specified by:
cdata in interface ElementWAX
Parameters:
text - the text
newLine - true to output the text on a new line; false otherwise
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if before the beginning or after end of writing the root Element.
See Also:
cdata(String, boolean)

child

public ElementWAX child(java.lang.String name)
A convenience method that is a shortcut for start(name).end().

Specified by:
child in interface ElementWAX
Parameters:
name - the child element name
Returns:
the calling object to support chaining
See Also:
child(String)

child

public ElementWAX child(java.lang.String name,
                        java.lang.String text)
A convenience method that is a shortcut for start(name).text(text).end().

Specified by:
child in interface ElementWAX
Parameters:
name - the child element name
text - the child element text content
Returns:
the calling object to support chaining
See Also:
child(String, String)

child

public ElementWAX child(java.lang.String prefix,
                        java.lang.String name,
                        java.lang.String text)
A convenience method that is a shortcut for start(prefix, name).text(text).end().

Specified by:
child in interface ElementWAX
Parameters:
prefix - the namespace prefix of the child element
name - the child element name
text - the child element text content
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if after end of writing the root Element.
See Also:
child(String, String, String)

close

public void close()
Terminates all unterminated elements, closes the Writer that is being used to output XML, and insures that nothing else can be written.

Specified by:
close in interface ElementWAX
Throws:
java.lang.IllegalStateException - if WAX had already been closed, or if we have not yet written a root Element.
WAXIOException - if an I/O error occurs.
See Also:
close()

comment

public PrologOrElementWAX comment(java.lang.String text)
Writes a comment (<!-- text -->).

Specified by:
comment in interface CommonWAX
Parameters:
text - the comment text (cannot contain "--")
Returns:
the calling object to support chaining
See Also:
comment(String)

comment

public PrologOrElementWAX comment(java.lang.String text,
                                  boolean newLine)
Writes a comment (<!-- text -->).

Specified by:
comment in interface CommonWAX
Parameters:
text - the comment text (cannot contain "--")
newLine - true to output the text on a new line; false otherwise
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalArgumentException - if text is null or contains two sequential dash characters ("--").
See Also:
comment(String, boolean)

commentedStart

public StartTagWAX commentedStart(java.lang.String name)
Writes a commented start tag for a given element name, but doesn't terminate it.

Specified by:
commentedStart in interface CommonWAX
Parameters:
name - the element name
Returns:
the calling object to support chaining
See Also:
commentedStart(String)

commentedStart

public StartTagWAX commentedStart(java.lang.String prefix,
                                  java.lang.String name)
Writes a commented start tag for a given element name, but doesn't terminate it.

Specified by:
commentedStart in interface CommonWAX
Parameters:
prefix - the namespace prefix to used on the element
name - the element name
Returns:
the calling object to support chaining
See Also:
commentedStart(String, String)

defaultNamespace

public StartTagWAX defaultNamespace(java.lang.String uri)
Writes a namespace declaration for the default namespace in the start tag of the current element.

Specified by:
defaultNamespace in interface StartTagWAX
Parameters:
uri - the namespace URI
Returns:
the calling object to support chaining
See Also:
defaultNamespace(String)

defaultNamespace

public StartTagWAX defaultNamespace(java.lang.String uri,
                                    java.lang.String schemaPath)
Writes a namespace declaration for the default namespace in the start tag of the current element.

Specified by:
defaultNamespace in interface StartTagWAX
Parameters:
uri - the namespace URI
schemaPath - the path to the XML Schema
Returns:
the calling object to support chaining
See Also:
defaultNamespace(String, String)

defaultNS

public StartTagWAX defaultNS(java.lang.String uri)
Shorthand name for the defaultNamespace method.

Specified by:
defaultNS in interface StartTagWAX
Parameters:
uri - the namespace URI
Returns:
the calling object to support chaining
See Also:
defaultNamespace(String)

defaultNS

public StartTagWAX defaultNS(java.lang.String uri,
                             java.lang.String schemaPath)
Shorthand name for the defaultNamespace method.

Specified by:
defaultNS in interface StartTagWAX
Parameters:
uri - the namespace URI
schemaPath - the path to the XML Schema
Returns:
the calling object to support chaining
See Also:
defaultNamespace(String, String)

dtd

public PrologWAX dtd(java.lang.String systemId)
Writes a DOCTYPE that associates a DTD with the XML document.

Specified by:
dtd in interface PrologWAX
Parameters:
systemId - the file path or URL to the DTD
Returns:
the calling object to support chaining
See Also:
dtd(String)

dtd

public PrologWAX dtd(java.lang.String publicId,
                     java.lang.String systemId)
Writes a DOCTYPE that associates a DTD with the XML document.

Specified by:
dtd in interface PrologWAX
Parameters:
publicId - the public ID of the DTD
systemId - the file path or URL to the DTD
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if this method is called more than once, or if we have already started writing XML Elements.
java.lang.IllegalArgumentException - if systemId is not a valid URI.
See Also:
dtd(String, String)

end

public ElementWAX end()
Terminates the current element. It does so in the shorthand way (/>) if the element has no content, and in the long way (</name>) if it does.

Specified by:
end in interface ElementWAX
Returns:
the calling object to support chaining
See Also:
end()

end

public ElementWAX end(boolean verbose)
Terminates the current element. It does so in the shorthand way (/>) if the element has no content AND false is passed. Otherwise it does so in the long way (</name>). The verbose option is useful in cases like the HTML script tag which cannot be terminated in the shorthand way even though it has no content.

Specified by:
end in interface ElementWAX
Parameters:
verbose - true to not consider shorthand way; false to consider it
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if before the beginning or after end of writing the root Element.
See Also:
end(boolean)

entityDef

public PrologWAX entityDef(java.lang.String name,
                           java.lang.String value)
Adds an entity definition to the internal subset of the DOCTYPE.

Specified by:
entityDef in interface PrologWAX
Parameters:
name -
value -
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if we have already started writing XML Elements.
See Also:
entityDef(String, String)

externalEntityDef

public PrologWAX externalEntityDef(java.lang.String name,
                                   java.lang.String filePath)
Adds an external entity definition to the internal subset of the DOCTYPE.

Specified by:
externalEntityDef in interface PrologWAX
Parameters:
name - the name
filePath - the filePath
Returns:
the calling object to support chaining
See Also:
externalEntityDef(String, String)

getIndent

public java.lang.String getIndent()
Gets the indentation characters being used. Note that there is a distinction between null and "".

Returns:
the indentation characters
See Also:
setIndent(String), setIndent(int)

getLineSeparator

public java.lang.String getLineSeparator()
Gets the line separator characters currently being used.

Returns:
the line separator characters

getSchemaVersion

public java.lang.String getSchemaVersion()
Gets the part of the xsi namespace URI that specifies the version of XML Schema being used. Typically it will be "1999" or "2001"


isSpaceInEmptyElements

public boolean isSpaceInEmptyElements()
Indicates whether a space is added before the slash in empty elements.

Returns:
true if a space is added; false otherwise
See Also:
setSpaceInEmptyElements(boolean)

isTrustMe

public boolean isTrustMe()
Gets whether "trust me" mode is enabled.

Returns:
true if error checking is disabled; false if enabled
See Also:
setTrustMe(boolean)

namespace

public StartTagWAX namespace(java.lang.String prefix,
                             java.lang.String uri)
Writes a namespace declaration in the start tag of the current element. To define the default namespace, use one of the defaultNamespace methods.

Specified by:
namespace in interface StartTagWAX
Parameters:
prefix - the namespace prefix
uri - the namespace URI
Returns:
the calling object to support chaining
See Also:
namespace(String, String)

namespace

public StartTagWAX namespace(java.lang.String prefix,
                             java.lang.String uri,
                             java.lang.String schemaPath)
Writes a namespace declaration in the start tag of the current element. To define the default namespace, use one of the defaultNamespace methods.

Specified by:
namespace in interface StartTagWAX
Parameters:
prefix - the namespace prefix
uri - the namespace URI
schemaPath - the path to the XML Schema
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - unless we have a start tag open, for writing XML attributes.
java.lang.IllegalArgumentException - if prefix is not a valid XML name token, or if uri or schemaPath are not a valid URIs, or when one attempts to define the same namespace prefix more than once within the same start XML Element.
See Also:
namespace(String, String, String)

ns

public StartTagWAX ns(java.lang.String prefix,
                      java.lang.String uri)
Shorthand name for the namespace method.

Specified by:
ns in interface StartTagWAX
Parameters:
prefix - the namespace prefix
uri - the namespace URI
Returns:
the calling object to support chaining
See Also:
namespace(String, String)

ns

public StartTagWAX ns(java.lang.String prefix,
                      java.lang.String uri,
                      java.lang.String schemaPath)
Shorthand name for the namespace method.

Specified by:
ns in interface StartTagWAX
Parameters:
prefix - the namespace prefix
uri - the namespace URI
schemaPath - the path to the XML Schema
Returns:
the calling object to support chaining
See Also:
namespace(String, String, String)

pi

public PrologOrElementWAX pi(java.lang.String target,
                             java.lang.String data)
Shorthand name for the processingInstruction method.

Specified by:
pi in interface CommonWAX
Parameters:
target - the processing instruction target
data - the processing instruction data
Returns:
the calling object to support chaining
See Also:
pi(String, String)

processingInstruction

public PrologOrElementWAX processingInstruction(java.lang.String target,
                                                java.lang.String data)
Writes a processing instruction.

Specified by:
processingInstruction in interface CommonWAX
Parameters:
target - the processing instruction target
data - the processing instruction data
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalArgumentException - if target is not a valid XML name token.
See Also:
processingInstruction(String, String)

setIndent

public void setIndent(java.lang.String indent)
Sets the indentation characters to use. This defaults to two spaces. Unless "trust me" is set to true, the only valid values are a single tab, one or more spaces, an empty string, or null. Passing "" causes elements to be output on separate lines, but not indented. Passing null causes all output to be on a single line.

Throws:
java.lang.IllegalArgumentException - if the indent string does not follow the rules above (and the "trust me" flag isn't true).

setIndent

public void setIndent(int numSpaces)
Sets the number of spaces to use for indentation. The number must be >= 0 and <= 4. This defaults to 2.

Parameters:
numSpaces - the number of spaces
Throws:
java.lang.IllegalArgumentException - if numSpaces is negative or more than four.

noIndentsOrLineSeparators

public void noIndentsOrLineSeparators()
Don't output indent output or write line separators. Write out the XML on a single line.


setLineSeparator

public void setLineSeparator(java.lang.String lineSeparator)
Sets the line separator characters to be used.

Parameters:
lineSeparator - the line separator characters
Throws:
java.lang.IllegalStateException - if data has already been written.
java.lang.IllegalArgumentException - if the lineSeparator sequence is not one of the recognized (Mac, Unix or Windows) line terminator/separator character sequences.

setSchemaVersion

public void setSchemaVersion(java.lang.String version)
Sets the part of the xsi namespace URI that specifies the version of XML Schema being used.

Parameters:
version - typically "1999" or "2001"

setSpaceInEmptyElements

public void setSpaceInEmptyElements(boolean spaceInEmptyElements)
Sets whether a space will be added before the closing slash in empty elements. When set true, output will look like "". When set false, output will look like "".

Parameters:
spaceInEmptyElements - true to include a space; false otherwise
See Also:
isSpaceInEmptyElements()

setTrustMe

public void setTrustMe(boolean trustMe)
Sets whether "trust me" mode is enabled. When disabled (the default), the following checks are made. 1) element names, attribute names, namespace prefixes and processing instruction targets are verified to be valid XML names 2) comments are verified to not contain "--" 3) element and attribute prefixes are verified to be in scope 4) DTD paths, namespaces, schema paths and XSLT paths are to use valid URI syntax 5) only sensible indent values (none, two spaces, four spaces or one tab) are allowed (can use other values if trustMe = true) The main reason to enable "trust me" mode is for performance which is typically good even when disabled.

Parameters:
trustMe - true to disable error checking; false to enable it
See Also:
isTrustMe()

start

public StartTagWAX start(java.lang.String name)
Writes the start tag for a given element name, but doesn't terminate it.

Specified by:
start in interface CommonWAX
Parameters:
name - the element name
Returns:
the calling object to support chaining
See Also:
start(String)

start

public StartTagWAX start(java.lang.String prefix,
                         java.lang.String name)
Writes the start tag for a given element name, but doesn't terminate it.

Specified by:
start in interface CommonWAX
Parameters:
prefix - the namespace prefix to used on the element
name - the element name
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if the root XML Element has been closed.
See Also:
start(String, String)

text

public ElementWAX text(java.lang.String text)
Writes text inside the content of the current element.

Specified by:
text in interface ElementWAX
Parameters:
text - the text
Returns:
the calling object to support chaining
See Also:
text(String)

text

public ElementWAX text(java.lang.String text,
                       boolean newLine)
Writes text inside the content of the current element.

Specified by:
text in interface ElementWAX
Parameters:
text - the text
newLine - true to output the text on a new line; false otherwise
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if before the beginning or after end of writing the root Element.
See Also:
text(String, boolean)

unescapedAttr

public StartTagWAX unescapedAttr(java.lang.String name,
                                 java.lang.Object value)
Same as the attr method, but special characters in the value aren't escaped. This allows entity references to be embedded.

Specified by:
unescapedAttr in interface StartTagWAX
Parameters:
name - the attribute name
value - the attribute value
Returns:
the calling object to support chaining
See Also:
attr(String, Object)

unescapedAttr

public StartTagWAX unescapedAttr(java.lang.String prefix,
                                 java.lang.String name,
                                 java.lang.Object value)
Same as the attr method, but special characters in the value aren't escaped. This allows entity references to be embedded.

Specified by:
unescapedAttr in interface StartTagWAX
Parameters:
prefix - the namespace prefix for the attribute
name - the attribute name
value - the attribute value
Returns:
the calling object to support chaining
See Also:
attr(String, String, Object)

unescapedAttr

public StartTagWAX unescapedAttr(java.lang.String prefix,
                                 java.lang.String name,
                                 java.lang.Object value,
                                 boolean newLine)
Same as the attr method, but special characters in the value aren't escaped. This allows entity references to be embedded.

Specified by:
unescapedAttr in interface StartTagWAX
Parameters:
prefix - the namespace prefix for the attribute
name - the attribute name
value - the attribute value
newLine - true to write on a new line; false otherwise
Returns:
the calling object to support chaining
See Also:
attr(String, String, Object, boolean)

unescapedText

public ElementWAX unescapedText(java.lang.String text)
Same as the text method, but special characters in the value aren't escaped. This allows entity references to be embedded.

Specified by:
unescapedText in interface ElementWAX
Parameters:
text - the text
Returns:
the calling object to support chaining
See Also:
unescapedText(String)

unescapedText

public ElementWAX unescapedText(java.lang.String text,
                                boolean newLine)
Same as the text method, but special characters in the value aren't escaped. This allows entity references to be embedded.

Specified by:
unescapedText in interface ElementWAX
Parameters:
text - the text
newLine - true to output the text on a new line; false otherwise
Returns:
the calling object to support chaining
See Also:
unescapedText(String, boolean)

xslt

public PrologWAX xslt(java.lang.String filePath)
Writes an "xml-stylesheet" processing instruction.

Specified by:
xslt in interface PrologWAX
Parameters:
filePath - the path to the XSLT stylesheet
Returns:
the calling object to support chaining
Throws:
java.lang.IllegalStateException - if a stylesheet has already been specified, or if we have already started writing XML Elements.
java.lang.IllegalArgumentException - if filePath is not a valid URI.
See Also:
xslt(String)