[
https://issues.apache.org/jira/browse/ODFTOOLKIT-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13764452#comment-13764452
]
Svante Schubert edited comment on ODFTOOLKIT-376 at 9/11/13 4:22 PM:
---------------------------------------------------------------------
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.
PS: Note only the XML file being accessed will be loaded/parsed, aside of the
manifest and the overall ZIP, which have to be unzipped first via the JDK ZIP
implementation.
was (Author: svanteschubert):
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