Package org.apache.uima.util

Examples of org.apache.uima.util.XMLInputSource


  private void loadContext(XMLizable thing) {
    // try to load a context that has the types
    if (isContextLoaded)
      return;
    String contextFile = null;
    XMLInputSource input = null;
    aeDescription = null;
    openingContext = true;
    try {
      try {
        contextFile = fileNeedingContext.getPersistentProperty(new QualifiedName(
                AbstractSection.PLUGIN_ID, AbstractSection.IMPORTABLE_PART_CONTEXT));
      } catch (CoreException e) {
        throw new InternalErrorCDE("unexpected exception", e);
      }
      ContextForPartDialog dialog = new ContextForPartDialog(PlatformUI.getWorkbench().getDisplay()
              .getShells()[0], // ok in Eclipse 3.0
              getFile().getProject().getParent(), thing, getFile().getLocation(), this, contextFile);
      dialog.setTitle("File specifying context for editing importable part");
      if (dialog.open() == Window.CANCEL)
        throw new MultilevelCancel();

      contextFile = dialog.contextPath;

      if (null == contextFile) {
        Utility
                .popMessage(
                        "Context Info",
                        "A context is required to edit this part.  However no context was supplied.  Editing will be cancelled",
                        Utility.INFORMATION);
        throw new MultilevelCancel();
      } else {
        try {
          input = new XMLInputSource(contextFile);
        } catch (IOException e) {
          showContextLoadFailureMessage(e, contextFile);
          throw new MultilevelCancel();
        }
        if (null != input)
View Full Code Here


      if (i == (componentHeaders.length - 1))
        return null;
    }

    try {
      XMLInputSource input = new XMLInputSource(iFile.getLocation().toFile());
      XMLizable inputDescription = AbstractSection.parseDescriptor(input);
      if (inputDescription instanceof AnalysisEngineDescription
              || inputDescription instanceof CasConsumerDescription
              || inputDescription instanceof FlowControllerDescription)
        return (ResourceCreationSpecifier) inputDescription;
View Full Code Here

    */
   private void setup() throws Exception {
      try {
         this.ae = null;
         // Create an XML input source from the specifier file.
         XMLInputSource in = new XMLInputSource(this.descFile);
         // Parse the specifier.
         ResourceSpecifier specifier = UIMAFramework.getXMLParser()
               .parseResourceSpecifier(in);
         // Create the Text Analysis Engine.
         this.ae = UIMAFramework.produceAnalysisEngine(specifier, this.mgr,
View Full Code Here

         String groupName, String paramName, Object paramValue)
         throws InvalidXMLException, ResourceInitializationException,
         IOException {
      // create CasConsumer description
      AnalysisEngineDescription aeSpecifier = UIMAFramework.getXMLParser()
            .parseAnalysisEngineDescription(new XMLInputSource(this.descFile));

      // get delegates
      Map delegates = aeSpecifier.getDelegateAnalysisEngineSpecifiers();

      // check if delegeteKey is available
View Full Code Here

   public static AnalysisEngine doConfigurationTest(String configDescFilePath)
         throws Exception {
      try {
         AnalysisEngine ae = null;
         // Create an XML input source from the specifier file.
         XMLInputSource in = new XMLInputSource(configDescFilePath);
         // Parse the specifier.
         ResourceSpecifier specifier = UIMAFramework.getXMLParser()
               .parseResourceSpecifier(in);
         // Create the Text Analysis Engine.
         ae = UIMAFramework.produceAnalysisEngine(specifier, null, null);
View Full Code Here

   public static CAS performTest(String descFilePath, String text,
         String language) throws Exception {
      try {
         AnalysisEngine ae = null;
         // Create an XML input source from the specifier file.
         XMLInputSource in = new XMLInputSource(descFilePath);
         // Parse the specifier.
         ResourceSpecifier specifier = UIMAFramework.getXMLParser()
               .parseResourceSpecifier(in);
         // Create the Text Analysis Engine.
         ae = UIMAFramework.produceAnalysisEngine(specifier, null, null);
View Full Code Here

    */
   public static CAS getCASfromXCAS(File tsFile, File xcasFile)
         throws Exception {
      try {
         Object tsDescriptor = UIMAFramework.getXMLParser().parse(
               new XMLInputSource(tsFile));
         TypeSystemDescription tsDesc = (TypeSystemDescription) tsDescriptor;
         CAS cas = CasCreationUtils.createCas(tsDesc, null,
               new FsIndexDescription[0]);

         SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
View Full Code Here

         testFile.delete(); // delete file if exist
         testFile.createNewFile(); // create new file

         // Create an XML input source from the specifier file.
         XMLInputSource in = new XMLInputSource(JUnitExtension
               .getURL("AnnotationWriter.xml"));
         // Parse the specifier.
         ResourceSpecifier specifier = UIMAFramework.getXMLParser()
               .parseResourceSpecifier(in);
View Full Code Here

    UIMAFramework.getXMLParser().enableSchemaValidation(true);
    cpeSpecifierFile = JUnitExtension.getFile("CpeSofaTest/SofaCPE.xml");
    // Use the specifier file to determine where the specifiers live.
    System.setProperty("CPM_HOME", cpeSpecifierFile.getParentFile().getParentFile().getAbsolutePath());
    cpeDesc = UIMAFramework.getXMLParser()
            .parseCpeDescription(new XMLInputSource(cpeSpecifierFile));
    // instantiate a cpe
    cpe = UIMAFramework.produceCollectionProcessingEngine(cpeDesc, null);
    // add status callback
    statCbL1 = new StatusCallbackListenerImpl1();
    cpe.addStatusCallbackListener(statCbL1);
View Full Code Here

    return null;
  }

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

      TypeSystemDescription typeSystemDesciptor;
View Full Code Here

TOP

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

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.