¾ÛÅøÁî
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 Á¶È¸ : 6186

¾Èµå·ÎÀ̵忡¼­´Â 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°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
68        ¿øº»ÀÌ ¼öÁ¤ÀÌ ¾ÈµÇ´Â°ü°è·Î...(±¸±Û Ķ¸°´õ ¸®½ºÆ®JSON±Ü¾î¿À±â+ µî·Ï) ±èº´ÁÖ 12-03 6707
67  °¶·°½ÃS ¸¶ÄÏ ¿ë·® Á¦ÇÑ 30MB +6 ÀÌ°æ¿ë 12-14 6663
66  °£´ÜÇÏ°Ô Æнº¿öµå¿¡ ¼ýÀÚ°¡ È¥¿ëµÇ¾ú´ÂÁö ó¸®ÇÒ ¼ö ÀÖ´Â ¸Þ¼ÒµåÀÔ´Ï´Ù. ±èº´ÁÖ 01-31 6419
65  ÀÌŬ¸³½º¿¡¼­ ·¹À̾ƿô xml ±×·¡ÇȺκÐÀÌ °©Àڱ⠾Ⱥ¸ÀÏ°æ¿ì. +1 ±èº´ÁÖ 07-27 6399
64  ¾Èµå·ÎÀÌµå ¾Û¿¡ ±¸±Û ¾Öµå¼¾½º ±¤°í Àû¿ëÇϱâ ÀÌ°æ¿ë 10-19 6373
63  Citirne Framework·Î °³¹ßÇÑ ¼îÇθô ¾Û ¼Ò½º °ø°³ÇÕ´Ï´Ù.(Android, iOS) +1 ¾¾Æ®¸°°³¹ß¡¦ 06-13 6258
62  Bitmap ÆÄÀÏ È¸Àü½ÃÅ°±â ±èÀºÈ£ 04-24 6247
61  ¾Èµå·ÎÀÌµå ¾ÛÀ» µðÀÚÀÎÇÒ¶§ ¾Ë¾Æ¾ß ÇÒ°Í ¹®±â¼® 07-02 6208
60  xml ÆÄ½Ì +3 ÀÌ°æ¿ë 10-05 6187
59  ¾Û µî·Ï ¹× ±¤°í µî·Ï½Ã ÁÖÀÇ »çÇ× +1 ÀÌ°æ¿ë 08-16 6015
58  Æ÷¹°¼± ±×¸®¸ç À̵¿ÇÏ´Â °´Ã¼ ¾Ë°í¸®Áò ºñ½º¹«¸®ÇÑ°Å. +1 ±èº´ÁÖ 09-27 5787
57  tiStory Api ÀÌ¿ëÇϱâ.(XML parsing) +3 ±èº´ÁÖ 11-09 5782
56  String -> HEX ±èº´ÁÖ 11-12 5756
55  ¸ð¹ÙÀÏ ±¤°í¸¦ ÅëÇؼ­ ¾Û È«º¸ ÀÌ°æ¿ë 06-28 5706
54  ÀÚ¹Ù Ãʺ¸µé¿¡°Ô ÃßõÇÏ´Â ±âÃÊ °³³äÀ» ÀâÀ» ¼ö Àִ åµé ÀÌ°æ¿ë 06-19 5699
53     ±¸±Û Ä̸°´õ ¿¬µ¿Çϱâ + ±Û¾²±â. ±èº´ÁÖ 12-01 5674
52  È­¸é Å©±â¿¡ µû¶ó¼­ ·¹À̾ƿô ¹Ù²Ù±â ¹®±â¼® 07-06 5666
51  À¥ºä¿¡¼­ Æø ½ºÅ©·Ñ ¶§¹®¿¡ À߸®´Â ¹®Á¦ ÇØ°á +1 ÀÌ°æ¿ë 10-31 5663
50  View µéÀ» FlipperÇÏ´Â ¹æ½Ä°ú ±¸Á¶¸¦ ¾Ë¾Æº¾½Ã´Ù. +2 ±èº´ÁÖ 10-20 5650
49  TCP/IP Åë½Å°ü·Ã °­ÁÂÀÔ´Ï´Ù. +2 ±è±â¹ü 03-09 5520
 1  2  3  4  5  
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.