Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.docx4j.finders;
 
 import java.util.List;
 
 
public  class CommentFinder extends CallbackImpl {
    List<ChildcommentElements = new ArrayList<Child>();

    

Returns:
the commentElements
	}
    public List<Objectapply(Object o) {
        if (o instanceof javax.xml.bind.JAXBElement
                && (((JAXBElement)o).getName().getLocalPart().equals("commentReference")
                		|| ((JAXBElement)o).getName().getLocalPart().equals("commentRangeStart")
                		|| ((JAXBElement)o).getName().getLocalPart().equals("commentRangeEnd")	                            		
                		)) {
        		..println(((JAXBElement)o).getName().getLocalPart());
                .add( (Child)XmlUtils.unwrap(o) );
            } else 
        if (o instanceof CommentReference || 
            o instanceof CommentRangeStart || 
            o instanceof CommentRangeEnd) {
            .add((Child)o);
        }
        return null;
    }
        @Override // to setParent
        public void walkJAXBElements(Object parent) {
            List children = getChildren(parent);
            if (children != null) {
                for (Object o : children) {
                    if (o instanceof javax.xml.bind.JAXBElement
                            && (((JAXBElement)o).getName().getLocalPart().equals("commentReference")
                            		|| ((JAXBElement)o).getName().getLocalPart().equals("commentRangeStart")
                            		|| ((JAXBElement)o).getName().getLocalPart().equals("commentRangeEnd")	                            		
                            		)) {
                    	
                    	((Child)((JAXBElement)o).getValue()).setParent(XmlUtils.unwrap(parent));
                    } else {                        
                        o = XmlUtils.unwrap(o);
	                    if (o instanceof Child) {
	                        ((Child)o).setParent(XmlUtils.unwrap(parent));
	                    }
                    }
                    this.apply(o);
                    if (this.shouldTraverse(o)) {
                        walkJAXBElements(o);
                    }
                }
            }
        }           
    }	
New to GrepCode? Check out our FAQ X