隨筆-47  評論-14  文章-0  trackbacks-0
           
          一個客戶提供一個股價的信息,要求放在頁面上,顯示一些數(shù)據(jù),需要從遠程獲取xml,然后解析寫在網(wǎng)頁上,開始不會覺得很難,其實蠻簡單的,先用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("http://last").text
                       document.write(text);
                       </script>
          http://****.com/scripts/****.asp?subcode=C22 ,是客戶提供的頁面,其實是xml的內(nèi)容,這里直接調(diào)用windows的組件進行讀取,然后調(diào)用其中一個selectSingleNode的方法,讀出last字段的內(nèi)容;
          VBscript也寫了一個,其實差不多,不過有一點不同,asp中VB的不能直接讀取遠程xml的內(nèi)容,很奇怪,不知道是不是由于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("http://last").text
            response.write price
            Set http=Nothing
            Set XMLMorntekDocument=Nothing

          這里先用XMLHTTP的方法,get到xml文件,然后再解析。
          posted @ 2005-04-16 14:03 Stephen 閱讀(292) | 評論 (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 閱讀(731) | 評論 (0)編輯 收藏
               摘要: 1. ASP與Access數(shù)據(jù)庫連接: dim conn,mdbfile  mdbfile=server.mappath("數(shù)據(jù)庫名稱.mdb")  set conn=server.createobject("adodb.connection")  'conn.open "driver={microsoft ac...  閱讀全文
          posted @ 2005-04-16 09:01 Stephen 閱讀(231) | 評論 (0)編輯 收藏
          我可以定義自己css??
          posted @ 2005-04-04 12:04 Stephen 閱讀(395) | 評論 (3)編輯 收藏

          厭煩了csdn的錯誤,搬個新房子,風(fēng)格還不錯~I like it.

          posted @ 2005-04-04 11:50 Stephen 閱讀(157) | 評論 (0)編輯 收藏
          僅列出標(biāo)題
          共5頁: 上一頁 1 2 3 4 5 
          主站蜘蛛池模板: 亚东县| 宣汉县| 和田市| 平乡县| 星子县| 藁城市| 文山县| 万荣县| 博白县| 景洪市| 清苑县| 鸡泽县| 新平| 浪卡子县| 留坝县| 和平区| 昔阳县| 四子王旗| 积石山| 新闻| 都匀市| 靖西县| 禹州市| 屏边| 恩施市| 河北区| 化州市| 东港市| 定安县| 手机| 桓台县| 保山市| 台东县| 苏尼特右旗| 永胜县| 元朗区| 酉阳| 喀什市| 静海县| 冀州市| 新巴尔虎右旗|