mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-05-03 15:44:27 +02:00
synchronized parser
This commit is contained in:
parent
c0a02f1f55
commit
d96c4cb4ff
@ -21,21 +21,24 @@ import java.io.IOException;
|
|||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
public class XMLSpanParser {
|
public class XMLSpanParser {
|
||||||
|
private final Object mLock = new Object();
|
||||||
private final XmlPullParser mParser;
|
private final XmlPullParser mParser;
|
||||||
private XMLElement mCurrentElement;
|
private XMLElement mCurrentElement;
|
||||||
public XMLSpanParser(){
|
public XMLSpanParser(){
|
||||||
this.mParser = new MXParserNonValidating();
|
this.mParser = new MXParserNonValidating();
|
||||||
}
|
}
|
||||||
public XMLElement parse(String text) throws XMLException {
|
public XMLElement parse(String text) throws XMLException {
|
||||||
try {
|
synchronized (mLock){
|
||||||
text="<spannable-parser>"+text+"</spannable-parser>";
|
try {
|
||||||
parseString(text);
|
text="<spannable-parser>"+text+"</spannable-parser>";
|
||||||
} catch (XmlPullParserException|IOException ex) {
|
parseString(text);
|
||||||
throw new XMLException(ex.getMessage());
|
} catch (XmlPullParserException|IOException ex) {
|
||||||
|
throw new XMLException(ex.getMessage());
|
||||||
|
}
|
||||||
|
XMLElement element=mCurrentElement;
|
||||||
|
mCurrentElement=null;
|
||||||
|
return element;
|
||||||
}
|
}
|
||||||
XMLElement element=mCurrentElement;
|
|
||||||
mCurrentElement=null;
|
|
||||||
return element;
|
|
||||||
}
|
}
|
||||||
private void parseString(String text) throws XmlPullParserException, IOException {
|
private void parseString(String text) throws XmlPullParserException, IOException {
|
||||||
mCurrentElement=null;
|
mCurrentElement=null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user