incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svante Schubert (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ODFTOOLKIT-376) Get Metadata from Open Office Files
Date Wed, 11 Sep 2013 16:17:51 GMT

    [ https://issues.apache.org/jira/browse/ODFTOOLKIT-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13764452#comment-13764452
] 

Svante Schubert commented on ODFTOOLKIT-376:
--------------------------------------------

You might use
org.odftoolkit.simple.meta.Meta.java, which needs an OdfFileDom from the meta.xml, which is
provided for instance via
		doc = (TextDocument) TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(filename));
		metadom = doc.getMetaDom();

you might take a look into the tests and see how they accessed the data.

If this solves the problem, please close the issue.

                
> Get Metadata from Open Office Files
> -----------------------------------
>
>                 Key: ODFTOOLKIT-376
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-376
>             Project: ODF Toolkit
>          Issue Type: Improvement
>          Components: odfdom
>    Affects Versions: 0.5-incubating, 0.6-incubating
>         Environment: Windows 7, java 1.7
>            Reporter: Guzman Rejon
>              Labels: features, performance, test
>             Fix For: 0.5-incubating
>
>
> I need to modify only the Open Office file metadata. How I can do it without loading
the entire file into memory (file.odt)?
> I need to work only with the file: meta.xml and label: <office:meta> ... metadata
... </ office: meta>
> My code loads the meta.xml file but I can not get metadata:
> OdfPackage pkg = OdfPackage.loadPackage(new File("file.odt"));
> Node d = pkg.getDom("meta.xml").getElementsByTagName("office:document-meta").item(0);
>             
> for(int i =0; i<d.getAttributes().getLength();i++) {
>     String nombre = d.getAttributes().item(i).getNodeName();
>     String valor = d.getAttributes().item(i).getNodeValue();
>     System.out.println("Clave: " + nombre + " valor: " + valor);
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message