| org.netbeans.modules.visualweb.insync.markup.JspxSerializer
JspxSerializer | public class JspxSerializer extends BaseMarkupSerializer (Code) | | Serialize a JSPX DOM. Similar to org.apache.xerces.serialize.XMLSerializer
but follows JSPX (and some XHTML) rules; in particular, it will not
mimimize <script></script> into <script/>. Unlike
XHTML however is does not mash attribute names into lowercase since for
example the "contentType" attribute needs to have an uppercase T.
This code reuses the XMLSerializer code, but it has to duplicate a couple
of methods since the ability to conditionally minimize elements was
not available in the methods that were hardcoded to emit /> at the end
of empty elements. Some other methods that were referenced by these
duplicated methods but were private were also inlined.
|
Constructor Summary | |
public | JspxSerializer() Constructs a new serializer. | public | JspxSerializer(OutputFormat format) Constructs a new serializer. | public | JspxSerializer(Writer writer, OutputFormat format) Constructs a new serializer that writes to the specified writer
using the specified output format. | public | JspxSerializer(OutputStream output, OutputFormat format) Constructs a new serializer that writes to the specified output
stream using the specified output format. |
Method Summary | |
public static boolean | canMinimizeTag(String tagName) Report whether the given tagName represents an XHTML element that
can/must be minimized. | protected void | checkUnboundNamespacePrefixedNode(Node node) DOM Level 3:
Check a node to determine if it contains unbound namespace prefixes. | public void | endElement(String namespaceURI, String localName, String rawName) | public void | endElement(String tagName) | public void | endElementIO(String namespaceURI, String localName, String rawName) | protected String | getEntityRef(int ch) | protected void | printEscaped(String source) | final void | printHex(int ch) | protected void | printText(String text, boolean preserveSpace, boolean unescaped) | protected void | printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped) | protected void | printXMLChar(int ch) | public boolean | reset() | protected void | serializeElement(Element elem) Called to serialize a DOM element. | public void | setNamespaces(boolean namespaces) This methods turns on namespace fixup algorithm during
DOM serialization. | public void | setOutputFormat(OutputFormat format) | protected void | startDocument(String rootTagName) Called to serialize the document's DOCTYPE by the root element.
The document type declaration must name the root element,
but the root element is only known when that element is serialized,
and not at the start of the document.
This method will check if it has not been called before (
JspxSerializer._started ),
will serialize the document type declaration, and will serialize all
pre-root comments and PIs that were accumulated in the document
(see
JspxSerializer.serializePreRoot ). | public void | startElement(String namespaceURI, String localName, String rawName, Attributes attrs) | public void | startElement(String tagName, AttributeList attrs) |
DEBUG | final protected static boolean DEBUG(Code) | | |
fLocalNSBinder | protected NamespaceSupport fLocalNSBinder(Code) | | stores all namespace bindings on the current element
|
fNSBinder | protected NamespaceSupport fNSBinder(Code) | | stores namespaces in scope
|
fNamespaces | protected boolean fNamespaces(Code) | | Controls whether namespace fixup should be performed during
the serialization.
NOTE: if this field is set to true the following
fields need to be initialized: fNSBinder, fLocalNSBinder, fSymbolTable,
XMLSymbols.EMPTY_STRING, fXmlSymbol, fXmlnsSymbol
|
fSymbolTable | protected SymbolTable fSymbolTable(Code) | | symbol table for serialization
|
JspxSerializer | public JspxSerializer(Writer writer, OutputFormat format)(Code) | | Constructs a new serializer that writes to the specified writer
using the specified output format. If format is null,
will use a default output format.
Parameters: writer - The writer to use Parameters: format - The output format to use, null for the default |
JspxSerializer | public JspxSerializer(OutputStream output, OutputFormat format)(Code) | | Constructs a new serializer that writes to the specified output
stream using the specified output format. If format
is null, will use a default output format.
Parameters: output - The output stream to use Parameters: format - The output format to use, null for the default |
canMinimizeTag | public static boolean canMinimizeTag(String tagName)(Code) | | Report whether the given tagName represents an XHTML element that
can/must be minimized. For example, "br" should always be
minimized, whereas "textarea" should never be.
Parameters: tagName - the name of the tag to be checked. Should alwaysbe lowercase. true iff the tag should be minimized. |
checkUnboundNamespacePrefixedNode | protected void checkUnboundNamespacePrefixedNode(Node node) throws IOException(Code) | | DOM Level 3:
Check a node to determine if it contains unbound namespace prefixes.
Parameters: node - The node to check for unbound namespace prefices |
printText | protected void printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped) throws IOException(Code) | | |
printXMLChar | protected void printXMLChar(int ch) throws IOException(Code) | | print text data
|
reset | public boolean reset()(Code) | | |
setNamespaces | public void setNamespaces(boolean namespaces)(Code) | | This methods turns on namespace fixup algorithm during
DOM serialization.
See Also: org.w3c.dom.ls.DOMSerializer Parameters: namespaces - |
setOutputFormat | public void setOutputFormat(OutputFormat format)(Code) | | |
startDocument | protected void startDocument(String rootTagName) throws IOException(Code) | | Called to serialize the document's DOCTYPE by the root element.
The document type declaration must name the root element,
but the root element is only known when that element is serialized,
and not at the start of the document.
This method will check if it has not been called before (
JspxSerializer._started ),
will serialize the document type declaration, and will serialize all
pre-root comments and PIs that were accumulated in the document
(see
JspxSerializer.serializePreRoot ). Pre-root will be serialized even if
this is not the first root element of the document.
|
|
|