Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to read xml file with attributes in java?
    primarykey
    data
    text
    <p>I am aware of SO question <a href="https://stackoverflow.com/questions/9008864/java-read-xml-attributes">Failing to get element values using Element.getAttribute()</a> but because I am java begginer, I have additional questions. What I am trying to build is simple application, which will read XML file and then compare it against "golden master." My problem is:</p> <ul> <li>I have lots of different XML files, which differ in attributes</li> <li>The XML files are relatively big. (810 lines of filed - hard to check it by human eye)</li> </ul> <p>Example of file:</p> <pre><code> &lt;DocumentIdentification v="Unique_ID"/&gt; &lt;DocumentVersion v="1"/&gt; &lt;DocumentType v="P81"/&gt; &lt;SenderIdentification v="TEST-001--123456" codingScheme="A01"/&gt; &lt;CreationDateTime v="2012-10-15T13:00:00Z"/&gt; &lt;InArea v="10STS-TST------W" codingScheme="A01"/&gt; &lt;OutArea v="10YWT-AYXOP01--8" codingScheme="A01"/&gt; &lt;TimeSeries&gt; &lt;Period&gt; &lt;TimeInterval v="2012-10-14T22:00Z/2012-10-15T22:00Z"/&gt; &lt;Resolution v="PT15M"/&gt; &lt;Interval&gt; &lt;Pos v="1"/&gt; &lt;Qty v="500"/&gt; &lt;/Interval&gt; &lt;Interval&gt; &lt;Pos v="2"/&gt; &lt;Qty v="500"/&gt; &lt;/Interval&gt; &lt;Interval&gt; &lt;Pos v="3"/&gt; &lt;Qty v="452"/&gt; &lt;/Interval&gt; ... ... &lt;Interval&gt; &lt;Pos v="96"/&gt; &lt;Qty v="891"/&gt; &lt;/Interval&gt; &lt;/Period&gt; &lt;/TimeSeries&gt; </code></pre> <p>Applying solution from the question mentioned above does not get me much further... I realised that I can cast attributes to <code>NamedNodeMap</code> but I dont know how to iterate through it programatically</p> <p>Yes, I know it sounds much like "do my homework" but what I really need is at least small kick to butt, moving me in correct direction. Thanks for help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload