J
jesper
Hi
I am currently following the tutorial from IBM
(http://www-106.ibm.com/developerworks/xml/edu/x-dw-xjaxb-i.html)
I have three problems at the moment.
1. It says else where that when the source code files are generated using
the XJC, it is possible to compile the generated source code using javac
generated\*.java generated\impl\*.java , but this only gives me 97 errors.?
2. I have typed in the source code from the tutorial :
In the tutorial it says that I have to compile the source code in the
generated directory as well, (How do I do that ? because when I compile the
generated source code it gives me errors?)
When I compile the source code below, it gives me these errors
________________________________________________________________________
----jGRASP exec: javac E:\java\xml\ex1\ProcessItem.java
ÏϧÏ
ϼ§ÏProcessItem.java:19: exception javax.xml.bind.JAXBException is never
thrown in body of corresponding try statement
ÏÏ§Ï } catch ( JAXBException e ) {
ÏÏ§Ï ^
ProcessItem.java:27: unreported exception javax.xml.bind.JAXBException; must
be caught or declared to be thrown
ÏÏ§Ï jaxbContext = JAXBContext.newInstance(packageName);
ÏÏ§Ï ^
ÏϧÏ2 errors
____________________________________________________________
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
public class ProcessItem {
private String packageName = "generated";
private String xmlFileName = "item.xml";
private JAXBContext jaxbContext;
ProcessItem() {
createItem();
readItem();
}
private void createItem() {
try {
createContext();
createUnmarshaller();
createFile();
unmarshalFile();
} catch ( JAXBException e ) {
System.out.println("There has been a problem either creating the "
+ "context for package '" + packageName +
"', creating an unmarshaller for it, or unmarshalling the '" +
xmlFileName + "' file. Formally, the problem is a " + e);
}
}
private void createContext() {
jaxbContext = JAXBContext.newInstance(packageName);
}
private void createUnmarshaller() {}
private void createFile() {}
private void unmarshalFile() {}
private void readItem() {}
public static void main(String[] args) {
new ProcessItem();
}
}
Thanks for your help,
Jesper Berthing, Denmark
I am currently following the tutorial from IBM
(http://www-106.ibm.com/developerworks/xml/edu/x-dw-xjaxb-i.html)
I have three problems at the moment.
1. It says else where that when the source code files are generated using
the XJC, it is possible to compile the generated source code using javac
generated\*.java generated\impl\*.java , but this only gives me 97 errors.?
2. I have typed in the source code from the tutorial :
In the tutorial it says that I have to compile the source code in the
generated directory as well, (How do I do that ? because when I compile the
generated source code it gives me errors?)
When I compile the source code below, it gives me these errors
________________________________________________________________________
----jGRASP exec: javac E:\java\xml\ex1\ProcessItem.java
ÏϧÏ
ϼ§ÏProcessItem.java:19: exception javax.xml.bind.JAXBException is never
thrown in body of corresponding try statement
ÏÏ§Ï } catch ( JAXBException e ) {
ÏÏ§Ï ^
ProcessItem.java:27: unreported exception javax.xml.bind.JAXBException; must
be caught or declared to be thrown
ÏÏ§Ï jaxbContext = JAXBContext.newInstance(packageName);
ÏÏ§Ï ^
ÏϧÏ2 errors
____________________________________________________________
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
public class ProcessItem {
private String packageName = "generated";
private String xmlFileName = "item.xml";
private JAXBContext jaxbContext;
ProcessItem() {
createItem();
readItem();
}
private void createItem() {
try {
createContext();
createUnmarshaller();
createFile();
unmarshalFile();
} catch ( JAXBException e ) {
System.out.println("There has been a problem either creating the "
+ "context for package '" + packageName +
"', creating an unmarshaller for it, or unmarshalling the '" +
xmlFileName + "' file. Formally, the problem is a " + e);
}
}
private void createContext() {
jaxbContext = JAXBContext.newInstance(packageName);
}
private void createUnmarshaller() {}
private void createFile() {}
private void unmarshalFile() {}
private void readItem() {}
public static void main(String[] args) {
new ProcessItem();
}
}
Thanks for your help,
Jesper Berthing, Denmark