Package com.ikanow.infinit.e.harvest.extraction.document.file

Examples of com.ikanow.infinit.e.harvest.extraction.document.file.XmlToMetadataParser


            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)
View Full Code Here

TOP

Related Classes of com.ikanow.infinit.e.harvest.extraction.document.file.XmlToMetadataParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.