Muy buenas!! Tengo este XML y quiero leerlo por bloques como explico a continuacion.
Código:
<?xml version="1.0" encoding="ISO-8859-1"?>
<general titulo="POST GENERAL">
<grupo titulo="Machine Type">
<campo nombre="CT" titulo="Cutting"></campo>
<campo nombre="PN" titulo="Punching"></campo>
<campo nombre="CP" titulo="Cut-Punch"></campo>
</grupo>
<grupo titulo="Units">
<campo nombre="UMM" titulo="mm"></campo>
<campo nombre="UMM" titulo="inches"></campo>
</grupo>
<grupo titulo="Coordinates in Main Program">
<campo nombre="CMP_A" titulo="Absolute"></campo>
<campo nombre="CMP_I" titulo="Incremental"></campo>
</grupo>
</general>
<general titulo="CUTTING">
<grupo titulo="Format">
<campo nombre="CT" titulo="Circle"></campo>
<campo nombre="PN" titulo="Square"></campo>
</grupo>
<grupo titulo="Text">
<campo nombre="UMM" titulo="Plain"></campo>
<campo nombre="UMM" titulo="NO Plain"></campo>
</grupo>
</general>
quiero hacer que cada etiqueta hija sea como una subtabla de su superior.
El caso quedaría asi...
POST GENERAL
- Machine Type
- Cutting
- Punching
- Cut-Punch
- Units
- mm
- inches
- Coordinates in Main Program
- Absolute
- Incremental
CUTTING
- Format
- Circle
- Square
- Text
- Plain
- NO Plain
El código que yo tengo es el sgte:
Código:
set xml_divisiones = xml_dom.getElementsByTagName("general")
n_divisiones = xml_divisiones.length
response.write("DIVISIONES = " & n_divisiones & "<br />")
i=0
set xml_grupos = xml_dom.getElementsByTagName("grupo")
n_grupos = xml_grupos.length
response.write("GRUPOS = " & n_grupos & "<br />")
j=0
set xml_campos = xml_dom.getElementsByTagName("campo")
n_campos = xml_campos.length
response.write("TITULO = " & n_tit & "<br />")
k=0
'////////// RECORREMOS LAS DIVISIONES //////////
response.write("<table border='1'>")
do while (i<n_divisiones)
division = xml_divisiones.item(i).getAttribute("titulo")
response.write("<tr><td>" & division & "</td></tr>")
response.write("<tr><td>")
'////////// RECORREMOS LOS GRUPOS //////////
response.write("<table border='1'>")
do while (j<n_grupos)
grupo = xml_grupos.item(j).getAttribute("titulo")
response.write("<tr><td>" & grupo & "</td></tr>")
response.write("<tr><td>")
'////////// RECORREMOS LOS GRUPOS //////////
response.write("<table border='1'>")
do while (k<n_campos)
nombre = xml_campos.item(k).getAttribute("nombre")
titulo = xml_campos.item(k).getAttribute("titulo")
response.write("<tr><td>" & nombre & "</td><td>" & titulo & "</td></tr>")
k=k+1
loop
response.write("</table>")
response.write("</td></tr>")
j=j+1
loop
response.write("</table>")
response.write("</td></tr>")
i=i+1
loop
response.write("</table>")
MUCHISIMAS GRACIAS...