Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  XML (Extensible Markup Language)

IXMLDOMNode::get_text Method


Contains the text content of the node and its subtrees.

Syntax

HRESULT get_text(
    BSTR * text);

Parameters

text
[out] String representing the text content of this node and its descendants. This value varies depending on the value of the nodeType property.

IXMLDOMNode::put_text Method


Contains the text content of the node and its subtrees.

Syntax

HRESULT put_text(
    BSTR * text);

Parameters

text
[out] String representing the text content of this node and its descendants. This value varies depending on the value of the nodeType property.

Return Value

Returns S_OK if successful, or an error code otherwise.

Remarks

This value depends on the value of the nodeType property:

NODE_ATTRIBUTE
,
NODE_DOCUMENT
,
NODE_ENTITY
Returns a string representing the value of the node. This is the concatenated text of all subnodes with entities expanded.
NODE_CDATA_SECTION
,
NODE_COMMENT
,
NODE_PROCESSING_INSTRUCTION
,
NODE_TEXT
Returns the text contained in the node, which is the same as the nodeValue property.
NODE_DOCUMENT_TYPE
,
NODE_NOTATION
Returns the empty string (""). These node types do not have associated text.
NODE_DOCUMENT_FRAGMENT
Returns the text comprised of the concatenation of all descendant nodes.
NODE_ELEMENT
Contains a string that represents the element content. Note that this will also include the text content from all child elements, concatenated in document order. For example, consider the following XML:

<count>
  <item>one</item>
  <item>two</item>
  <item>three</item>
  <item>four</item>
</count>

The text property for the "count" element contains the value "onetwothreefour".

NODE_ENTITY_REFERENCE
Returns the string representation of the entity reference.

Setting the text property is allowed only on nodes that allow write operations. It is not allowed on read-only nodes, such as NODE_DOCUMENT_FRAGMENT, NODE_DOCUMENT_TYPE, NODE_ENTITY, NODE_ENTITY_REFERENCE, and NODE_NOTATION.

Note that when writing this property, the supplied value applies to all nodes beneath it in the tree. Setting the text property has the result of deleting the nodes containing substructure and inserting a single new child text node with the supplied text. For example, consider the following XML:


<count>
  <item>one</item>
  <item>two</item>
  <item>three</item>
  <item>four</item>
</count>

Immediately after setting the text property of the count element node to zero, the XML property for that node contains the new value:


<count>zero</count>

See Also

IXMLDOMNode


Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site