Validación de XML (diferentes etiquetas secundarias) según el valor del atributo

Estoy escribiendo un diseñador de tablero que creará widgets basados en valores xml.

me gusta

<dashboard>
    <widget type="chart">

    </widget>
</dashboard> 

Quiero cambiar las etiquetas dentro del<widget> basado en el valor de@tipo por ejemplo sitype = "chart" Entonces debería permitir diferentes etiquetas

<dashboard>
    <widget type="chart">
        <title text="Chart Title"></title>
        <plotOptions>
            <plotOptions>
                <pie showInLegend="true" shadow="false" innerSize="50%">
                    <dataLabels color="#fff" distance="-20" format="{point.percentage:.0f} %" overflow="false"></dataLabels>
                </pie>
            </plotOptions>
            <legend width="150" align="right" x="10" layout="vertical">
                <navigation></navigation>
            </legend>
            <tooltip enabled="false"></tooltip>
            <exporting enabled="true"></exporting>
        </plotOptions>
    </widget>
</dashboard>

Y si tenemostipo = "tabla" Debería permitir diferentes etiquetas

<dashboard>
    <widget type="table">
        <title text="Table Title"></title>
        <thead>
            <tr>
                <th>One</th>
                <th>Two</th>
                <th>Three</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>DS.One</td>
                <td>DS.Two</td>
                <td>DS.Three</td>
            </tr>
        </tbody>
    </widget>
</dashboard> 

Y también debería dar sugerencias automáticas en el editor XML como"ECLIPSE"

Respuestas a la pregunta(2)

Su respuesta a la pregunta