Results 21 to 37 of 37
- 02-11-2010, 07:04 PM #21
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
- 02-16-2010, 08:33 AM #22
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
parsing string using xpath
hi Aseem,
Thanks for giving reply, We did parsing with your examples (xml file parsing).
Now our situation is to read the data as a string from webservice and parse it using xpath( we wants to read the data as a string from webserice).
And also give us examples on XSLT and Xpath.
and one more doubt regarding Xpathexception. got a error as
javax.servlet.ServletException: org/apache/xpath/XPathException
java.lang.NoClassDefFoundError: org/apache/xpath/XPathException
we put the xalan.jar, xerces-impl.jar and xml-apis.jar in common/endorse and also put in application lib directory.
please provide us example,
Thanks in Advance.
Regards,
praveen.
- 02-17-2010, 03:41 AM #23
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
Do you mean you do not need all the data returned by web service or you want to send selected data to webservice's web method. It's not clear.
By the way,, where you from praveen?
- 02-17-2010, 06:19 AM #24
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
xsl For XML
Hi aseem i have a xml file like below one. When after writing xsl i got data in individually. Actually my intension is to display data as for individual name display profession.
i.e:
I want output as:
Ross cricketer
federer tennis
bollack footballer
here is my xml:
please provide xsl.
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="data.xsl" version="1.0" encoding="UTF-8"?>
<RequestData>
<Req>
<DataList>
<Data>
<Dataspecific>
<Name>Ross</Name>
</Dataspecific>
<Profession>cricketer</Profession>
</Data>
<Data>
<Dataspecific>
<Name>federer</Name>
</Dataspecific>
<Profession>tennis</Profession>
</Data>
<Data>
<Dataspecific>
<Name>bollac</Name>
</Dataspecific>
<Profession>footbakller</Profession>
</Data>
</DataList>
</Req>
</RequestData>
please provide me xsl file for above xml file:
Thanks in Advance,
Regards,
Praveen.
- 02-18-2010, 02:54 AM #25
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="0">
<tr>
<xsl:for-each select="RequestData/Req/DataList/Data/Dataspecific">
<td><xsl:value-of select="Name" /></td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="RequestData/Req/DataList/Data">
<td><xsl:value-of select="Profession" /></td>
</xsl:for-each>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
- 02-18-2010, 05:20 AM #26
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
xsl For XML
Hi Aseem,
Your reply message is useful to me a lot, but our intension is.
show out put like this:
Name Profession (It is heading in color or font bold)
Ross Cricketer
Federer tennis
bollac footbakller
but you given me xsl output is
Ross Federer bollac
cricketer tennis footbakler
please provide me xsl for first one.
And you are also given personal mail as xsl with scripts, what is that and what for that.
Thanks in Advance,
Praveen.
- 02-18-2010, 05:59 AM #27
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
perfect example is given is w3schools.com. Have a look there.
By the way, where you from?
- 02-18-2010, 06:32 AM #28
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
Hi Aseem,
I am from India, What about you.
once again look in to the below xml here my cae is different, i already referred w3schools.
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="data.xsl" version="1.0" encoding="UTF-8"?>
<RequestData>
<Req>
<DataList>
<Data>
<Dataspecific>
<Name>Ross</Name>
</Dataspecific>
<Profession>cricketer</Profession>
</Data>
<Data>
<Dataspecific>
<Name>federer</Name>
</Dataspecific>
<Profession>tennis</Profession>
</Data>
<Data>
<Dataspecific>
<Name>bollac</Name>
</Dataspecific>
<Profession>footbakller</Profession>
</Data>
</DataList>
</Req>
</RequestData>
in w3schools i saw as <xsl:for-each select="catalog/cd">
both title and artist availble under catalog/cd (that means under cd).
But in my case name available under RequestData/Req/DataList/Data/Dataspecific
and profession available under RequestData/Req/DataList/Data.
please help me out for this output.
Name profession
ross cricketer
federer tennis
bollac footbakler
please provide xsl for the above output for above XML
Thanks in Advance,
Regards,
Praveen.
- 02-18-2010, 07:35 AM #29
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
instead of
<xsl:for-each select="catalog/cd">
do
<xsl:for-each select ="RequestData/Req/DataList/Data/Dataspecific">
and
<xsl:for-each select ="RequestData/Req/DataList/Data">
- 02-18-2010, 09:01 AM #30
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Here's a thought...learn xslt.
Aseem had given you a pretty good start point, from which you should have been able to figure it out yourself...
- 02-18-2010, 09:37 AM #31
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
hi i tried but i didn't get my expected out put. please help me.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<HTML>
<BODY>
<H2>Drug Allergies</H2>
<TABLE BORDER="1">
<TR bgcolor="#9acd32">
<TH>Name</TH>
<TH>Reaction</TH>
</TR>
xsl:for-each select ="RequestData/Req/DataList/Data/Dataspecific">
<xsl:for-each select ="RequestData/Req/DataList/Data">
<TR>
<TD><xsl:value-of select="Name"/></TD>
<TD><xsl:value-of select="Reaction"/></TD>
</xsl:for-each>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
please give me xsl for displaying output in
name profession
ros cricketer
federer tennis
bollak footballer
thanks in advance,
regards,
praveen.
- 02-18-2010, 09:57 AM #32
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Your for-each's seem all skewed.
And you're missing a '<' on the first one.
You only need to for-each around Data.
I'd stick that in a template, frankly, but never mind.
You then want to pull out the value of Dataspecific/Name and Reaction. That's it.
- 02-18-2010, 10:57 AM #33
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
reaction is under data and name is under dataspecific. please provide me full xsl.
- 02-18-2010, 11:19 AM #34
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Yes, and I gave you the path.
Look, as with any Java questions, I am not writing your xsl for you...unless you pay me.
Learn xsl.
- 02-19-2010, 04:21 AM #35
Member
- Join Date
- Jan 2010
- Posts
- 14
- Rep Power
- 0
Aseem i got the answer thanks for giving guidence.
- 02-19-2010, 04:57 AM #36
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
no problem praveen..!! keep learning.
- 03-16-2010, 07:28 PM #37
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Consuming a Web Service using Java
By gopikrishnatb in forum Web FrameworksReplies: 2Last Post: 03-02-2009, 09:59 AM -
java.lang.OutOfMemoryError in a web service client
By elchape in forum Advanced JavaReplies: 4Last Post: 06-28-2008, 05:21 PM -
Java Message Service
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 06-09-2008, 09:57 PM -
Java Service Wrapper 3.3.0
By Java Tip in forum Java SoftwareReplies: 0Last Post: 03-29-2008, 01:04 PM -
applet servlet communication
By hardc0d3r in forum Java AppletsReplies: 1Last Post: 07-12-2007, 06:58 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks