use of org.openforis.idm.metamodel.xml.XmlParseException in project collect by openforis.
the class XmlPullReader method parse.
public synchronized void parse(InputStream is, String enc) throws XmlParseException, IOException {
if (is == null) {
throw new NullPointerException("InputStream");
}
try {
XmlPullParser parser = createParser();
parser.setInput(is, enc);
parse(parser);
} catch (XmlPullParserException e) {
throw new XmlParseException(getParser(), e.getMessage());
}
}
use of org.openforis.idm.metamodel.xml.XmlParseException in project collect by openforis.
the class SurveyUnmarshaller method readNamepaceDeclarations.
protected void readNamepaceDeclarations() throws XmlParseException {
XmlPullParser pp = getParser();
try {
int nsCount = pp.getNamespaceCount(1);
for (int i = 0; i < nsCount; i++) {
String prefix = pp.getNamespacePrefix(i);
if (prefix != null) {
String uri = pp.getNamespaceUri(i);
survey.addCustomNamespace(uri, prefix);
}
}
} catch (XmlPullParserException e) {
throw new XmlParseException(pp, "Failed to read namespace declarations", e);
}
}
use of org.openforis.idm.metamodel.xml.XmlParseException in project collect by openforis.
the class TextAttributeDefinitionPR method onStartDefinition.
@Override
protected void onStartDefinition() throws XmlParseException, XmlPullParserException, IOException {
super.onStartDefinition();
String typeStr = getAttribute(TYPE, false);
TextAttributeDefinition defn = (TextAttributeDefinition) getDefinition();
try {
defn.setType(typeStr == null ? Type.SHORT : Type.valueOf(typeStr.toUpperCase()));
} catch (IllegalArgumentException e) {
throw new XmlParseException(getParser(), "invalid type " + typeStr);
}
}
use of org.openforis.idm.metamodel.xml.XmlParseException in project collect by openforis.
the class XmlPullReader method parse.
protected synchronized void parse(XmlPullParser parser) throws XmlParseException, IOException {
try {
parser.nextTag();
parseElement(parser);
} catch (XmlPullParserException e) {
throw new XmlParseException(parser, e.getMessage(), e);
}
}
Aggregations