Question: Constructor Detail TagElement public TagElement(java.lang.String tagName, boolean endTag, Element content, java.lang.String attributes) Initializes a tag element. We can have tag elements with only a start

Constructor Detail

TagElement

public TagElement(java.lang.String tagName, boolean endTag, Element content, java.lang.String attributes)

Initializes a tag element. We can have tag elements with only a start tag. Each time a new tag element is created it is assigned a unique id (starting at 1).

Parameters:

tagName -

endTag -

content -

attributes -

Method Detail

getId

public int getId()

Returns:

unique id

getStringId

public java.lang.String getStringId()

Returns:

tagname followed by the unique id

getStartTag

public java.lang.String getStartTag()

Returns the start tag. It will not include the id if inclusion has been disabled.

Returns:

string representing the start tag including attributes (if any).

getEndTag

public java.lang.String getEndTag()

Returns:

end tag or empty string (for tags with only start tag).

setAttributes

public void setAttributes(java.lang.String attributes)

Updates attributes field.

Parameters:

attributes -

resetIds

public static void resetIds()

Allow us to start assigning ids at 1 again.

enableId

public static void enableId(boolean choice)

Allow us to enable or disable the generation of ids for tags.

Parameters:

choice -

genHTML

public java.lang.String genHTML(int indentation)

{

Description copied from interface: Element

Returns a string that represents the HTML associated with the element. The string is indented based on the parameter value.

Specified by:

genHTML in interface Element

Returns:

HTML associated with the element.

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!