Package io.guise.framework.platform
Interface XMLDepictContext
- All Superinterfaces:
DepictContext
,com.globalmentor.beans.PropertyBindable
,TextDepictContext
- All Known Subinterfaces:
WebDepictContext
,XHTMLDepictContext
- All Known Implementing Classes:
AbstractWebDepictContext
,AbstractXHTMLDepictContext
,AbstractXMLDepictContext
,HTTPServletWebDepictContext
Encapsulation of text/xml information related to the current depiction.
- Author:
- Garret Wilson
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The state of rendering for a particular element. -
Method Summary
Modifier and TypeMethodDescriptiongetQualifiedName
(URI namespaceURI, String localName) Retrieves the qualified name of the given namespace and local name.void
writeAttribute
(URI namespaceURI, String localName, String value) Writes an attribute of an XML element.void
writeComment
(String comment) Writes an XML comment.void
Writes the ending part of an XML comment.void
Writes the beginning part of an XML comment.void
writeDocType
(boolean writeXMLDeclaration, URI namespaceURI, String localName) Writes a doctype along with an optional XML declaration to the string builder and sets the output content type.void
writeDocType
(boolean writeXMLDeclaration, URI namespaceURI, String localName, com.globalmentor.net.MediaType contentType) Writes a doctype along with an optional XML declaration to the string builder and sets the output content type.void
writeDocType
(boolean writeXMLDeclaration, URI namespaceURI, String localName, String publicID) Writes a doctype along with an optional XML declaration to the string builder and sets the output content type.void
writeDocType
(boolean writeXMLDeclaration, URI namespaceURI, String localName, String publicID, String systemID, com.globalmentor.net.MediaType contentType) Writes a doctype along with an optional XML declaration to the string builder and sets the output content type.writeElementBegin
(URI namespaceURI, String localName) Begins an XML element that will not be an empty element, even if it has no content.writeElementBegin
(URI namespaceURI, String localName, boolean isEmptyElementAllowed) Begins an XML element, specifying whether an empty element is allowed.writeElementEnd
(URI namespaceURI, String localName) Ends an XML element.Methods inherited from interface io.guise.framework.platform.DepictContext
getDepictionURI, getDepictionURI, getDepictionURI, getDestination, getPlatform, getSession, getStyles
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface io.guise.framework.platform.TextDepictContext
clearDepictText, getDepictStringBuilder, getDepictText, getIndentLevel, getOutputCharset, getOutputContentType, indent, indent, isFormatted, setIndentLevel, setOutputContentType, unindent, write, write, writeIndent, writeLiteral
-
Method Details
-
getQualifiedName
Retrieves the qualified name of the given namespace and local name. If the namespace URI is not recognized, a new prefix will be generated for that namespace This method therefore works for attributes in thenull
namespace, but cannot work for elements in thenull
namespace because this would be ambiguous with elements in the the XHTML namespace.- Parameters:
namespaceURI
- The URI of the XML namespace, ornull
if there is no namespace and there should be no prefix.localName
- The local name of the element or attribute with no prefix.- Returns:
- The XML qualified name.
-
writeDocType
void writeDocType(boolean writeXMLDeclaration, URI namespaceURI, String localName) throws IOException Writes a doctype along with an optional XML declaration to the string builder and sets the output content type. No system ID or public ID will be written.- Parameters:
writeXMLDeclaration
- Whether an XML declaration should be included before the doctype.namespaceURI
- The URI of the XML namespace of document element, ornull
if there is no namespace.localName
- The local name of the document element with no prefix.- Throws:
IOException
- if there is an error writing the information.
-
writeDocType
void writeDocType(boolean writeXMLDeclaration, URI namespaceURI, String localName, com.globalmentor.net.MediaType contentType) throws IOException Writes a doctype along with an optional XML declaration to the string builder and sets the output content type. No system ID or public ID will be written.- Parameters:
writeXMLDeclaration
- Whether an XML declaration should be included before the doctype.namespaceURI
- The URI of the XML namespace of document element, ornull
if there is no namespace.localName
- The local name of the document element with no prefix.contentType
- The specific XML content type.- Throws:
NullPointerException
- if the given content type isnull
.IOException
- if there is an error writing the information.
-
writeDocType
void writeDocType(boolean writeXMLDeclaration, URI namespaceURI, String localName, String publicID) throws IOException Writes a doctype along with an optional XML declaration to the string builder and sets the output content type. The system ID and content type will be determined from the given public ID.- Parameters:
writeXMLDeclaration
- Whether an XML declaration should be included before the doctype.namespaceURI
- The URI of the XML namespace of document element, ornull
if there is no namespace.localName
- The local name of the document element with no prefix.publicID
- The XML declaration public ID.- Throws:
NullPointerException
- if the given public ID isnull
.IllegalArgumentException
- if a system ID could not be determined from the given public ID.IOException
- if there is an error writing the information.
-
writeDocType
void writeDocType(boolean writeXMLDeclaration, URI namespaceURI, String localName, String publicID, String systemID, com.globalmentor.net.MediaType contentType) throws IOException Writes a doctype along with an optional XML declaration to the string builder and sets the output content type.- Parameters:
writeXMLDeclaration
- Whether an XML declaration should be included before the doctype.namespaceURI
- The URI of the XML namespace of document element, ornull
if there is no namespace.localName
- The local name of the document element with no prefix.publicID
- The XML declaration public ID, ornull
if none is used.systemID
- The XML declaration system ID, ornull
if one can be determined from the given public ID.contentType
- The specific XML content type, ornull
if a content type should be determined from the public ID; otherwise will default to "text/xml".- Throws:
IllegalArgumentException
- if a system ID was not provided or one could not be determined from the given public ID.IOException
- if there is an error writing the information.
-
writeElementBegin
XMLDepictContext.ElementState writeElementBegin(URI namespaceURI, String localName) throws IOException Begins an XML element that will not be an empty element, even if it has no content.- Parameters:
namespaceURI
- The URI of the XML namespace of the element, ornull
if there is no namespace.localName
- The local name of the element with no prefix.- Returns:
- The state of the element being written.
- Throws:
IOException
- if there is an error writing the information.
-
writeElementBegin
XMLDepictContext.ElementState writeElementBegin(URI namespaceURI, String localName, boolean isEmptyElementAllowed) throws IOException Begins an XML element, specifying whether an empty element is allowed.- Parameters:
namespaceURI
- The URI of the XML namespace of the element, ornull
if there is no namespace.localName
- The local name of the element with no prefix.isEmptyElementAllowed
- Whether an empty element can be created if there is no content.- Returns:
- The state of the element being written.
- Throws:
IOException
- if there is an error writing the information.
-
writeElementEnd
XMLDepictContext.ElementState writeElementEnd(URI namespaceURI, String localName) throws IOException Ends an XML element.- Parameters:
namespaceURI
- The URI of the XML namespace of the element, ornull
if there is no namespace.localName
- The local name of the element with no prefix.- Returns:
- The state of the element being written.
- Throws:
NoSuchElementException
- if the element state stack is empty.IllegalStateException
- if the given namespace URI and/or local name does not match that of the currently open element.IOException
- if there is an error writing the information.
-
writeAttribute
Writes an attribute of an XML element. The attribute value will be properly encoded for XML.- Parameters:
namespaceURI
- The URI of the XML namespace of the attribute, ornull
if there is no namespace.localName
- The local name of the attribute with no prefix.value
- The unencoded value of the attribute.- Throws:
NoSuchElementException
- if the element state stack is empty.IOException
- if there is an error writing the information.
-
writeCommentOpen
Writes the beginning part of an XML comment.- Throws:
IllegalStateException
- if the comment has already been opened but not closed.IOException
- if there is an error writing the information.- See Also:
-
writeCommentClose
Writes the ending part of an XML comment.- Throws:
IllegalStateException
- if the comment has not been opened or has already been closed.IOException
- if there is an error writing the information.- See Also:
-
writeComment
Writes an XML comment. This method ensures that any open beginning tag has been closed.- Parameters:
comment
- The comment to write.- Throws:
IOException
- if there is an error writing the information.- See Also:
-