org.apache.uima.util

## Interface XMLizable

- All Known Subinterfaces:
    AllowedValue, AnalysisEngineDescription, AnalysisEngineMetaData, Attribute, Capability, CapabilityLanguageFlow, CasConsumerDescription, CasInitializerDescription, CasProcessorDeploymentParam, CasProcessorErrorHandling, CasProcessorErrorRateThreshold, CasProcessorExecArg, CasProcessorExecutable, CasProcessorFilter, CasProcessorMaxRestarts, CasProcessorRunInSeperateProcess, CasProcessorRuntimeEnvParam, CasProcessorTimeout, CollectionReaderDescription, ConfigurableDataResourceSpecifier, ConfigurationGroup, ConfigurationParameter, ConfigurationParameterDeclarations, ConfigurationParameterSettings, CpeCasProcessor, CpeCasProcessors, CpeCheckpoint, CpeCollectionReader, CpeCollectionReaderCasInitializer, CpeCollectionReaderIterator, CpeComponentDescriptor, CpeConfiguration, CpeDescription, CpeInclude, CpeIntegratedCasProcessor, CpeLocalCasProcessor, CpeRemoteCasProcessor, CpeResourceManagerConfiguration, CpeSofaMapping, CpeSofaMappings, CustomResourceSpecifier, ExternalResourceBinding, ExternalResourceDependency, ExternalResourceDescription, FeatureDescription, FileLanguageResourceSpecifier, FileResourceSpecifier, Filter, FixedFlow, FlowConstraints, FlowControllerDeclaration, FlowControllerDescription, FsIndexCollection, FsIndexDescription, FsIndexKeyDescription, Import, IndexBuildItem, IndexBuildSpecification, IndexRule, JMSMessagingSpecifier, LanguagePrecondition, MailMessagingSpecifier, MessagingSpecifier, MetaDataObject, MimeTypePrecondition, MQMessagingSpecifier, NameValuePair, OutputQueue, Parameter, PearSpecifier, Precondition, ProcessingResourceMetaData, ResourceCreationSpecifier, ResourceManagerConfiguration, ResourceMetaData, ResourceServiceSpecifier, ResourceSpecifier, ResourceSpecifierList, ResultSpecification, SimplePrecondition, SofaMapping, Style, TaeDescription, TypeDescription, TypeOrFeature, TypePriorities, TypePriorityList, TypeSystemDescription, URISpecifier
  All Known Implementing Classes:
    AllowedValue_impl, AnalysisEngineDescription_impl, AnalysisEngineMetaData_impl, Attribute_impl, Capability_impl, CapabilityLanguageFlow_impl, CasConsumerDescription_impl, CasInitializerDescription_impl, CollectionReaderDescription_impl, ConfigurableDataResourceSpecifier_impl, ConfigurationGroup_impl, ConfigurationParameter_impl, ConfigurationParameterDeclarations_impl, ConfigurationParameterSettings_impl, CustomResourceSpecifier_impl, ExternalResourceBinding_impl, ExternalResourceDependency_impl, ExternalResourceDescription_impl, FeatureDescription_impl, FileLanguageResourceSpecifier_impl, FileResourceSpecifier_impl, Filter_impl, FixedFlow_impl, FlowControllerDeclaration_impl, FlowControllerDescription_impl, FsIndexCollection_impl, FsIndexDescription_impl, FsIndexKeyDescription_impl, Import_impl, IndexBuildItem_impl, IndexBuildSpecification_impl, IndexRule_impl, LanguagePrecondition_impl, Mapping_impl, MetaDataObject_impl, MimeTypePrecondition_impl, NameValuePair_impl, OperationalProperties_impl, Parameter_impl, PearSpecifier_impl, ProcessingResourceMetaData_impl, ResourceCreationSpecifier_impl, ResourceManagerConfiguration_impl, ResourceMetaData_impl, ResultSpecification_impl, SimplePrecondition_impl, SofaMapping_impl, Style_impl, TaeDescription_impl, TypeDescription_impl, TypeOrFeature_impl, TypePriorities_impl, TypePriorityList_impl, TypeSystemDescription_impl, URISpecifier_impl

      public interface XMLizable

  An interface to be implemented by UIMA classes that can be written to and parsed from XML. Classes must implement this interface in order for the UIMA `XMLParser` to generate them from XML documents. XMLizable classes also must define a zero-argument constructor. When constructing an object, the `XMLParser` will first create it using the zero-argument constructor and then call `buildFromXMLElement(Element,XMLParser)`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `buildFromXMLElement(Element aElement, XMLParser aParser)` Initializes this object from its XML DOM representation.
    `void` | `buildFromXMLElement(Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)` Initializes this object from its XML DOM representation.
    `void` | `toXML(ContentHandler aContentHandler)` Writes this object's XML representation by making calls on a SAX `ContentHandler`.
    `void` | `toXML(ContentHandler aContentHandler, boolean aWriteDefaultNamespaceAttribute)` Writes this object's XML representation by making calls on a SAX `ContentHandler`.
    `void` | `toXML(OutputStream aOutputStream)` Writes this object's XML representation as a string in UTF-8 encoding.
    `void` | `toXML(Writer aWriter)` Writes this object's XML representation as a string.

