一个客户提供一个股价的信息,要求放在页面上,显示一些数据,需要从远程获取xml,然后解析写在网页上,开始不会觉得很难,其实蛮简单的,先用javascript写了一个:
            <script language=javascript>
             var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
             xmlDoc.async="false";
             xmlDoc.load("
http://****.com/scripts/****.asp?subcode=C22");
             nodes = xmlDoc.documentElement.childNodes;
             var text = xmlDoc.selectSingleNode("//last").text
             document.write(text);
             </script>
http://****.com/scripts/****.asp?subcode=C22 ,是客户提供的页面,其实是xml的内容,这里直接调用windows的组件进行读取,然后调用其中一个selectSingleNode的方法,读出last字段的内容;
VBscript也写了一个,其实差不多,不过有一点不同,asp中VB的不能直接读取远程xml的内容,很奇怪,不知道是不是由于VB的限制:
  dim XMLMorntekDocument 
  Set http=Server.CreateObject("Microsoft.XMLHTTP")
  http.Open "GET","
http://****com/scripts/******.asp?subcode=C22",False  http.send
  Set XMLMorntekDocument=Server.CreateObject("Microsoft.XMLDOM")
  XMLMorntekDocument.Async=False
  XMLMorntekDocument.ValidateOnParse=False
  XMLMorntekDocument.Load(http.ResponseXML)
  price = XMLMorntekDocument.selectSingleNode("//last").text
  response.write price
  Set http=Nothing
  Set XMLMorntekDocument=Nothing
这里先用XMLHTTP的方法,get到xml文件,然后再解析。
			
posted @ 
2005-04-16 14:03 Stephen 阅读(294) | 
评论 (0) | 
编辑 收藏 
		
			
		
			
			import java.io.*;
import java.util.regex.*;
public class test{
 public static void main(String[] args){
  try{
   String s = "";
   while(!s.equals("q")){
    System.out.print("input:");
    DataInputStream in = new DataInputStream(new BufferedInputStream(System.in));
    s = in.readLine();
    System.out.println("your input is :"+s);
    String check = "^([a-z0-9A-Z]+[-|\\._]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
    Pattern regex = Pattern.compile(check);
                Matcher matcher = regex.matcher(s);
                boolean isMatched = matcher.matches();
                if(isMatched){
                 System.out.println("it's a email");
             }else{
              System.out.println("it's not a email");
             } 
    
   }
        }catch(Exception e){
         System.out.println("error"+e.getMessage());
     }
 }          
}
			posted @ 
2005-04-16 14:02 Stephen 阅读(736) | 
评论 (0) | 
编辑 收藏 
		
			
		
			
			     摘要: 1. ASP与Access数据库连接: 
dim conn,mdbfile  mdbfile=server.mappath("数据库名称.mdb")  set conn=server.createobject("adodb.connection")  'conn.open "driver={microsoft ac...  
阅读全文
			posted @ 
2005-04-16 09:01 Stephen 阅读(233) | 
评论 (0) | 
编辑 收藏 
		
			
		
			
			我可以定义自己css??
			
posted @ 
2005-04-04 12:04 Stephen 阅读(398) | 
评论 (3) | 
编辑 收藏 
		
			
		
			
			厌烦了csdn的错误,搬个新房子,风格还不错~I like it.
			posted @ 
2005-04-04 11:50 Stephen 阅读(159) | 
评论 (0) | 
编辑 收藏