brianchandotcom/liferay-portal — pull request #9995 by matethurzo (2013-03-29 15:00:42+00:00)
Title: LPS-33811 Adding empty element --> please read description

Hey Brian,

I'm splitting up the commits for this ticket what originally Mike Han sent you: https://github.com/brianchandotcom/liferay-portal/pull/9963

Mike already reviewed these changes.

This is the first batch, I hope this would help you review the changes more easily.

In this PR I'm adding an empty element feature to our XML handling. The empty element is similar to the Collections.emptyList() concept, it will prevent the environment to fail with an NPE but we can still check for this special case because we have a named class for it.

The empty element does not mean that and element name is empty like this: <>.

Instead it will be used when we don't find an element (actual usages will come in the next PRs):

Element element = rootElement.element("test");

if (element == null) {
return SAXReaderUtil.emptyElement();
}

Thanks,

Máté