Attached is a sample XML file from which I need to extract data. I am using the DOM document approach, learning from the DOMCount sample code. I am able to extract the data from the "Identification", "Grid", "Solution", and "Results" nodes. I am also able to list the Names of the three nodes called "Panel" using the getElementsByTagName method from the document root. Where I am running into trouble is extracting the attribute data for each element called "Node" [sorry about the use of "Node" here for the corners of an aircraft fuselage panel] for a particular Panel. What should be the approach here, please? (I tried using getElementsByTagName from a "Panel" node - did not work; I tried descending down the subtree using child nodes - could not make it work; I thought about using filters - did not know where/how to start). Can you point me to sample code for the approach you would recommend, please?
-_r4_\. ___`o-#^o`__
<?xml version="1.0" encoding="UTF-8"?> <PanelData xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com D:\rgr4320\r4\12_Projects\737\SelBLDat_XML\ADINB_PanelData.xsd"> <Identification ID="12345" Case="Sample for demonstrating XML format, successful aero data extraction, fictitious data"/> <Grid Path="/project/noise/NoiseWeb/users/rgr4320/grid1"/> <Solution Path="/project/noise/NoiseWeb/users/rgr4320/solution1"/> <Results Path="/project/noise/NoiseWeb/users/rgr4320/results1"/> <Panels> <Panel Name="Crown Section 46"> <Geometry> <Nodes> <Node node_id="26535" x="26.0985" y="1.39522" z="7.06425"/> <Node node_id="26545" x="26.6065" y="-0.882396" z="7.43649"/> <Node node_id="26555" x="26.6065" y="0.882396" z="7.43649"/> <Node node_id="26565" x="26.0858" y="-1.79147" z="6.14629"/> <Node node_id="26575" x="26.0858" y="1.79147" z="6.14629"/> <Node node_id="26585" x="27.8511" y="-1.71005" z="6.14566"/> <Node node_id="26595" x="27.8511" y="1.71081" z="6.14566"/> </Nodes> </Geometry> </Panel> <Panel Name="Cheek Section 43"> <Geometry> <Nodes> <Node node_id="5" x="6.0985" y="1.39522" z="7.06425"/> <Node node_id="6" x="6.6065" y="-0.882396" z="7.43649"/> <Node node_id="8" x="6.6065" y="0.882396" z="7.43649"/> <Node node_id="1" x="6.0858" y="-1.79147" z="6.14629"/> <Node node_id="3" x="6.0858" y="1.79147" z="6.14629"/> <Node node_id="7" x="7.8511" y="-1.71005" z="6.14566"/> <Node node_id="2" x="7.8511" y="1.71081" z="6.14566"/> </Nodes> </Geometry> </Panel> <Panel Name="Extra Test Panel"> <Geometry> <Nodes> <Node node_id="15" x="16.0985" y="1.39522" z="7.06425"/> <Node node_id="16" x="16.6065" y="-0.882396" z="7.43649"/> <Node node_id="18" x="16.6065" y="0.882396" z="7.43649"/> <Node node_id="11" x="16.0858" y="-1.79147" z="6.14629"/> <Node node_id="13" x="16.0858" y="1.79147" z="6.14629"/> <Node node_id="17" x="17.8511" y="-1.71005" z="6.14566"/> <Node node_id="12" x="17.8511" y="1.71081" z="6.14566"/> </Nodes> </Geometry> </Panel> </Panels> </PanelData>
