Ignore:
Timestamp:
03/26/10 23:35:01 (2 years ago)
Author:
jharrop
Message:

@XmlRootElement?, and method in case that is not present.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/TextUtils.java

    r1096 r1106  
    2727 
    2828import javax.xml.bind.JAXBContext; 
     29import javax.xml.bind.JAXBElement; 
    2930import javax.xml.bind.Marshaller; 
     31import javax.xml.namespace.QName; 
    3032 
    3133import org.apache.log4j.Logger; 
     
    4244                 
    4345        /** 
    44          * Extract contents of <w:t> elements.  
     46         * Extract contents of descendant <w:t> elements.  
    4547         *  
    4648         * @param o 
     
    5456         
    5557        /** 
    56          * Extract contents of <w:t> elements.  
     58         * Extract contents of descendant <w:t> elements.  
    5759         *  
    5860         * @param o 
     
    6870                 
    6971        } 
     72 
     73        /** 
     74         * Extract contents of descendant <w:t> elements. 
     75         * Use this for objects which don't have @XmlRootElement 
     76         *  
     77         * @param o 
     78         * @param w 
     79         * @param jc 
     80         * @param uri 
     81         * @param local 
     82         * @param declaredType 
     83         * @throws Exception 
     84         */ 
     85        public static void extractText(Object o, Writer w, JAXBContext jc, 
     86                        String uri, String local, Class declaredType) throws Exception { 
     87                 
     88                Marshaller marshaller=jc.createMarshaller(); 
     89                NamespacePrefixMapperUtils.setProperty(marshaller,  
     90                                NamespacePrefixMapperUtils.getPrefixMapper()); 
     91                marshaller.marshal( 
     92                                new JAXBElement(new QName(uri,local), declaredType, o ),  
     93                                new TextExtractor(w));           
     94        } 
     95         
    7096         
    7197        /** 
Note: See TracChangeset for help on using the changeset viewer.