1 / 7

android Android -Xml

android Android -Xml. (DMI) Kang GiHoon. Android XML. 일반적인 java xml 파일 처리 . parser 의 종류 dom parser sax parser pull sax parser 일반적으로 android 의 resource 한계상 대용량 xml 파일 프로세싱에 효율적인 sax parser 를 사용 특별히 기본 sax parser 의 변형인 단순한 형태의 pull sax parser 를 많이 사용함.

zev
Download Presentation

android Android -Xml

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. android Android-Xml (DMI) Kang GiHoon

  2. Android XML • 일반적인 java xml 파일 처리. • parser의 종류 • dom parser • sax parser • pull sax parser • 일반적으로 android의 resource 한계상 대용량 xml 파일 프로세싱에효율적인 sax parser를 사용 • 특별히 기본 sax parser의 변형인 단순한 형태의 pull sax parser 를 많이 사용함.

  3. Android XML – XmlPullParser • XML Pull Parser (XPP) • Saxparser 의 변형 (단순하고 빠른 parsing) • android 에선 v1 지원. • 사용방법 - XmlPullParserFactory parser 팩토리 클래스 생성 - parser 팩토리 클래스로 부터XmlPullParser클래스 생성. - setInput(Reader in) 함수로 부터Input xml Reader 생성 - parser.next() 으로 부터 해당 문서 태그 식별 후 해당 이벤트 발생 하는 곳에서 적절히 처리 XmlPullParser.START_DOCUMENT : xml 문서 root 태그를 만날때 XmlPullParser.START_TAG : Element시작 태그를 만날때 XmlPullParser.END_TAG : Element종료 태그를 만날때 XmlPullParser.TEXT : Element 내의 텍스트 내용을 만날때 XmlPullParser.END_DOCUMENT : xml 문서의 종료 태그를 만날때

  4. Android XML – Example http://api.foursquare.com/v1/venues?geolat=37.518985&geolong=127.048645&l=30 : 경도와 위도정보를 주면 주변의 관련 정보를 줌. : l=30은 list의 개수. • 포스퀘워openapi xml

  5. Android XML – Example • <Venue> 태그는 Venue 클래스 생성 • <primarycategory> 태그는 PrimaryCategory클래스 생성 후 Venue의 하위클래스로 위치 • 예제에서 <stats> 정보는 사용하지 않음.

  6. Android XML – Example (Foursquar List 구현) • list 화면 설계 • xml 파싱을 통한 foursquare api설계 • xml 파싱후웹상의foursquare category icon 이미지 Decoding • xml api의 호출 후 데이터 내용 을 리스트에 뿌린다. • 일정한 Thread Pool을 이용하여 웹상의 각 카테고리 이미지 항목들을 decoding 하여 사용자 응답 시간을 줄인다. • 일정시간 이후 응답이 없을 경우 네트웍 문제 또는 시간 초과라는 메시지로 사용자에게 알려 줌으로 사용자로 부터 기다리지 않게 한다.

  7. Android XML – Example (Foursquare List 구현) • list 화면 설계

More Related