suppress xml errors in converter
- simply ignore malformed layouts, xml editor in ide will highlight them anyway
This commit is contained in:
committed by
Yan Zhulanow
parent
eb7534f369
commit
208735d92e
+10
-4
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import javax.xml.parsers.SAXParser
|
||||
import java.util.HashMap
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
abstract class AndroidUIXmlParser {
|
||||
|
||||
@@ -94,11 +95,16 @@ abstract class AndroidUIXmlParser {
|
||||
private fun parseSingleFile(file: File): String {
|
||||
val ids: MutableCollection<AndroidWidget> = ArrayList()
|
||||
val handler = AndroidXmlHandler({ id, wClass -> ids.add(AndroidWidget(id, wClass)) })
|
||||
saxParser.parse(FileInputStream(file), handler)
|
||||
val res = produceKotlinProperties(KotlinStringWriter(), ids).toString()
|
||||
fileCache[file] = res
|
||||
fileModificationTime[file] = file.lastModified()
|
||||
return res
|
||||
try {
|
||||
saxParser.parse(FileInputStream(file), handler)
|
||||
val res = produceKotlinProperties(KotlinStringWriter(), ids).toString()
|
||||
fileCache[file] = res
|
||||
return res
|
||||
} catch (e: Exception) {
|
||||
fileCache[file] = ""
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
private fun doParse(): CacheAction? {
|
||||
|
||||
Reference in New Issue
Block a user