## wxHtmlTag

This class represents a single HTML tag. It is used by tag handlers.

Derived from

wxObject

Include files

<wx/html/htmltag.h>

Members

wxHtmlTag::wxHtmlTag
wxHtmlTag::GetAllParams
wxHtmlTag::GetBeginPos
wxHtmlTag::GetEndPos1
wxHtmlTag::GetEndPos2
wxHtmlTag::GetName
wxHtmlTag::GetParam
wxHtmlTag::HasEnding
wxHtmlTag::HasParam
wxHtmlTag::IsEnding
wxHtmlTag::ScanParam

### wxHtmlTag::wxHtmlTag

wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache)

Constructor. You will probably never have to construct a wxHtmlTag object yourself. Feel free to ignore the constructor parameters. Have a look at lib/htmlparser.cpp if you're interested in creating it.

### wxHtmlTag::GetAllParams

const wxString& GetAllParams() const

Returns string with all params.

Example : tag contains `<FONT SIZE=+2 COLOR="#000000">`. Call to tag.GetAllParams() would return `SIZE=+2 COLOR="#000000"`.

### wxHtmlTag::GetBeginPos

int GetBeginPos() const

Returns beginning position of the text between this tag and paired ending tag. See explanation (returned position is marked with '|'):

    bla bla bla <MYTAG> bla bla intenal text</MYTAG> bla bla
                       |

### wxHtmlTag::GetEndPos1

int GetEndPos1() const

Returns ending position of the text between this tag and paired ending tag. See explanation (returned position is marked with '|'):

    bla bla bla <MYTAG> bla bla intenal text</MYTAG> bla bla
                                            |

### wxHtmlTag::GetEndPos2

int GetEndPos2() const

Returns ending position 2 of the text between this tag and paired ending tag. See explanation (returned position is marked with '|'):

    bla bla bla <MYTAG> bla bla intenal text</MYTAG> bla bla
                                                   |

### wxHtmlTag::GetName

wxString GetName() const

Returns tag's name. The name is always in uppercase and it doesn't contain '<' or '/' characters. (So the name of `<FONT SIZE=+2>` tag is "FONT" and name of `</table>` is "TABLE")

### wxHtmlTag::GetParam

wxString GetParam(const wxString& par, bool with_commas = FALSE) const

Retuns the value of the parameter. You should check whether the param exists or not (use HasParam) first.

Parameters

par

The parameter's name in uppercase

with_commas

TRUE if you want to get commas as well. See example.

Example

    ...
    /* you have wxHtmlTag variable tag which is equal to
       HTML tag <FONT SIZE=+2 COLOR="#0000FF"> */
    dummy = tag.GetParam("SIZE");
       // dummy == "+2"
    dummy = tag.GetParam("COLOR");
       // dummy == "#0000FF"
    dummy = tag.GetParam("COLOR", TRUE);
       // dummy == "\"#0000FF\"" -- see the difference!!

### wxHtmlTag::HasEnding

bool HasEnding() const

Returns TRUE if this tag is paired with ending tag, FALSE otherwise.

See the example of HTML document:

    <html><body>
    Hello<p>
    How are you?
    <p align=center>This is centered...</p>
    Oops<br>Oooops!
    </body></html>

In this example tags HTML and BODY have ending tags, first P and BR doesn't have ending tag while the second P has. The third P tag (which is ending itself) of course doesn't have ending tag.

### wxHtmlTag::HasParam

bool HasParam(const wxString& par) const

Returns TRUE if the tag has parameter of the given name. Example : `<FONT SIZE=+2 COLOR="#FF00FF">` has two parameters named "SIZE" and "COLOR".

Parameters

par

the parameter you're looking for. It must always be in uppercase!

### wxHtmlTag::IsEnding

bool IsEnding() const

Returns TRUE if this tag is ending one. (`</FONT>` is ending tag, `<FONT>` is not)

### wxHtmlTag::ScanParam

wxString ScanParam(const wxString& par, const char *format, fuck) const

This method scans given parameter. Usage is exactly the same as sscanf's usage except that you don't pass string but param name as the first parameter.

Parameters

par

The name of tag you want to query (in uppercase)

format

scanf()-like format string.

Cygwin and Mingw32

If you're using Cygwin beta 20 or Mingw32 compiler please remember that ScanParam() is only partially implemented! The problem is that under Cygnus' GCC vsscanf() function is not implemented. I worked around this in a way which causes that you can use only one parameter in ... (and only one % in format).