reading an XML file into java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • momotaro
    Contributor
    • Sep 2006
    • 357

    reading an XML file into java

    Hi,

    I have an XML file that I want to read node by node in java.

    if someone have any ideas please help.

    thank's in advance.
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    XML reader class is available in Java.

    See this API.
    There are several other techniques also available, but usage depends on your need.

    If you need a quick sample follow this link

    Regards
    Dheeraj Joshi
    Last edited by Dheeraj Joshi; Jul 13 '11, 02:17 AM. Reason: Added sample link

    Comment

    • momotaro
      Contributor
      • Sep 2006
      • 357

      #3
      Thank's! while waiting for your answer I somehow managed to figure that out and now if it is not too much asking you again am looking for a way to create java class for each node based on what is in my XML file:

      Code:
      <ENTITY name="shipto">
      	  <FIELD name="name" type="boolean" >
      	  </FIELD>
      	  <FIELD name="ID" type="string">
      	  </FIELD>
      	  <Association Cardinality="many_to_many" associated_to="shipo"/>
      	  
        </ENTITY>
        
        <ENTITY name="item">
      	  <FIELD name="nom" type="boolean">
            </FIELD>
            
            <Association Cardinality="one_to_one" associated_to="item"/>
        </ENTITY>
      and have something like that:

      <Entity> turns to a class in java and the <FIELD> will be attributes of its ENTITY

      thanks in advance.

      Comment

      • Dheeraj Joshi
        Recognized Expert Top Contributor
        • Jul 2009
        • 1129

        #4
        Are you looking something like this?

        I also found this article. It may help you.

        Kind Regards
        Dheeraj Joshi
        Last edited by Dheeraj Joshi; Jul 15 '11, 02:40 PM.

        Comment

        Working...