Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to fetch attribute values of two different attributes example xml is pasted below Please help me out?????

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy How to fetch attribute values of two different attributes example xml is pasted below Please help me out?????

    How to fetch attribute values of two different attributes example xml is pasted below Please help me out?????

    <?xml version="1.0" encoding="iso-8859-1"?>
    <EXPRESSION>
    <OPERATOR VALUE="+">
    <OPERATOR VALUE="-">
    <OPERATOR VALUE="and">
    <LOGIC>
    <OPERATORERAND VALUE="A"></OPERATORERAND>
    </LOGIC>
    <LOGIC>
    <OPERATORERAND VALUE="B"></OPERATORERAND>
    </LOGIC>
    </OPERATOR>
    <OPERATOR VALUE="and">
    <OPERATOR VALUE="negation">
    <LOGIC>
    <OPERATORERAND VALUE="C"></OPERATORERAND>
    </LOGIC>
    </OPERATOR>
    <OPERATOR VALUE="xor">
    <LOGIC>
    <OPERATORERAND VALUE="D"></OPERATORERAND>
    </LOGIC>
    </OPERATOR>
    </OPERATOR>
    </OPERATOR>
    <BOOLEAN>
    <VALUE>true</VALUE>
    </BOOLEAN>
    </OPERATOR>
    </EXPRESSION>

    I want the output as

    Operator=+
    Operator=-
    Operator=and
    Operand=A
    Operand=B
    Operator=and
    Operator=negation
    Operand=C
    Operator=XOR
    Operand=C

    Please help me out ?????


  2. #2
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: How to fetch attribute values of two different attributes example xml is pasted below Please help me out?????

    Hello.
    I suggest two choices.
    One is traditional file reading. You can use scanner class and read the file and parse it according to your requirements.
    The other is JAXP. Java provides API for validating and parsing XML docs. You can try that.

    Syed.

Similar Threads

  1. java Api to fetch the CPU Details
    By ashish12169 in forum Java SE APIs
    Replies: 1
    Last Post: January 11th, 2024, 01:13 AM
  2. how to fetch data from MySQL into textarea...
    By Ravi Raj in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 7th, 2013, 05:18 AM
  3. key with 2 attributes?
    By ober0330 in forum Collections and Generics
    Replies: 1
    Last Post: October 10th, 2011, 11:47 AM
  4. [SOLVED] XML get/set node by attribute value
    By b_jones10634 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 24th, 2010, 11:26 AM
  5. How to fetch integer data from excel
    By nehakuls in forum JDBC & Databases
    Replies: 5
    Last Post: May 14th, 2010, 01:44 AM

Tags for this Thread