content-parser/impl-opendoc/src/main/java/net/sf/mmm/content/parser/impl/opendoc/AbstractContentParserOpenDoc.java
/**
   * This method parses the metadata of the document.
   * 
   * @param inputStream is the {@link InputStream} where to read the metadata
   *        from.
   * @param options are the {@link ContentParserOptions}
   * @param context is the {@link MutableGenericContext} where the extracted
   *        metadata from the parsed <code>inputStream</code> will be
   *        {@link MutableGenericContext#setVariable(String, Object) added} to.
   * @throws Exception if the operation fails for arbitrary reasons.
   */
This method parses the metadata of the document.

@param inputStream is the  InputStream where to read the metadata
from.
@param options are the  ContentParserOptions
@param context is the  MutableGenericContext where the extracted
metadata from the parsed inputStream will be
MutableGenericContext#setVariable(String, Object) added to.
@throws Exception if the operation fails for arbitrary reasons.
This method parses the metadata of the document . @param inputStream is the InputStream where to read the metadata from . @param options are the ContentParserOptions @param context is the MutableGenericContext where the extracted metadata from the parsed inputStream will be MutableGenericContext#setVariable ( String Object ) added to . @throws Exception if the operation fails for arbitrary reasons .
protected void parseMetadata(InputStream inputStream, ContentParserOptions options,
      MutableGenericContext context) throws Exception {
    XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
    int type;
    do {
      type = streamReader.next();
      if (type == XMLStreamConstants.START_ELEMENT) {
        String localName = streamReader.getLocalName();
        if ("creator".equals(localName)) {
          context.setVariable(ContentParser.VARIABLE_NAME_CREATOR, streamReader.getElementText());
        } else if ("title".equals(localName)) {
          context.setVariable(ContentParser.VARIABLE_NAME_TITLE, streamReader.getElementText());
        } else if ("keyword".equals(localName)) {
          context.setVariable(ContentParser.VARIABLE_NAME_KEYWORDS, streamReader.getElementText());
        } else if ("language".equals(localName)) {
          context.setVariable(ContentParser.VARIABLE_NAME_LANGUAGE, streamReader.getElementText());
        }
      }
    } while (type != XMLStreamConstants.END_DOCUMENT);
    streamReader.close();
  }
protected void parseMetadata ( InputStream inputStream , ContentParserOptions options , MutableGenericContext context ) throws Exception { XMLStreamReader streamReader = XMLInputFactory . newInstance ( ) . createXMLStreamReader ( inputStream ) ; int type ; do { type = streamReader . next ( ) ; if ( type == XMLStreamConstants . START_ELEMENT ) { String localName = streamReader . getLocalName ( ) ; if ( "creator" . equals ( localName ) ) { context . setVariable ( ContentParser . VARIABLE_NAME_CREATOR , streamReader . getElementText ( ) ) ; } else if ( "title" . equals ( localName ) ) { context . setVariable ( ContentParser . VARIABLE_NAME_TITLE , streamReader . getElementText ( ) ) ; } else if ( "keyword" . equals ( localName ) ) { context . setVariable ( ContentParser . VARIABLE_NAME_KEYWORDS , streamReader . getElementText ( ) ) ; } else if ( "language" . equals ( localName ) ) { context . setVariable ( ContentParser . VARIABLE_NAME_LANGUAGE , streamReader . getElementText ( ) ) ; } } } while ( type != XMLStreamConstants . END_DOCUMENT ) ; streamReader . close ( ) ; }
This method parses the metadata of the document.
This method parses the metadata of the document .