Package org.apache.uima.util

Examples of org.apache.uima.util.XMLizable


    // first: create import, needed in both cases
    imp = createImport(fileName, isImportByName);

    // read the content and merge into our model
    XMLizable inputDescription = readImport(imp, fileName, isImportByName);
    if (null == inputDescription)
      return false;

    if (!(inputDescription instanceof AnalysisEngineDescription)
            && !(inputDescription instanceof CasConsumerDescription)
View Full Code Here


    IFile[] files = editor.getProject().getWorkspace().getRoot().findFilesForLocation(iPath);
    if (null == files || files.length != 1)
      return;

    String filePathName = files[0].getLocation().toOSString();
    XMLizable inputDescription;
    try {
      inputDescription = parseDescriptor(new XMLInputSource(filePathName));
    } catch (InvalidXMLException e) {
      return;
    } catch (IOException e) {
View Full Code Here

      } catch (IOException e) {
        throw new InternalErrorCDE("invalid state");
      }
    }
    // read the content and merge into our model
    XMLizable inputDescription;
    try {
      inputDescription = parseDescriptor(input);
    } catch (InvalidXMLException e1) {
      showExceptionReadingImportedDescriptor(e1);
      return null;
View Full Code Here

          // write the value (must be XMLizable or an array of XMLizable)
          Object val = curEntry.getValue();
          if (val.getClass().isArray()) {
            Object[] arr = (Object[]) val;
            for (int j = 0; j < arr.length; j++) {
              XMLizable elem = (XMLizable) arr[j];
              elem.toXML(aContentHandler);
            }
          } else {
            cc.lastOutputNodeAddLevel();
            try {
            ((XMLizable) val).toXML(aContentHandler);
View Full Code Here

//        }
//      }
//      System.out.print("\n");
//    }
    // build the object
    XMLizable result = mUimaXmlParser.buildObject((Element) rootDomNode, mOptions);

    // clear state to prepare for another parse
    mDOMResult = new DOMResult();
    mTransformerHandler.setResult(mDOMResult);
View Full Code Here

      if (errorHandler.getException() != null) {
        throw errorHandler.getException();
      }

      // otherwise build the UIMA XMLizable object and return it
      XMLizable result = deser.getObject();

      if (result instanceof MetaDataObject_impl) {
        // set Source URL (needed to later resolve descriptor-relative paths)
        ((MetaDataObject_impl) result).setSourceUrl(urlToParse);
      }
View Full Code Here

      throw new InvalidXMLException(InvalidXMLException.UNKNOWN_ELEMENT, new Object[] { aElement
              .getTagName() });
    }

    // resolve the class name and instantiate the class
    XMLizable object;
    try {
      object = (XMLizable) cls.newInstance();
    } catch (Exception e) {
      throw new UIMA_IllegalStateException(
              UIMA_IllegalStateException.COULD_NOT_INSTANTIATE_XMLIZABLE, new Object[] { cls
View Full Code Here

      throw new InvalidXMLException(InvalidXMLException.UNKNOWN_ELEMENT, new Object[] { aElement
              .getTagName() });
    }

    // resolve the class name and instantiate the class
    XMLizable object;
    try {
      object = (XMLizable) cls.newInstance();
    } catch (Exception e) {
      throw new UIMA_IllegalStateException(
              UIMA_IllegalStateException.COULD_NOT_INSTANTIATE_XMLIZABLE, new Object[] { cls
View Full Code Here

   */
  public ResourceSpecifier parseResourceSpecifier(XMLInputSource aInput, ParsingOptions aOptions)
          throws InvalidXMLException {
    // attempt to locate resource specifier schema
    URL schemaURL = getResourceSpecifierSchemaUrl();
    XMLizable object = parse(aInput, RESOURCE_SPECIFIER_NAMESPACE, schemaURL, aOptions);
    if (object instanceof ResourceSpecifier) {
      return (ResourceSpecifier) object;
    } else {
      throw new InvalidXMLException(InvalidXMLException.INVALID_CLASS, new Object[] {
          ResourceSpecifier.class.getName(), object.getClass().getName() });
    }
  }
View Full Code Here

   */
  public ResourceMetaData parseResourceMetaData(XMLInputSource aInput, ParsingOptions aOptions)
          throws InvalidXMLException {
    // attempt to locate resource specifier schema
    URL schemaURL = getResourceSpecifierSchemaUrl();
    XMLizable object = parse(aInput, RESOURCE_SPECIFIER_NAMESPACE, schemaURL, aOptions);

    if (object instanceof ResourceMetaData) {
      return (ResourceMetaData) object;
    } else {
      throw new InvalidXMLException(InvalidXMLException.INVALID_CLASS, new Object[] {
          ResourceMetaData.class.getName(), object.getClass().getName() });
    }
  }
View Full Code Here

TOP

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

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.