OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Help XML Pattern Matching

[ Lists Home | Date Index | Thread Index ]

	Need help on why i cant get result with this synthax. Highlighted in

Appreciate any help!

	<title>Partial Text Search</title>
<xml id='courselist' src="/XML Training/Demos/DOM Tree/courses.xml"></xml>

<script language="javascript">
var theXML, myNodeList, textToSearch;
var strNode = "";
var matches=0;

function showMatches() {

	theXML = courselist.XMLDocument;
	textToSearch = document.forms[0].searchtext.value;
	myNodeList = theXML.selectNodes('course');
	strNode += "<table border='1'><tr><th>Course
	strNode += "<th>Course
	for (var count=0; count<myNodeList.length; ++count) {
		theItem = myNodeList(count);		
		if (theItem.text.match(textToSearch)) {
			//Build a row with a pink background for matching
			strNode += "<tr bgcolor=#ffcccc>";
		} else {
			//Build a row with a white background for
non-matching rows
			strNode += "<tr>";
		strNode += "<td>" + theItem.childNodes[0].text + "</td>"
		strNode += "<td>" + theItem.childNodes[1].text + "</td>";
		strNode += "<td>" + theItem.childNodes[2].text + "</td>";
		strNode += "<td>" + theItem.childNodes[3].text + "</td>";
		strNode += "<td>" + theItem.childNodes[4].text +
	strNode += "</table>";
	strNode += "<h3>Number of matches: " + matches + "</h3>";
	strNode += "Press your reload button to try another search.";
	dataTarget.innerHTML = strNode;


<div align="center" id="dataTarget">
	<h2>Course Information Search</h2>
	Please enter a value to search for in our course list<br> 
	(partial queries OK): <input name="searchtext"><br><br>
	<input type="Button"
       value="Search the XML Document"


Thanks & BR;
~erwin s.


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS