BizTalk Utilities CV ,   Jobs ,   Code library  
 
 

Microsoft DOM Objects Reference

Download ReferenceDownload this Reference 

Previous PageTable Of ContentsIndexNext Page

text

Is a member of:
DOMDocument
XMLDOMNode
XMLDOMAttribute
XMLDOMCDATASection
XMLDOMComment
XMLDOMDocumentFragment
XMLDOMDocumentType
XMLDOMElement
XMLDOMEntity
XMLDOMEntityReference
XMLDOMNotation
XMLDOMProcessingInstruction
XMLDOMText
XTLRuntime

Syntax

strValue = objXMLDOMNode.text

Remark

For writing the values to a Node, the text property is used. The text property normalizes white space, unless the DOMDocument has been specified to preserve the white space (see the preserveWhiteSpace property).

When reading the value of a Node, using the text property can lead to some strange behavior if your current Node has children.

Example

The following XML example explains what we meant by the previous comment.

<PEOPLE>

<PERSON id="1">

<NAME>Mark Wilson</NAME>

<ADDRESS>911 Somewhere Circle, Canberra, Australia</ADDRESS>

<TEL>(++612) 12345</TEL>

<FAX>(++612) 12345</FAX>

<EMAIL>markwilson@somewhere.com</EMAIL>

</PERSON>

....

</PEOPLE>

For the other properties, like the nodeType property, we explained how to get references to CDATA sections, etc. However, if you are looking for the text of a Node and are not too concerned about interrogating whether the subchildren consist of CDATA sections or entities, then just getting the text property will return the parsed data of your element.

In our example we have loaded our DOMDocument, which consists of our People2.xml file. We then get a reference to the firstChild property (objNode = '<PERSON id="1">') of the documentElement property:

Dim objDOMDocument As DOMDocument

Dim objNode As IXMLDOMNode

Dim strText as String

Set objDOMDocument = New DOMDocument

objDOMDocument.async = False

objDOMDocument.resolveExternals = True

objDOMDocument.validateOnParse = True

objDOMDocument.Load "http://localhost/xmlcode/people2.xml"

Set objNode = objDOMDocument.documentElement.firstChild

strText = objNode.text

Our objNode has child Nodes; therefore, its text property returns the values of all its child Nodes. The string strText returns the following:

Mark Wilson 911 Somewhere Circle, Canberra, Australia (++612) 12345 (++612) 12345 markwilson@somewhere.com"

The value return has all the tags, and the less than (<) and greater than (>) signs have been removed, with a space inserted between each child for the current Node.

Previous PageTable Of ContentsIndexNext Page

This manuscript is an abridged version of a chapter from the Manning Publications book XML Programming with VB and ASP. This chapter looks at the Microsoft DOM objects. NOTE: Most images have been removed to increase speed and many of the code comments have also been removed for presentation. Please purchase the book to enjoy the full experience of all the chapters with images and code comments!

 

Recent Jobs

Integration Specialist Needed - Wor
Virtualization Server Infrastructur
A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En

View all Jobs (Add yours)
View all CV (Add yours)



Information Online

swimming pool contractor
chicago web site design
teleconferencing service
Web Hosting
spoc
Calvin klein sunglasses
answering service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP