Question about node.text property

Question about node.text property

Post by Glen Coope » Wed, 23 Jun 1999 04:00:00



How can I access the text property of a node and not get the text of all
sub-nodes?

Thanks!
Glen

 
 
 

Question about node.text property

Post by bob thicken » Wed, 23 Jun 1999 04:00:00


reference the node and use the value property to get only a specific
element's content.


Quote:> How can I access the text property of a node and not get the text of all
> sub-nodes?

> Thanks!
> Glen


 
 
 

Question about node.text property

Post by bob thicken » Thu, 24 Jun 1999 04:00:00


glen,
You need to reference the specific element's value property.  The text is
all text which is contained by the node, ie all children of the node as well
as the node itself.
You may reference the specific element by getting the nodemap or
namednodelist
hth bob


Quote:> How can I access the text property of a node and not get the text of all
> sub-nodes?

> Thanks!
> Glen

 
 
 

1. Probs with automatic HTML encoding using Text property of node

Hi guys

I'm writing a small content management tool for a websites news section. On
one screen I have a textarea where the users can enter newsupdates with HTML
tags. The problem is that the HTML tags are automatically escaped, < will be
converted to &lt; and so on. I'm desperate here guys as I'm facing a dead
line. I'm not an expert in XML at all.

Well anyways here's the code, if you have any questions please send me an
email, the variables 'Title' and 'Details' may contain HTML tags:

var Title =  String ( Request.Form("title") ) ;
var Details = String (  Request.Form("details") ) ;

var xmlDoc = Server.CreateObject("Microsoft.XMLDOM");

xmlDoc.async="false";
xmlDoc.validateOnParse="true";
xmlDoc.load(Server.MapPath("news.xml"));

if(xmlDoc.parseError.errorCode==0)
{
 var xsl = new ActiveXObject("Microsoft.XMLDOM");
 xsl.async = false;
 xsl.load("news.xsl");

 nodes = xmlDoc.documentElement.childNodes;

   nodes.item ( 0 ).setAttribute ( "DATE" , Date ( ) ) ;
   news = nodes.item ( 0 ).childNodes;
   news.item ( 0 ).text = Title ;
   news.item ( 1 ).text = Details ;

 xmlDoc.save ( Server.MapPath ( "news.xml" ) ) ;
 Response.redirect ( "main.asp#news" ) ;
...
...

News.xml looks like this:
<?xml version="1.0"?>
<!DOCTYPE NEWSES SYSTEM "news.dtd">
<NEWSES>
 <NEWS DATE="Thu May 31 17:33:39 2001">
  <TITLE>NEWS FLASH!!</TITLE>
  <DETAILS>Dit is een test op Homer</DETAILS>
 </NEWS>
</NEWSES>

News.dtd looks like:
<!ELEMENT NEWSES (NEWS)>
<!ELEMENT NEWS (TITLE,DETAILS)>

<!ELEMENT TITLE (#PCDATA)>
<!ELEMENT DETAILS (#PCDATA)>

<!ATTLIST NEWS DATE CDATA #REQUIRED>

I appreciate any help.

Gabriel Lozano-Morn
Software Engineer
Harte-Hanks CRM Services Belgium

2. PGP5, Pine3.96(unix), display and reply

3. Text node or no Text node

4. WMDM PMSP Service in Event viewer ?

5. Question on the SAX dom-node property

6. IOS 11.3(1) and ISDN AOC

7. XPath Syntax Question (How to select text only from mixed node)

8. NT to 2K migration

9. Simple XPath query question involving text node

10. How to change text in text node?

11. parse out text and link text out of same node

12. How can I select text nodes which contain certain text by XPath Pattern?

13. carriage return and text property