@Override
    protected void initializeSegment(SegmentConfig segment) {
        super.initializeSegment(segment);

        if (segment.getXmlName() == null) {
            segment.setXmlName(segment.getName());
        }
        
        String type = segment.getXmlType();
        if (type == null) {
            segment.setXmlType(XmlTypeConstants.XML_TYPE_ELEMENT);
        }
        else {
            if (!XmlTypeConstants.XML_TYPE_NONE.equals(type) &&
                !XmlTypeConstants.XML_TYPE_ELEMENT.equals(type)) {
                throw new BeanIOConfigurationException("Invalid xmlType '" + type + "'");
            }
        }
        
        if (segment.getXmlPrefix() != null) {
            if (segment.getXmlNamespace() == null) {
                throw new BeanIOConfigurationException("Missing namespace for configured XML prefix");
            }
        }
        
        if (segment.getXmlNamespace() == null) {
            ComponentConfig parent = getParent();
            segment.setXmlPrefix(parent.getXmlPrefix());
            segment.setXmlNamespace(parent.getXmlNamespace());
            segment.setXmlNamespaceAware(parent.isXmlNamespaceAware());
        }
        else if ("*".equals(segment.getXmlNamespace())) {
            segment.setXmlPrefix(null);
            segment.setXmlNamespace(null);
            segment.setXmlNamespaceAware(false);      
        }
        else if ("".equals(segment.getXmlNamespace())) {
            segment.setXmlPrefix(null);
            segment.setXmlNamespace(null);
            segment.setXmlNamespaceAware(true);
        }
        else {
            segment.setXmlNamespaceAware(true);
        }
    }