- - ### Method Detail

    - #### toXML

          void toXML(Writer aWriter)
              throws SAXException,
                     IOException

      Writes this object's XML representation as a string. Note that if you want to write the XML to a file or to a byte stream, it is highly recommended that you use `toXML(OutputStream)` instead, as it ensures that output is written in UTF-8 encoding, which is the default encoding that should be used for XML files.

      The XML String that is produced will have a header `<?xml version="1.0" encoding="UTF-8"?>`. Therefore you should not write this string out in any encoding other than UTF-8 (for example do not use the default platform encoding), or you will produce output that will not be able to be parsed.

      Parameters:
        `aWriter` - a Writer to which the XML string will be written
      Throws:
        `IOException` - if an I/O failure occurs
        `SAXException` - passthru

    - #### toXML

          void toXML(OutputStream aOutputStream)
              throws SAXException,
                     IOException

      Writes this object's XML representation as a string in UTF-8 encoding.
      Parameters:
        `aOutputStream` - an OutputStream to which the XML string will be written, in UTF-8 encoding.
      Throws:
        `IOException` - if an I/O failure occurs
        `SAXException` - pass thru

    - #### toXML

          void toXML(ContentHandler aContentHandler)
              throws SAXException

      Writes this object's XML representation by making calls on a SAX `ContentHandler`. This method just calls `toXML(aContentHandler,false)`, so subclasses should override that version of this method, not this one.
      Parameters:
        `aContentHandler` - the content handler to which this object will write events that describe its XML representation.
      Throws:
        `SAXException` - pass thru

    - #### toXML

          void toXML(ContentHandler aContentHandler,
                     boolean aWriteDefaultNamespaceAttribute)
              throws SAXException

      Writes this object's XML representation by making calls on a SAX `ContentHandler`.
      Parameters:
        `aContentHandler` - the content handler to which this object will write events that describe its XML representation.
        `aWriteDefaultNamespaceAttribute` - whether the namespace of this element should be written as the default namespace. This should be done only for the root element, and it defaults to false.
      Throws:
        `SAXException` - pass thru

    - #### buildFromXMLElement

          void buildFromXMLElement(Element aElement,
                                   XMLParser aParser)
                            throws InvalidXMLException

      Initializes this object from its XML DOM representation. This method is typically called from the `XMLParser`.
      Parameters:
        `aElement` - the XML element that represents this object.
        `aParser` - a reference to the UIMA `XMLParser`. The `XMLParser.buildObject(Element)` method can be used to construct sub-objects.
      Throws:
        `InvalidXMLException` - if the input XML element does not specify a valid object

    - #### buildFromXMLElement

          void buildFromXMLElement(Element aElement,
                                   XMLParser aParser,
                                   XMLParser.ParsingOptions aOptions)
                            throws InvalidXMLException

      Initializes this object from its XML DOM representation. This method is typically called from the `XMLParser`.
      Parameters:
        `aElement` - the XML element that represents this object.
        `aParser` - a reference to the UIMA `XMLParser`. The `XMLParser.buildObject(Element)` method can be used to construct sub-objects.
        `aOptions` - option settings
      Throws:
        `InvalidXMLException` - if the input XML element does not specify a valid object

Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.