¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 
°Ô½Ã¹° 88°Ç
 
xml ÆĽÌ
±Û¾´ÀÌ : ÀÌ°æ¿ë                   ³¯Â¥ : 2010-10-05 (È­) 18:09 Á¶È¸ : 7983

¾Èµå·ÎÀ̵忡¼­´Â xml °ü·Ã ¼ö´Üµé·Î SAX¿Í DOM ±×¸®°í XmlPullParser¸¦ »ç¿ëÇÏ°í ÀÖ´Ù.
XmlPullParser´Â SAXó·³ XML¹®¼­¸¦ ÀÐ¾î ³ª°¡¸é¼­ ÅÂ±×¿Í ÅؽºÆ®¸¦ ±×¶§±×¶§ ó¸®ÇÑ´Ù.
±×·¯³ª SAXó·³ ó¸®ºÎ Ŭ·¡½º¿Í ÄÝ¹é ¸Þ¼­µåµéÀ» ±¸ÇöÇØ¾ß ÇÏ´Â °ÍÀº ¾Æ´Ï´Ù.
Äڵ忡¼­´Â ÀûÀýÇÑ ¸Þ¼­µå¸¦ ·çÇÁ·Î ¹Ýº¹ È£ÃâÇϸ鼭 °¢ »ç°ÇÀ» ó¸®ÇÏ¸é µÈ´Ù.

XMLPulParserÀÇ next() / getEventType() °¡ µ¹·ÁÁÖ´Â »ç°ÇµéÀº ´ÙÀ½°ú °°´Ù.
1.START_TAG : ¿ä¼ÒÀÇ ½ÃÀÛ ÅÂ±× ( ex: <tag> )¸¦ ¸¸³µÀ» ¶§ ÀÌ »ç°ÇÀÌ ¹ÝȯµÈ´Ù.
2.TEXT: ¿ä¼ÒÀÇ ÅؽºÆ®(ex:<tag>text</tag>ÀÇ text)¸¦ ¸¸³µÀ» ¶§ ÀÌ »ç°ÇÀÌ ¹ÝȯµÈ´Ù.
3.END_TAG: ¿ä¼ÒÀÇ Á¾·á ű×(ex:</tag>)¸¦ ¸¸³µÀ» ¶§ ÀÌ »ç°ÇÀÌ ¹ÝȯµÈ´Ù.
4.END_DOCUMENT: XML ÆÄÀÏÀÇ ³¡¿¡ µµ´ÞÇßÀ» ¶§ ÀÌ »ç°ÇÀÌ ¹ÝȯµÈ´Ù.

XmlPullParser¸¦ ÀÌ¿ëÇؼ­ Á¦ ºí·Î±×ÀÇ rssÇǵå Áß titleÀ» ºÒ·¯¿À´Â ¿¹Á¦ÀÔ´Ï´Ù.

 *******   ²À uses-permission Ãß°¡ÇØÁÖ¼¼¿ä ********
<uses-permission android:name="android.permission.INTERNET"/>
package com.iyearbook;

import java.io.InputStream;
import java.net.URL;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class Main extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        try{
         URL text = new URL( "http://ibookapp.tistory.com/rss" );
         
         XmlPullParserFactory parserCreator = XmlPullParserFactory.newInstance();
         XmlPullParser parser = parserCreator.newPullParser();
         
         parser.setInput( text.openStream(), null );
         
         TextView status = (TextView) findViewById( R.id.status );
         
         status.setText("ÆÄ½Ì Áß..");
         int parserEvent = parser.getEventType();
                String tag;
         boolean inTitle = false;         
         while (parserEvent != XmlPullParser.END_DOCUMENT ){
            switch(parserEvent){
          
           case XmlPullParser.TEXT:
            
            tag = parser.getName();
                        if (inTitle) {
                            //if (tag.compareTo("title") == 0) {
                             Log.i("dd", "title = " + parser.getText() );
                            //}                         
                        }
            
           break;
                    case XmlPullParser.END_TAG:
                        tag = parser.getName();
                        if (tag.compareTo("title") == 0) {
                            inTitle = false;
                        }
                     break;           
                    case XmlPullParser.START_TAG:
                        tag = parser.getName();

                        if (tag.compareTo("title") == 0) {
                            inTitle = true;
                        }
                    break;
          }
          parserEvent = parser.next();
         }
         status.setText("ÆÄ½Ì ³¡");
        }catch( Exception e ){
         Log.e("dd", "Error in network call", e);
        }
    }
}


Ãâó : http://ibookapp.tistory.com/6

* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)




