com.ibm.workplace.wcm.api
Interface HTMLComponent

All Superinterfaces:
ContentComponent, WCMApiObject

public interface HTMLComponent
extends ContentComponent

Represents a HTML component.

A HTMLComponent is a ContentComponent and cannot be stored as a separate entity in the repository.

A HTMLComponent can contain HTML. This interface provides methods to retrieve and set the HTML contained within this component.

note: since v6.0.0, a HTMLComponent is referred to as an "HTML Element" in the Authoring UI.

See Also:
ContentComponent

Method Summary
 DocumentType<? extends HTMLComponent> getDocumentType()
          Returns the DocumentType of the ContentComponent.
 java.lang.String getHTML()
          Returns the HTML contained in this component as a String.
 void setHTML(java.lang.String html)
          Sets the HTML contained in this HTMLComponent.
 void setHTML(java.lang.String html, com.ibm.workplace.wcm.api.EmbeddedImageMap images)
          Deprecated. This method is deprecated from version 6.0. Use setHTML(String) instead.
 
Methods inherited from interface com.ibm.workplace.wcm.api.ContentComponent
getContainer, getName, getTitleTextProviderKey, getTitleTextProviderName, setTitleTextProviderKey, setTitleTextProviderName
 

Method Detail

getDocumentType

DocumentType<? extends HTMLComponent> getDocumentType()
Description copied from interface: ContentComponent
Returns the DocumentType of the ContentComponent.

Specified by:
getDocumentType in interface ContentComponent
Returns:
the type
See Also:
ContentComponent.getDocumentType()

getHTML

java.lang.String getHTML()
Returns the HTML contained in this component as a String.

Returns an empty String if the HTML could not be retrieved.

Returns:
the HTML

setHTML

void setHTML(java.lang.String html)
             throws ParseException,
                    com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Sets the HTML contained in this HTMLComponent.

Note. This method replaces any existing HTML in this component. It does not append to existing HTML.

Parameters:
html - the HTML
Throws:
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if the string argument is null or the HTML could not be set
ParseException - if there were errors in parsing the html

setHTML

void setHTML(java.lang.String html,
             com.ibm.workplace.wcm.api.EmbeddedImageMap images)
             throws ParseException,
                    com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Deprecated. This method is deprecated from version 6.0. Use setHTML(String) instead.

Sets the HTML contained in this HTMLComponent from the specified html argument that contains embedded images. The URL from the src attribute of the img tag must have a corresponding entry in an EmbeddedImageMap object that you add via the addImage method.

A WCM resource is created for the image when you save the workspace The src attribute in the img tag will be replaced by a WCM resource's url. If the same URL appears in the HTML more than once, the same WCM resource will be used.

Note. This method replaces any existing HTML in this component. It does not append to existing HTML. Existing images will be removed, new images will be added.

Example code:

  File file = new File("C:/example/image.jpg");
  EmbeddedImageMap embeddedImage = new EmbeddedImageMap();
  embeddedImage.addImage("c:/example/image.jpg", file);

  // Set HTML
  htmlComponent.setHTML(html, embeddedImage);
 

Parameters:
html - the HTML
images - a map of URLs to images
Throws:
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if the string argument is null or the HTML could not be set
ParseException - if there were errors in parsing the html