All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.docx4j.jaxb.Docx4jUnmarshallerListener Maven / Gradle / Ivy

Go to download

docx4j is a library which helps you to work with the Office Open XML file format as used in docx documents, pptx presentations, and xlsx spreadsheets.

There is a newer version: 11.4.11
Show newest version
package org.docx4j.jaxb;

import javax.xml.bind.Unmarshaller;

import org.docx4j.mce.AlternateContent;
import org.docx4j.openpackaging.parts.JaxbXmlPart;

public class Docx4jUnmarshallerListener extends Unmarshaller.Listener {

	private JaxbXmlPart part;

	public Docx4jUnmarshallerListener(JaxbXmlPart part) {
		this.part = part;
	}

//	@Override
//	public void beforeUnmarshal(Object target, Object parent) {
//
//	}

  @Override
  public void afterUnmarshal(Object target, Object parent) {
	  
		if (target instanceof AlternateContent.Choice) {
			
			AlternateContent.Choice choice = (AlternateContent.Choice)target;
			//System.out.print("after, Need to declare " + choice.getRequires() );
			
			if (choice.getRequires()!=null) {
				part.addMcChoiceNamespace(choice.getRequires());
			}
			if (choice.getIgnorable()!=null) {
				part.addMcChoiceNamespace(choice.getIgnorable());
			}
			if (choice.getMustUnderstand()!=null) {
				part.addMcChoiceNamespace(choice.getMustUnderstand());
			}
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy