Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AbstractElement.USE_STRINGVALUE_SEPARATOR field value configurable #125

Open
dmak opened this issue Jun 24, 2021 · 0 comments
Open

Comments

@dmak
Copy link

dmak commented Jun 24, 2021

In my case there is a need to implement similar logic as in AbstractElement#getStringValue() namely separate string values of consequent elements with some separator (space or newline). This as to API this requires the introduction of new DocumentFactory instance that will produce "custom" DefaultElement instances. Quite some work. Alternatively I suggest to make this option configurable either by having a static setter, or via system property:

public abstract class AbstractElement ... {

    protected static final String STRINGVALUE_SEPARATOR = System.getProperty("org.dom4j.element.string_value_separator", null);
    ...
    public String getStringValue() {
        ...
        if (STRINGVALUE_SEPARATOR != null) {
            if (buffer.length() > 0) {
                buffer.append(STRINGVALUE_SEPARATOR);
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants