-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support conversion from Strict OOXML #21
Conversation
thanks - I had not considered adding this support here but I'll consider it, might take me a few days to have a look |
pom.xml
Outdated
@@ -3,7 +3,7 @@ | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>com.github.pjfanning</groupId> | |||
<artifactId>excel-streaming-reader</artifactId> | |||
<version>2.3.6-SNAPSHOT</version> | |||
<version>2.3.7-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this? - I'll worry about the version numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
public class OoXmlStrictConverter implements AutoCloseable { | ||
|
||
private static final XMLEventFactory XEF = XMLEventFactory.newInstance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a class called org.apache.poi.util.XMLHelper has methods to create the XML input and output factories - can you use those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private static final Properties mappings; | ||
|
||
static { | ||
XOF.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line won't be needed if you use the XMLHelper method to create an output factory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private static class ByteArrayOutputStreamExposed extends ByteArrayOutputStream { | ||
|
||
public byte[] getBytes() { | ||
return buf; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is more efficient than https://docs.oracle.com/javase/7/docs/api/java/io/ByteArrayOutputStream.html#toByteArray() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toByteArray()
creates a copy.
Probably not that important, performance-wise, considering we're doing IO and unzipping and zipping unnecessarily but just seemed weird to clone the array when all I need to do is read from it.
Add to that, that the ByteArrayOutputStream
has this field protected
and not private
it seems like that was the intention.
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
System.out.println("loaded mappings entries=" + props.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove the println?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I published a new 2.3.6-SNAPSHOT release. |
No description provided.