org.w3c.mwi.mobileok.basic
Class DecodedContent

java.lang.Object
  extended by org.w3c.mwi.mobileok.basic.DecodedContent
Direct Known Subclasses:
ImageContent, NotSupportedContent, RetrievalFailedContent, TextContent

public abstract class DecodedContent
extends java.lang.Object

Represents the decoded content of a resource.

The abstract class must be extended by the different content representations being handled by the Checker.

Version:
$Revision: 1.1 $
Author:
Francois Daoust

Constructor Summary
DecodedContent()
           
 
Method Summary
protected static void addByteErrorMessages(org.w3c.dom.Document document, org.w3c.dom.Node parent, java.lang.Iterable<ValidationByteMessage> messageList)
          Adds a representation of the given list of ValidationByteMessage error messages to the given Node.
protected static void addLineAndColumnMessages(org.w3c.dom.Document document, org.w3c.dom.Node parent, java.lang.Iterable<ValidationLineAndColumnMessage> messageList, java.lang.String type)
          Adds a representation of the given list of ValidationLineAndColumnMessage error messages to the given Node.
abstract  boolean isValid()
          Returns true when the content could be successfully decoded.
abstract  org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document, org.w3c.dom.Node parent)
          Serializes the content to its moki representation as a DOM node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecodedContent

public DecodedContent()
Method Detail

isValid

public abstract boolean isValid()
Returns true when the content could be successfully decoded.

Returns:
true when the content is valid, false otherwise.

toMokiNode

public abstract org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document,
                                            org.w3c.dom.Node parent)
Serializes the content to its moki representation as a DOM node.

Parameters:
document - DOM document the created node should belong to
parent - DOM node to which the representation should be appended.
Returns:
the moki representation of the resource as a DOM node.

addLineAndColumnMessages

protected static void addLineAndColumnMessages(org.w3c.dom.Document document,
                                               org.w3c.dom.Node parent,
                                               java.lang.Iterable<ValidationLineAndColumnMessage> messageList,
                                               java.lang.String type)
Adds a representation of the given list of ValidationLineAndColumnMessage error messages to the given Node.

Parameters:
document - the document containing the Node to complete
parent - the Node that is to contain the representation of the list.
messageList - the list of validation errors to represent.
type - the name of the element that should contain each error (e.g. "error").

addByteErrorMessages

protected static void addByteErrorMessages(org.w3c.dom.Document document,
                                           org.w3c.dom.Node parent,
                                           java.lang.Iterable<ValidationByteMessage> messageList)
Adds a representation of the given list of ValidationByteMessage error messages to the given Node.

Parameters:
document - the document containing the Node to complete
parent - the Node that is to contain the representation of the list.
messageList - the list of validation errors to represent.