Package org.apache.uima.util

Examples of org.apache.uima.util.XMLParser


    File descriptorFile = JUnitExtension.getFile("CASTests/desc/TokensAndSentences.xml");
    assertTrue("Descriptor must exist: " + descriptorFile.getAbsolutePath(), descriptorFile
  .exists());

    try {
      XMLParser parser = UIMAFramework.getXMLParser();
      AnalysisEngineDescription spec = (AnalysisEngineDescription) parser.parse(new XMLInputSource(
    descriptorFile));
      this.ae = UIMAFramework.produceAnalysisEngine(spec);
      Properties props = new Properties();
      props.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE, "0");
      this.smallHeapCas = CasCreationUtils.createCas(spec, props).getJCas();
View Full Code Here


    File descriptorFile = JUnitExtension.getFile("CASTests/desc/casTestCaseDescriptor.xml");
    assertTrue("Descriptor must exist: " + descriptorFile.getAbsolutePath(), descriptorFile
        .exists());

    try {
      XMLParser parser = UIMAFramework.getXMLParser();
      ResourceSpecifier spec = (ResourceSpecifier) parser.parse(new XMLInputSource(descriptorFile));
      AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(spec);
      this.cas = (CASImpl) ae.newCAS();
      assertTrue(this.cas != null);
      this.ts = this.cas.getTypeSystem();
      assertTrue(this.ts != null);
View Full Code Here

    File descriptorFile = JUnitExtension.getFile("CASTests/desc/pathValidationTS.xml");
    assertTrue("Descriptor must exist: " + descriptorFile.getAbsolutePath(), descriptorFile
        .exists());

    try {
      XMLParser parser = UIMAFramework.getXMLParser();
      TypeSystemDescription spec = (TypeSystemDescription) parser.parse(new XMLInputSource(
          descriptorFile));
      this.cas = CasCreationUtils.createCas(spec, null, new FsIndexDescription[] {});
    } catch (ResourceInitializationException e) {
      e.printStackTrace();
      assertTrue(false);
View Full Code Here

    String compClassPath = InstallationController.buildComponentClassPath(insDesc
            .getMainComponentRoot(), insDesc, false);
    // instantiate the aggregate AE
    resMngr.setExtensionClassPath(compClassPath, true);
    String compDescFilePath = insDesc.getMainComponentDesc();
    XMLParser xmlPaser = UIMAFramework.getXMLParser();
    XMLInputSource xmlInput = new XMLInputSource(compDescFilePath);
    AnalysisEngineDescription aeSpec = xmlPaser.parseAnalysisEngineDescription(xmlInput);
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aeSpec, resMngr, null);
    Assert.assertTrue(ae != null);
    // create CAS object
    CAS cas = ae.newCAS();
    Assert.assertTrue(cas != null);
View Full Code Here

    // parse component descriptor
    XMLInputSource xmlSource = null;
    ResourceSpecifier dlgSpecifier = null;
    try {
      xmlSource = new XMLInputSource(dlgDescPath);
      XMLParser xmlParser = UIMAFramework.getXMLParser();
      dlgSpecifier = xmlParser.parseResourceSpecifier(xmlSource);
    } catch (InvalidXMLException xmlExc) {
      String msgKey = xmlExc.getMessageKey();
      // if msg key is INVALID_CLASS, this is TS or RR desc
      if (InvalidXMLException.INVALID_CLASS.equals(msgKey))
        throw new IllegalArgumentException(xmlExc.toString());
View Full Code Here

    File descriptorFile = JUnitExtension.getFile("CASTests/desc/TokensAndSentences.xml");
    assertTrue("Descriptor must exist: " + descriptorFile.getAbsolutePath(), descriptorFile
        .exists());

    try {
      XMLParser parser = UIMAFramework.getXMLParser();
      ResourceSpecifier spec = (ResourceSpecifier) parser.parse(new XMLInputSource(descriptorFile));
      this.ae = UIMAFramework.produceAnalysisEngine(spec);
    } catch (IOException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (InvalidXMLException e) {
View Full Code Here

  private static CAS createEmtpyCAS()
  {
      XMLInputSource xmlTypeSystemSource = new XMLInputSource(DocumentImportStructureProvider.class
            .getResourceAsStream("ts.xml"), new File(""));
      XMLParser xmlParser = UIMAFramework.getXMLParser();

      TypeSystemDescription typeSystemDesciptor;

      try {
        typeSystemDesciptor = (TypeSystemDescription) xmlParser
                .parse(xmlTypeSystemSource);
      } catch (InvalidXMLException e1) {
        throw new TaeError("Integrated ts.xml typesystem descriptor is not valid!");
      }
View Full Code Here

        ProcessingResourceMetaData collectionReaderMetaData =
            collectionReaderDescripton.getCollectionReaderMetaData();

        collectionReaderMetaData.setTypeSystem(typeSystemDescriptor);

        XMLParser xmlParser = UIMAFramework.getXMLParser();

        InputStream inIndex = getClass().getResourceAsStream(
                "Index.xml");

        if (inIndex == null)
        {
            throw new InvocationTargetException(null,
                    "org/apache/uima/caseditor/ui/action/Index.xml"
                    + " is missing on the classpath");
        }

        XMLInputSource xmlIndexSource = new XMLInputSource(inIndex,
                new File(""));

        FsIndexDescription indexDesciptor;

        try
        {
            indexDesciptor = (FsIndexDescription) xmlParser
            .parse(xmlIndexSource);
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e);
View Full Code Here

      Document apple2xmlDoc = docBuilder.parse(new ByteArrayInputStream(apple2xml.getBytes()));
      Document orangeXmlDoc = docBuilder.parse(new ByteArrayInputStream(orangeXml.getBytes()));
      Document fruitBagXmlDoc = docBuilder.parse(new ByteArrayInputStream(fruitBagXml.getBytes()));

      // construct new objects from the XML
      XMLParser xmlp = UIMAFramework.getXMLParser();
      MetaDataObject_impl newApple1 = (MetaDataObject_impl) unknownFruit.clone();
      newApple1.buildFromXMLElement(apple1xmlDoc.getDocumentElement(), xmlp);
      MetaDataObject_impl newApple2 = (MetaDataObject_impl) unknownFruit.clone();
      newApple2.buildFromXMLElement(apple2xmlDoc.getDocumentElement(), xmlp);
      MetaDataObject_impl newOrange = (MetaDataObject_impl) unknownFruit.clone();
      newOrange.buildFromXMLElement(orangeXmlDoc.getDocumentElement(), xmlp);

      xmlp.addMapping("fruit", TestFruitObject.class.getName());

      MetaDataObject_impl newFruitBag = new TestFruitBagObject();
      newFruitBag.buildFromXMLElement(fruitBagXmlDoc.getDocumentElement(), xmlp);

      // new objects should be equal to the originals
View Full Code Here

 
  public void testDocumentAnnotationRedefine() {
    final String tsDescriptor =
      "org/apache/uima/analysis_engine/impl/documentAnnotationRedefinitionTS.xml";
    File file = JUnitExtension.getFile(tsDescriptor);
    XMLParser parser = UIMAFramework.getXMLParser();
    boolean resourceInitExc = false;
    try {
      TypeSystemDescription tsd = (TypeSystemDescription) parser.parse(new XMLInputSource(file));
      CasCreationUtils.createCas(tsd, null, new FsIndexDescription[0]);
    } catch (InvalidXMLException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.apache.uima.util.XMLParser

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.