• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

XML to JAVA

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

This is my code where i need to get element value in java
Ex:
if Element name=ScheduleDate value should be like is "1/24/2011".

<?xml version="1.0" encoding="utf-16"?>
<DataSet>
<xs:schema id="Schedule_x0020_Set" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Schedule_x0020_Set" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Schedule_x0020_Table">
<xs:complexType>
<xs:sequence>
<xs:element name="ScheduleDate" type="xs:string" minOccurs="0" />
<xs:element name="StaffLName" type="xs:string" minOccurs="0" />
<xs:element name="StaffFName" type="xs:string" minOccurs="0" />
<xs:element name="TaskName" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<Schedule_x0020_Set>
<Schedule_x0020_Table diffgr:id="Schedule Table1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<ScheduleDate>1/24/2011</ScheduleDate>
<StaffLName>Smith</StaffLName>
<StaffFName>Josh</StaffFName>
<TaskName>Day Shift</TaskName>
</Schedule_x0020_Table>
<Schedule_x0020_Table diffgr:id="Schedule Table2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<ScheduleDate>1/24/2011</ScheduleDate>
<StaffLName>Doe</StaffLName>
<StaffFName>Jane</StaffFName>
<TaskName>Night Shift</TaskName>
</Schedule_x0020_Table>
<Schedule_x0020_Table diffgr:id="Schedule Table3" msdata:rowOrder="2" diffgr:hasChanges="inserted">
<ScheduleDate>1/24/2011</ScheduleDate>
<StaffLName>Johnson</StaffLName>
<StaffFName>Barbara</StaffFName>
<TaskName>Off</TaskName>
</Schedule_x0020_Table>
</Schedule_x0020_Set>
</diffgr:diffgram>
</DataSet>

Regards
Dillibabub.B
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

What exactly is your question, and what did you try to solve the problem? Where do you get stuck?
 
Dillibabu Balakrishnan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Jesper de Jong,
thanks for replying to my post

Actually the above code is SOAP result which is in XML schema format.In that code i need to get resultant value in java.(for example if i give element type="ScheduleDate" the response should be like this "1/24/2011")


Regards
Dillibabu.B
 
lowercase baba
Posts: 13082
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so...you are trying to parse this using java?
 
Dillibabu Balakrishnan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes not in Eclipse or netbeans , that is in Jdeveloper10.1.3.3.0

Regards
Dillibabu.B
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What IDE you're using doesn't matter. Please ask a more specific question, explain what you've done until now and where exactly you don't know how to proceed.

How are you parsing the XML? Using a DOM or SAX parser, JAXB, or something else? Are you using JAX-WS (since you say this is a SOAP web service)? What did you try? Or do you just don't know what to try? Is your question "I don't know how to parse XML in my Java program", or is your question "I've parsed this XML, I now have an org.w3c.dom.Document object, how do I find the value of this particular element"?
 
Dillibabu Balakrishnan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jesper de Jong,

Thanks for reply to my post,i am very new to this topic(Web service,SOAP).
For your all question below things are my answer
1.How are you parsing the XML?
Using a DOM
2.Are you using JAX-WS?
yes

 
fred rosenberger
lowercase baba
Posts: 13082
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dillibabu Balakrishnan wrote:
Thanks for reply to my post,i am very new to this topic(Web service,SOAP).
For your all question below things are my answer
1.How are you parsing the XML?
Using a DOM
2.Are you using JAX-WS?
yes


I don't think that was quite all his questions...

Remember, your job, when asking a question, is to make it as EASY as possible for someone to help you. The easier you make it, the more likely someone will be willing to give up their free time and help you.

Jesper had also said this:

Jesper de Jong wrote:Please ask a more specific question, explain what you've done until now and where exactly you don't know how to proceed... What did you try? Or do you just don't know what to try? Is your question "I don't know how to parse XML in my Java program", or is your question "I've parsed this XML, I now have an org.w3c.dom.Document object, how do I find the value of this particular element"?

 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic