Changeset 1203 for trunk/docx4j/src/main/java/org/docx4j/openpackaging
- Timestamp:
- 09/06/10 21:40:42 (17 months ago)
- Location:
- trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts
- Files:
-
- 10 edited
-
DrawingML/Chart.java (modified) (1 diff)
-
DrawingML/Drawing.java (modified) (1 diff)
-
JaxbXmlPart.java (modified) (2 diffs)
-
WordprocessingML/DocumentPart.java (modified) (2 diffs)
-
WordprocessingML/DocumentSettingsPart.java (modified) (1 diff)
-
WordprocessingML/EndnotesPart.java (modified) (1 diff)
-
WordprocessingML/FootnotesPart.java (modified) (1 diff)
-
WordprocessingML/GlossaryDocumentPart.java (modified) (1 diff)
-
WordprocessingML/MainDocumentPart.java (modified) (1 diff)
-
WordprocessingML/StyleDefinitionsPart.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/DrawingML/Chart.java
r1201 r1203 12 12 import org.xlsx4j.sml.CTStylesheet; 13 13 14 public class Chart extends JaxbDmlPart< JAXBElement<CTChartSpace>> {14 public class Chart extends JaxbDmlPart<CTChartSpace> { 15 15 // This part uses a JAXB content model from dml, 16 16 // so we need to use that context. -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/DrawingML/Drawing.java
r1201 r1203 12 12 import org.xlsx4j.sml.CTStylesheet; 13 13 14 public class Drawing extends JaxbDmlPart< JAXBElement<CTDrawing>> {14 public class Drawing extends JaxbDmlPart<CTDrawing> { 15 15 // This part uses a JAXB content model from dml, 16 16 // so we need to use that context. -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/JaxbXmlPart.java
r949 r1203 26 26 import javax.xml.bind.Unmarshaller; 27 27 28 import org.docx4j.XmlUtils; 28 29 import org.docx4j.jaxb.Context; 29 30 import org.docx4j.jaxb.NamespacePrefixMapperUtils; … … 214 215 215 216 log.debug("unmarshalling " + this.getClass().getName() ); 216 jaxbElement = (E) u.unmarshal( is ); 217 jaxbElement = (E) XmlUtils.unwrap( 218 u.unmarshal( is )); 217 219 log.debug( this.getClass().getName() + " unmarshalled" ); 218 220 -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/DocumentPart.java
r1032 r1203 172 172 // Word seems to add an endnotes part when it adds a footnotes part, 173 173 // so existence of part is not determinative 174 CTEndnotes endnotes = wmlPackage.getMainDocumentPart().getEndNotesPart().getJaxbElement() .getValue();174 CTEndnotes endnotes = wmlPackage.getMainDocumentPart().getEndNotesPart().getJaxbElement(); 175 175 176 176 if (endnotes.getEndnote().size()<3) { … … 203 203 public static Node getFootnote(WordprocessingMLPackage wmlPackage, String id) { 204 204 205 CTFootnotes footnotes = wmlPackage.getMainDocumentPart().getFootnotesPart().getJaxbElement() .getValue();205 CTFootnotes footnotes = wmlPackage.getMainDocumentPart().getFootnotesPart().getJaxbElement(); 206 206 int pos = Integer.parseInt(id); 207 207 -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/DocumentSettingsPart.java
r947 r1203 59 59 60 60 } 61 62 @Override63 public Object getJaxbElement() {64 61 65 if (jaxbElement instanceof JAXBElement) {66 if (((JAXBElement)jaxbElement).getName().getLocalPart().equals("settings")) {67 return (CTSettings)((JAXBElement)jaxbElement).getValue();68 } else {69 log.error("Unexpected " + XmlUtils.JAXBElementDebug((JAXBElement)jaxbElement) );70 return jaxbElement;71 }72 } else if (jaxbElement instanceof CTSettings){73 return jaxbElement;74 } else {75 log.error( "Unexpected" + jaxbElement.getClass().getName() );76 return jaxbElement;77 }78 }79 80 62 } -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/EndnotesPart.java
r887 r1203 31 31 32 32 33 public final class EndnotesPart extends JaxbXmlPart< JAXBElement<CTEndnotes>> {33 public final class EndnotesPart extends JaxbXmlPart<CTEndnotes> { 34 34 35 35 public EndnotesPart(PartName partName) throws InvalidFormatException { -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/FootnotesPart.java
r887 r1203 31 31 32 32 33 public final class FootnotesPart extends JaxbXmlPart< JAXBElement<CTFootnotes>> {33 public final class FootnotesPart extends JaxbXmlPart<CTFootnotes> { 34 34 35 35 public FootnotesPart(PartName partName) throws InvalidFormatException { -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/GlossaryDocumentPart.java
r887 r1203 59 59 } 60 60 61 /**62 * Unmarshal XML data from the specified InputStream and return the63 * resulting content tree. Validation event location information may64 * be incomplete when using this form of the unmarshal API.65 *66 * <p>67 * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.68 *69 * @param is the InputStream to unmarshal XML data from70 * @return the newly created root object of the java content tree71 *72 * @throws JAXBException73 * If any unexpected errors occur while unmarshalling74 */75 @Override76 public GlossaryDocument unmarshal( java.io.InputStream is ) throws JAXBException {77 78 try {79 80 Unmarshaller u = jc.createUnmarshaller();81 82 //u.setSchema(org.docx4j.jaxb.WmlSchema.schema);83 u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());84 85 // JAXBElement<?> root = (JAXBElement<?>)u.unmarshal( is );86 // jaxbElement = (org.docx4j.wml.Document)root.getValue();87 88 jaxbElement = (GlossaryDocument) u.unmarshal( is );89 return jaxbElement;90 91 //System.out.println("\n\n" + this.getClass().getName() + " unmarshalled \n\n" );92 93 } catch (Exception e ) {94 e.printStackTrace();95 return null;96 }97 98 99 }100 61 101 62 } -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/MainDocumentPart.java
r1166 r1203 412 412 if (this.getEndNotesPart()!=null) { 413 413 log.debug("Looking at endnotes"); 414 CTEndnotes endnotes= this.getEndNotesPart().getJaxbElement() .getValue();414 CTEndnotes endnotes= this.getEndNotesPart().getJaxbElement(); 415 415 traverseMainDocumentRecursive(endnotes.getEndnote(), null, stylesInUse); 416 416 } 417 417 if (this.getFootnotesPart()!=null) { 418 418 log.debug("Looking at footnotes"); 419 CTFootnotes footnotes= this.getFootnotesPart().getJaxbElement() .getValue();419 CTFootnotes footnotes= this.getFootnotesPart().getJaxbElement(); 420 420 traverseMainDocumentRecursive(footnotes.getFootnote(), null, stylesInUse); 421 421 } -
trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/StyleDefinitionsPart.java
r1096 r1203 73 73 74 74 75 /**76 * Unmarshal XML data from the specified InputStream and return the77 * resulting content tree. Validation event location information may78 * be incomplete when using this form of the unmarshal API.79 *80 * <p>81 * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.82 *83 * @param is the InputStream to unmarshal XML data from84 * @return the newly created root object of the java content tree85 *86 * @throws JAXBException87 * If any unexpected errors occur while unmarshalling88 */89 @Override90 public Styles unmarshal( java.io.InputStream is ) throws JAXBException {91 92 try {93 94 // if (jc==null) {95 // setJAXBContext(Context.jc);96 // }97 98 Unmarshaller u = jc.createUnmarshaller();99 100 //u.setSchema(org.docx4j.jaxb.WmlSchema.schema);101 u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());102 103 log.info("unmarshalling " + this.getClass().getName() + " \n\n" );104 105 jaxbElement = (Styles) u.unmarshal( is );106 107 log.info("\n\n" + this.getClass().getName() + " unmarshalled \n\n" );108 109 } catch (Exception e ) {110 e.printStackTrace();111 }112 113 return jaxbElement;114 115 }116 75 117 76 @Override
Note: See TracChangeset
for help on using the changeset viewer.
