Skip to content
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

javax.xml.stream doesn't exists #10

Closed
JasonFoglia opened this issue Sep 20, 2011 · 10 comments
Closed

javax.xml.stream doesn't exists #10

JasonFoglia opened this issue Sep 20, 2011 · 10 comments

Comments

@JasonFoglia
Copy link

cannot access javax.xml.stream.XMLStreamException
class file for javax.xml.stream.XMLStreamException not found epubWriter.write(book, new FileOutputStream("books/testbook.epub"));

Is there something I am doing wrong?
I looked in the Android jar with no luck.

Android 2.2 / 2.3 / 3.0 no luck.

@psiegman
Copy link
Owner

Hi Jason,

Epublib doesn't use javax.xml.stream classes for quite a while now.
Where did you find the version you're using ?

Paul

@JasonFoglia
Copy link
Author

Hi Paul,

I downloaded the source from github https://github.com/psiegman/epublib.
I am using Java jdk 1.6.0_27 and jre 6, netbeans 7.0.1, kenai android plugin for netbeans.
I ran the Maven build and import the jar to my project, copied the script Simple1 from your site and ran a test.
The message above is what I received from the output.

I thought I was missing the correct android api's, after some research in androids documentation, I found nothing.

@JasonFoglia
Copy link
Author

The location were I found the code is:

nl/siegmann/epublib/epub/EpubWriter.class in F:\Android\psiegman-epublib-787d1f6\epublib-tools\target\epublib-tools-3.0-SNAPSHOT-complete.jar

@psiegman
Copy link
Owner

Aha. Only epublib-core works on android.
It will enable you to read/change/write epubs just fine.

Use only epublib-core and you should be good.

@JasonFoglia
Copy link
Author

Hey Paul,

Still the same thing.

here is a snippet from the EpubWriter.class
using only core: epublib-core-3.0-SNAPSHOT.jar

package nl.siegmann.epublib.epub;

import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.ZipOutputStream;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLStreamException; <-<-<- this is were the problem is coming up. The compiler can't find this file.
import nl.siegmann.epublib.domain.Book;
import nl.siegmann.epublib.domain.Resource;

public class EpubWriter
{

private static final org.slf4j.Logger log;
static final String EMPTY_NAMESPACE_PREFIX = "";
private BookProcessor bookProcessor;

@psiegman
Copy link
Owner

Wow, you're correct. I totally overlooked those classes.
I've removed them and uploaded a new version.
Could you check whether it works for you ?

@JasonFoglia
Copy link
Author

Hey Paul,

Ok so your fix worked but another issue. Not sure if this one is from you or not.

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lnl/siegmann/epublib/browsersupport/NavigationEvent;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
at com.android.dx.command.dexer.Main.processClass(Main.java:372)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
at com.android.dx.command.dexer.Main.access$400(Main.java:59)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
at com.android.dx.command.dexer.Main.processOne(Main.java:313)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
at com.android.dx.command.dexer.Main.run(Main.java:185)
at com.android.dx.command.dexer.Main.main(Main.java:166)
at com.android.dx.command.Main.main(Main.java:90)
1 error; aborting

@psiegman
Copy link
Owner

psiegman commented Oct 9, 2011

Hi Jason,

I've finally found the time to have a look at it, and writing an epub file works fine on an 2.2 emulator.

Code:

        EpubWriter epubWriter = new EpubWriter();
        FileOutputStream out = openFileOutput("testbook.epub", 0);
        epubWriter.write(book, out);
        out.close();
        Log.i("epublib", "done writing file");

If it's not working for you can you send me some example code ?

@JasonFoglia
Copy link
Author

Hey Paul,

Sorry I am getting back to you now. I tried to code and it worked great.
Thanks for all our help.

Jason Foglia

On Sun, Oct 9, 2011 at 6:42 AM, Paul Siegmann <
reply@reply.github.com>wrote:

Hi Jason,

I've finally found the time to have a look at it, and writing an epub file
works fine on an 2.2 emulator.

Code:

                   EpubWriter epubWriter = new EpubWriter();
                   FileOutputStream out =

openFileOutput("testbook.epub", 0);
epubWriter.write(book, out);
out.close();
Log.i("epublib", "done writing file");

If it's not working for you can you send me some example code ?

Reply to this email directly or view it on GitHub:
#10 (comment)

@JasonFoglia
Copy link
Author

Hey Paul,

Not sure about this one. I didn't get errors but I also got no file. I tried
changing the path to external but that caused an exception, not sure if that
helps.
I am using the 2.2 emulator too.

Book book = new Book();
book.getMetadata().addTitle("Epublib test book 1");
book.getMetadata().addAuthor(new Author("Test_first_name",
"Test_last_name"));

EpubWriter epubWriter = new EpubWriter();
FileOutputStream out = null;
try
{
out = openFileOutput("testbook.epub", 0);
}catch(FileNotFoundException ex)
{
Log.d(tag, ex.getMessage());
}
try
{
epubWriter.write(book, out);
}catch(IOException ex)
{
Log.d(tag, ex.getMessage());
}
try
{
out.close();
}catch(IOException ex)
{
Log.d(tag, ex.getMessage());
}

java.io.File file = new java.io.File("/", "testbook.epub");
if(file.exists())
Log.d(tag, "file created");
else
Log.d(tag, "file not created");

Thanks!

Jason Foglia

On Fri, Oct 21, 2011 at 11:54 AM, Jason Foglia jason.foglia@gmail.comwrote:

Hey Paul,

Sorry I am getting back to you now. I tried to code and it worked great.
Thanks for all our help.

Jason Foglia

On Sun, Oct 9, 2011 at 6:42 AM, Paul Siegmann <
reply@reply.github.com>wrote:

Hi Jason,

I've finally found the time to have a look at it, and writing an epub file
works fine on an 2.2 emulator.

Code:

                   EpubWriter epubWriter = new EpubWriter();
                   FileOutputStream out =

openFileOutput("testbook.epub", 0);
epubWriter.write(book, out);
out.close();
Log.i("epublib", "done writing file");

If it's not working for you can you send me some example code ?

Reply to this email directly or view it on GitHub:
#10 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants