Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP & XML !

Status
Not open for further replies.

111333

Programmer
Feb 3, 2005
4
IN
I have 2 files, ASP and XML.

I would like to put HTML tags like <b> Bold </b> in the XML file and have the output show in ASP page.

How can I do so in XML file ?
 
You can just have a node in the XML as follows:
<ROOT>
<TextOut>
<b>text to be bolded</b>
</TextOut>
</ROOT>

The ASP Code would be as follows:

Dim objDom
Dim objRoot
Dim objField
Dim strFile

strFile = PathToFile

'XML file object
Set objDom = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)
objDom.async = False
strXMLFile = Server.MapPath(strFile)
objDom.Load (strXMLFile)

'Root XML Field
Set objRoot = objDom.documentElement

'collect information from nodes
Set objField = objRoot.selectSingleNode(&quot;TextOut&quot;)

'This outputs ALL of the content in the TextOut node
Response.Write(objField.Text)

'Release variables
Set objDom = Nothing
Set objRoot = Nothing
Set objField = Nothing

Pretty smart stuff, this code works: I've tested it.

May the force be with you,
sjuarez1979
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top