Logo Search packages:      
Sourcecode: uimaj version File versions  Download package

void org::apache::uima::resource::metadata::impl::MetaDataObject_impl::buildFromXMLElement ( Element  aElement,
XMLParser  aParser,
XMLParser.ParsingOptions  aOptions 
) throws InvalidXMLException [inline, inherited]

Initializes this object from its XML DOM representation. This method is typically called from the XMLParser.

aElementthe XML element that represents this object.
aParsera reference to the UIMA XMLParser. The XMLParser#buildObject(Element) method can be used to construct sub-objects.
aOptionsoption settings
InvalidXMLExceptionif the input XML element does not specify a valid object

Implements org::apache::uima::util::XMLizable.

Reimplemented in org::apache::uima::resource::metadata::impl::ConfigurationGroup_impl, org::apache::uima::resource::metadata::impl::ConfigurationParameterDeclarations_impl, org::apache::uima::resource::metadata::impl::ConfigurationParameterSettings_impl, org::apache::uima::resource::metadata::impl::Import_impl, and org::apache::uima::resource::metadata::impl::ResourceMetaData_impl.

Definition at line 879 of file MetaDataObject_impl.java.

    // check element type
    if (!aElement.getTagName().equals(getXmlizationInfo().elementTagName))
      throw new InvalidXMLException(InvalidXMLException.INVALID_ELEMENT_TYPE, new Object[] {
          getXmlizationInfo().elementTagName, aElement.getTagName() });

    // get child elements, each of which represents a property
    List<String> foundProperties = new ArrayList<String>();
    NodeList childNodes = aElement.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
      Node curNode = childNodes.item(i);
      if (curNode instanceof Element) {
        Element curElem = (Element) curNode;
        String elemName = curElem.getTagName();

        // look up this name in this class's XmlizationInfo
        PropertyXmlInfo propXmlInfo = getPropertyXmlInfo(elemName);
        if (propXmlInfo != null) {
          // read the property's value from this element
          readPropertyValueFromXMLElement(propXmlInfo, curElem, aParser, aOptions);
        } else {
          // There is no property that matches the XML element.
          // We have a couple of special cases to check before concluding that
          // the XML is invalid.

          // (1) if this class has only one property, we do not require
          // specifying the property name as an XML element.
          if (getXmlizationInfo().propertyInfo.length == 1) {
            readPropertyValueFromXMLElement(getXmlizationInfo().propertyInfo[0], aElement, aParser,
          } else {
            // (2) if an object can be constructed from the unknown element,
            // attempt to assign this object to any null-valued property
            // that can accept it.
            readUnknownPropertyValueFromXMLElement(curElem, aParser, aOptions, foundProperties);

Generated by  Doxygen 1.6.0   Back to index