use of org.kxml2.io.KXmlParser in project robovm by robovm.
the class KxmlPullParserDtdTest method newPullParser.
@Override
XmlPullParser newPullParser() throws XmlPullParserException {
KXmlParser result = new KXmlParser();
result.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
return result;
}
use of org.kxml2.io.KXmlParser in project android-shape-imageview by siyamed.
the class SvgToPath method parse.
private static PathInfo parse(InputStream in, boolean ignoreDefs, float dpi) {
try {
XmlPullParser xr = new KXmlParser();
SvgToPath svgHandler = new SvgToPath(xr);
svgHandler.setDpi(dpi);
if (ignoreDefs) {
xr.setInput(new InputStreamReader(in));
svgHandler.processSvg();
} else {
CopyInputStream cin = new CopyInputStream(in);
XmlPullParser ids = new KXmlParser();
ids.setInput(new InputStreamReader(cin.getCopy()));
IdHandler idHandler = new IdHandler(ids);
idHandler.processIds();
svgHandler.idXml = idHandler.idXml;
xr.setInput(new InputStreamReader(cin.getCopy()));
svgHandler.processSvg();
}
return svgHandler.pathInfo;
} catch (Exception e) {
Log.w(TAG, "Parse error: " + e);
throw new RuntimeException(e);
}
}
use of org.kxml2.io.KXmlParser in project android_frameworks_base by AOSPA.
the class ExpatPerformanceTest method runJavaPullParser.
private void runJavaPullParser() throws XmlPullParserException, IOException {
XmlPullParser pullParser;
long start = System.currentTimeMillis();
pullParser = new KXmlParser();
pullParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
pullParser.setInput(newInputStream(), "UTF-8");
withPullParser(pullParser);
long elapsed = System.currentTimeMillis() - start;
Log.i(TAG, "java pull parser: " + elapsed + "ms");
}
use of org.kxml2.io.KXmlParser in project XobotOS by xamarin.
the class Xml method newPullParser.
/**
* Returns a new pull parser with namespace support.
*/
public static XmlPullParser newPullParser() {
try {
KXmlParser parser = new KXmlParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
return parser;
} catch (XmlPullParserException e) {
throw new AssertionError();
}
}
use of org.kxml2.io.KXmlParser in project kotlin by JetBrains.
the class LayoutInflationDetector method hasLayoutParams.
@VisibleForTesting
static boolean hasLayoutParams(@NonNull Reader reader) throws XmlPullParserException, IOException {
KXmlParser parser = new KXmlParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(reader);
while (true) {
int event = parser.next();
if (event == XmlPullParser.START_TAG) {
for (int i = 0; i < parser.getAttributeCount(); i++) {
if (parser.getAttributeName(i).startsWith(ATTR_LAYOUT_RESOURCE_PREFIX)) {
String prefix = parser.getAttributePrefix(i);
if (prefix != null && !prefix.isEmpty() && ANDROID_URI.equals(parser.getNamespace(prefix))) {
return true;
}
}
}
return false;
} else if (event == XmlPullParser.END_DOCUMENT) {
return false;
}
}
}
Aggregations