1 2 9 10 package org.xmlpull.mxp1; 11 12 import java.util.Enumeration ; 13 14 import org.xmlpull.v1.XmlPullParser; 15 import org.xmlpull.v1.XmlPullParserException; 16 import org.xmlpull.v1.XmlPullParserFactory; 17 import org.xmlpull.v1.XmlSerializer; 18 19 import org.xmlpull.mxp1_serializer.MXSerializer; 20 21 26 27 public class MXParserFactory 28 extends XmlPullParserFactory 29 { 30 protected static boolean stringCachedParserAvailable = true; 31 32 public XmlPullParser newPullParser() throws XmlPullParserException { 33 XmlPullParser pp = null; 34 if(stringCachedParserAvailable) { 35 try { 36 pp = new MXParserCachingStrings(); 37 } catch(Exception ex) { 38 stringCachedParserAvailable = false; 39 } 40 } 41 if(pp == null) { 42 pp = new MXParser(); 43 } 44 for (Enumeration e = features.keys (); e.hasMoreElements ();) { 45 String key = (String ) e.nextElement(); 46 Boolean value = (Boolean ) features.get(key); 47 if(value != null && value.booleanValue()) { 48 pp.setFeature(key, true); 49 } 50 } 51 return pp; 52 53 } 54 55 public XmlSerializer newSerializer() throws XmlPullParserException { 56 return new MXSerializer(); 57 } 58 } 59 60 61 110 111 | Popular Tags |