IXMLElement::get_textIXMLElement::get_text*
*



Contents  *



Index  *Topic Contents
*Previous Topic: IXMLElement::get_type
*Next Topic: IXMLElement::put_text

IXMLElement::get_text

HRESULT IXMLElement::get_text(
    BSTR *pContent)

Returns the content of text and comment elements.

pContent
Indirect pointer in which to return the content. The caller must free any returned content by using SysFreeString.

The content of a text element is the text between the tags. Consider the following elements:

<CHANNEL>
<TITLE>Top Stories</TITLE>
    .
    .
    .
</CHANNEL>

The text element child of the TITLE element has the content "Top Stories". Here the TITLE element has one child, which is the text element, and this child has the content "Top Stories".

However, calling IXMLElement::get_text on the TITLE element strips markup from the content within the TITLE tag. Use this method to get all the text in a tag. For example:

<TITLE>
This is <H> bold </H> text
</TITLE>

A good downlevel client should use "This is bold text" after stripping away any markup by calling IXMLElement::get_text on the TITLE element.

Finally, the content of a comment element is the comment. For example, the following example has the name "!" and has the content " This is a comment ".

<! This is a comment />

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.