Page 2 of 2 FirstFirst 12
Results 21 to 37 of 37
  1. #21
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

  2. #22
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default 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.

  3. #23
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    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?

  4. #24
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default 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.

  5. #25
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    <?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>

  6. #26
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default 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.

  7. #27
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    perfect example is given is w3schools.com. Have a look there.
    By the way, where you from?

  8. #28
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    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.

  9. #29
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    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">

  10. #30
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,182
    Rep Power
    20

    Default

    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...

  11. #31
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    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.

  12. #32
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,182
    Rep Power
    20

    Default

    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.

  13. #33
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    reaction is under data and name is under dataspecific. please provide me full xsl.

  14. #34
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,182
    Rep Power
    20

    Default

    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.

  15. #35
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    Aseem i got the answer thanks for giving guidence.

  16. #36
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    no problem praveen..!! keep learning.

  17. #37
    kiran.doddi is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    Hi Sabeer...

    Even I have the same Query that you have described.
    But couldn't find an answer till now.
    So if you have any solution please help me out.

    -Kiran

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Consuming a Web Service using Java
    By gopikrishnatb in forum Web Frameworks
    Replies: 2
    Last Post: 03-02-2009, 10:59 AM
  2. java.lang.OutOfMemoryError in a web service client
    By elchape in forum Advanced Java
    Replies: 4
    Last Post: 06-28-2008, 06:21 PM
  3. Java Message Service
    By Java Tutorial in forum Java Tutorial
    Replies: 0
    Last Post: 06-09-2008, 10:57 PM
  4. Java Service Wrapper 3.3.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 03-29-2008, 02:04 PM
  5. applet servlet communication
    By hardc0d3r in forum Java Applets
    Replies: 1
    Last Post: 07-12-2007, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •