levelOneFields = null;
}
}//TESTED (json and xml)
if (xml) {
XmlToMetadataParser parser = new XmlToMetadataParser(levelOneFields, null, null, null, null, null, Integer.MAX_VALUE);
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.IS_COALESCING, true);
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader reader = null;
try {
reader = factory.createXMLStreamReader(new ByteArrayInputStream(text.getBytes()));
docs = parser.parseDocument(reader, textNotObject);
}
finally {
if (null != reader) reader.close();
}
}//TESTED (meta_stream_test, test1)
if (json) {
JsonReader jsonReader = null;
try {
JsonToMetadataParser parser = new JsonToMetadataParser(null, levelOneFields, null, null, Integer.MAX_VALUE);
jsonReader = new JsonReader(new InputStreamReader(new ByteArrayInputStream(text.getBytes()), "UTF-8"));
jsonReader.setLenient(true);
docs = parser.parseDocument(jsonReader, textNotObject);
}
finally {
if (null != jsonReader) jsonReader.close();
}
}//TESTED (meta_stream_test test2)