org.jdom2.JDOMFactory Java Examples

The following examples show how to use org.jdom2.JDOMFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapManifest.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void configure() {
    // Setup @MapScoped and bind MapDefinition as a seed object
    install(new MapInjectionScope().new Manifest());

    final FactoryModuleBuilder fmb = new FactoryModuleBuilder();
    install(fmb.build(MapFilePreprocessor.Factory.class));
    install(fmb.build(MapLogger.Factory.class));

    bind(SAXHandler.class).to(BoundedSAXHandler.class);
    bind(SAXHandlerFactory.class).toInstance(BoundedSAXHandler::new);
    bind(JDOMFactory.class).to(BoundedJDOMFactory.class);

    bind(PGMMap.Factory.class);
    bind(MapConfiguration.class).to(PGMMapConfiguration.class);
    bind(MapDoc.class).to(MapDocument.class);

    inSet(MapRootParser.class);

    bind(ValidationContext.class).to(FeatureDefinitionContext.class);

    bind(MapModuleContext.class).in(MapScoped.class);
    bind(ModuleExceptionHandler.class).to(MapModuleContext.class);

    expose(MapDefinition.class);
    expose(PGMMap.class);

    requestStaticInjection(XMLUtils.class);
}
 
Example #2
Source File: JDom2Writer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 1.4.5
 */
public JDom2Writer(
                  final Element container, final JDOMFactory factory,
                  final NameCoder nameCoder) {
    super(container, nameCoder);
    documentFactory = factory;
}
 
Example #3
Source File: MCRXSL2XMLTransformer.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
private Document getDocument(JDOMResult result) {
    Document resultDoc = result.getDocument();
    if (resultDoc == null) {
        //Sometimes a transformation produces whitespace strings
        //JDOM would produce a empty document if it detects those
        //So we remove them, if they exists.
        List<Content> transformResult = result.getResult();
        int origSize = transformResult.size();
        Iterator<Content> iterator = transformResult.iterator();
        while (iterator.hasNext()) {
            Content content = iterator.next();
            if (content instanceof Text) {
                String trimmedText = ((Text) content).getTextTrim();
                if (trimmedText.length() == 0) {
                    iterator.remove();
                }
            }
        }
        if (transformResult.size() < origSize) {
            JDOMFactory f = result.getFactory();
            if (f == null) {
                f = new DefaultJDOMFactory();
            }
            resultDoc = f.document(null);
            resultDoc.setContent(transformResult);
        }
    }
    return resultDoc;
}
 
Example #4
Source File: MapManifest.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@Provides
SAXBuilder saxBuilder(SAXHandlerFactory saxHandlerFactory, JDOMFactory jdomFactory) {
    return new SAXBuilder(null, saxHandlerFactory, jdomFactory);
}
 
Example #5
Source File: BoundedSAXHandler.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@Inject public BoundedSAXHandler(JDOMFactory factory) {
    super(factory);
}
 
Example #6
Source File: JDom2Writer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @since 1.4.5
 */
public JDom2Writer(final Element container, final JDOMFactory factory) {
    this(container, factory, new XmlFriendlyNameCoder());
}
 
Example #7
Source File: JDom2Writer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @since 1.4.5
 */
public JDom2Writer(final JDOMFactory factory, final NameCoder nameCoder) {
    this(null, factory, nameCoder);
}
 
Example #8
Source File: JDom2Writer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @since 1.4.5
 */
public JDom2Writer(final JDOMFactory factory) {
    this(null, factory);
}