ÀÌ°æ¿ë ´ÔÀÇ Tip&Tech ÃÖ½Å±Û [´õº¸±â]


 
±è±â¹ü 2010-10-13 (¼ö) 13:48
XmlPullParser À̶ó´Â°ÍÀÌ URL text = new URL( "http://ibookapp.tistory.com/rss" ); ÀÇ ±¸¹®¿¡ ¸µÅ©°É¸°ÆäÀÌÁöÀÇ xml ÆÄÀÏÀ» ºÒ·¯¿Í¼­ º¸¿©ÁÖ´Â °Ç°¡¿ä? ¸·»ó Èê·¯°¡´Â °Éº¸´Ï±ñ ºÒ·¯¿Í¼­ ¹Ù²ãÁÖ´Â°Ç ¾Ë°Ú´Âµ¥
http://ibookapp.tistory.com ÆäÀÌÁö¿¡ ¼³Á¤µÅÀÖ´Â xml ÆÄÀÏÀ» °¡Á®¿Í¼­ ÇÚµåÆù¿¡ °¡Á®¿Â xml ÆÄÀÏÀ» ±×´ë·Î
Àû¿ë½ÃÄѼ­ º¸¿©Áִ°ǰ¡¿ä?? ^^; °Ô½ÃÆÇ ±ÛÀ» º¸´Ï±ñ ¹Ù·Î Áú¹®À» ÇÏ°Ô µÅ³×¿ä.. ÇÏÇÏÇÏ
 
ÀÌ°æ¿ë 2010-10-13 (¼ö) 18:36
XML µ¥ÀÌŸ¸¦ Ç׸ñº°·Î ¹Þ¾Æ¼­ È°¿ëÇÏ´Â °ÍÀε¥ Àû¿ëµÇ´Â ¾ÛÀ¸·Î´Â ´º½º¾Û µîÀÌ ÀÌ¿Í °°Àº ÆĽÌÀ» È°¿ëÇÕ´Ï´Ù.
¿¹¸¦ µé¾î ½ºÆ÷Ã÷¼­¿ï RSS ÁÖ¼Ò·Î XML µ¥ÀÌŸ¸¦ ¹Þ¾Æ¿Í¼­ Ç׸ñº°·Î ÀúÀåÇÕ´Ï´Ù. Á¦¸ñ, °£´Ü³»¿ë, ¸µÅ©, ½æ³×ÀÏÀ̹ÌÁö ÀÌ·¸°Ô ¼¼ºÐÈ­ Çؼ­ ¾Û¿¡¼­ »ç¿ëÀÚ ÆíÀǸ¦ °í·ÁÇؼ­ ´Ù½Ã »Ñ·ÁÁÝ´Ï´Ù. ¶Ç´Â XML µ¥ÀÌŸ¸¦ DB·Î ÀúÀåÇؼ­ º¸¿© Áֱ⵵ ÇÏ°ÚÁÒ.
XML ÆÄÀÏ ÀÀ¿ëÀº ÇѸ¶µð·Î À¥°ú ¾ÛÀÇ Áß°£¿¡ µ¥ÀÌÅÍ Àü´Þ ¸Å°³Ã¼ ¿ªÇÒÀ» ÇÏ´Â °ÍÀ¸·Î ÀÚÁÖ È°¿ëÇÏ°Ô µË´Ï´Ù.
À§ ¼Ò½º´Â RSS ÁÖ¼Ò¿¡¼­ XMLÀ» ¹Þ¾Æ¿Í¼­ ÅÂ±× º°·Î º¯¼ö¿¡ ´ã´Â°Í(ÆĽÌ) ±îÁö¸¸ ÄÚµù µÇ¾î ÀÖ°í È°¿ë ºÎºÐÀº ÄÚµùµÇ¾î ÀÖÁö ¾Ê³×¿ä ^^
 
±è±â¹ü 2010-10-14 (¸ñ) 09:38
À½.. 100% ÀÌÇظ¦ ÇÑ°Ç ¾Æ´ÏÁö¸¸ ¼³¸íÀ» µéÀ¸´Ï Á¶±Ý ÀÌÇØ°¡ µÅ³×¿ä ^^; ´äº¯ °¨»çÇÕ´Ï´Ù.
Çѹø Å×½ºÆ® Çغ¸¸é È®½ÇÈ÷ ÀÌÇظ¦ ÇÒ°Å °°½À´Ï´Ù ¤·¤·; (¸ð¸£¸é ¶Ç Áú¹®ÇÕ´Ï´Ù~ ÇÏÇÏ;;)
 

°Ô½Ã¹° 88°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
8  °­ÀÇ 1ÀÏ pdf +1 ±è±â¹ü 12-23 4058
7  ¾îÇà Á¾·ù ±¸ºÐ ¹× Àå´ÜÁ¡ +6 ±è±â¹ü 12-23 4379
6  JRE ½Ã½ºÅÛ ¶óÀ̹ö·¯¸® °ü·Ã ¿À·ù ó¸® +1 ÀÌ°æ¿ë 12-11 9508
5  [±âÃÊ] HelloWorld ¸¸µé±â µ¿¿µ»ó +3 ÀÌ°æ¿ë 12-01 4562
4  ÇÑ´«¿¡ º¸´Â ¾Èµå·ÎÀÌµå ½º¸¶Æ®Æù ½ºÆå°ú µð½ºÇ÷¹ÀÌ »çÀÌÁî ºñ±³ +2 Á¤Çöö 11-18 4748
3  ¾Èµå·ÎÀÌµå ¾Û¿¡ ±¸±Û ¾Öµå¼¾½º ±¤°í Àû¿ëÇϱâ ÀÌ°æ¿ë 10-19 8112
2  arraylist Áߺ¹µ¥ÀÌÅÍ Á¦°Å +4 ÀÌ°æ¿ë 10-05 9287
1  xml ÆÄ½Ì +3 ÀÌ°æ¿ë 10-05 7984
 1  2  3  4  5
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.