final Header header = new Header("Opt", optValue);
try {
// iterate over the values to collect namespace ID's
final HeaderElement[] values = header.getValues();
for (int i = 0; i < values.length; i++) {
final HeaderElement element = values[i];
// remove the optional " characters from the beginning and
// the end of the name
String elementName = element.getName();
if (elementName.length() > 1 &&
elementName.charAt(0) == '"' &&
elementName.charAt(elementName.length() - 1) == '"') {
elementName =
elementName.substring(1, elementName.length() - 1);
}
// we are interested in the CC/PP Exchange namespace only
if (element.getValue() == null &&
elementName.equalsIgnoreCase(
"http://www.w3.org/1999/06/24-CCPPexchange")) {
final NameValuePair parameter =
element.getParameterByName("ns");
String paramValue = parameter.getValue();
if (paramValue != null) {
String namespace = null;
paramValue = paramValue.trim();
// check if it is a 2 digit number