Results 1 to 3 of 3

Thread: XQuery with HTML?

  1. #1
    Join Date
    Aug 2010
    Posts
    7
    Thanks
    8

    Default XQuery with HTML?

    Hi, I use the XQuery in Qt to read the HTML, the query is:

    declare variable $inputDoc external;

    doc($inputDoc)/tbody

    When I use it for:

    XML Code:
    1. <tbody>
    2. <xx>asd</xx>
    3. </tbody>
    To copy to clipboard, switch view to plain text mode 

    It is valid, but when I use it for:
    XML Code:
    1. <tbody>
    2. <tr class="epRowTwo">
    3. <td colspan="2" class="c"><img src="/images/cds/137/main.png" alt="Main Image">
    4. </td>
    5. </tr>
    6. <tr class="epRowOne">
    7. <td class="b">Title</td>
    8. <td>
    9. <div style="width:300px;">
    10. 風のメッセージ/このゆびとまれ (通常盤)
    11. <br>
    12. <div style="margin-left:2em;">
    13. <b>English:</b> Message of the Wind / Follow Me (Regular Version)<br><b>Japanese (Romanized):</b> Kaze no Message / Kono Yubi Tomare (Regular Version)<br><b>Japanese (Trans):</b> Message of the Wind / Follow Me (Regular Version)<br>
    14. </div>
    15.  
    16. </div>
    17. </td>
    18. </tr>
    19. <tr class="epRowTwo">
    20. <td class="b">Artist</td>
    21. <td><div style="width:300px;">水橋舞 / あきよしふみえ (Mai Mizuhashi / Akiyoshi Fumie)</div></td>
    22. </tr>
    23. <tr class="epRowOne">
    24. <td class="b">Catalog #</td>
    25. <td>ZMCP-4082</td>
    26. </tr>
    27. <tr class="epRowTwo">
    28. <td class="b">Release Date</td>
    29. <td>2008-05-28</td>
    30. </tr>
    31. <tr class="epRowOne">
    32. <td class="b">Language</td>
    33. <td>Japanese</td>
    34. </tr>
    35. <tr class="epRowTwo">
    36. <td class="b"># of Discs</td>
    37. <td>1</td>
    38. </tr>
    39. <tr class="epRowOne">
    40. <td class="b"># of Tracks</td>
    41. <td>5</td>
    42. </tr>
    43. <tr class="epRowTwo">
    44. <td class="b">Price/MSRP</td>
    45. <td>1,365円</td>
    46. </tr>
    47. <tr class="epRowOne">
    48. <td class="b">Run Time</td>
    49. <td>20:06</td>
    50. </tr>
    51. <tr class="epRowTwo">
    52. <td class="b">Your Rating</td>
    53. <td>You must be logged in to rate.</td>
    54. </tr>
    55. <tr class="epRowOne">
    56. <td class="b">Avg Rating</td>
    57. <td><span class="cd-137">9.0000</span> (<span class="votescount-cd-">5</span>)</td>
    58. </tr>
    59. <tr class="epRowTwo">
    60. <td class="b">Description</td>
    61. <td>
    62. <div style="width:300px;">
    63. A Limited Edition CD+DVD version was also released on the same day.
    64. </div>
    65. </td>
    66. </tr>
    67. </tbody>
    To copy to clipboard, switch view to plain text mode 

    it is always invalid.

    I just don't know why...

    Is HTML a kind of XML?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: XQuery with HTML?

    It is invalid because your HTML is not a well formed XML, the img tags do not have closing tags.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    liuyanghejerry (16th June 2011)

  4. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: XQuery with HTML?

    ... and the br tag, but you can load that html and do some simple QRegExp replacements for those tags. And with some luck you'll get a well formed XML document. There are surly libraries out there which does that job for you.

  5. The following user says thank you to Lykurg for this useful post:

    liuyanghejerry (16th June 2011)

Similar Threads

  1. Using HTML and CSS in QT Help System
    By whitefurrows in forum Qt Programming
    Replies: 13
    Last Post: 7th May 2012, 12:07
  2. xmlpatterns issues or lack of understanding XQuery?
    By zaphod.b in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2011, 14:24
  3. Replies: 4
    Last Post: 10th November 2010, 07:53
  4. XQuery indexing
    By dv_ in forum Qt Programming
    Replies: 1
    Last Post: 7th June 2009, 09:20
  5. Qt's and XQuery's Data Model 4.4beta question
    By patrik08 in forum Qt Programming
    Replies: 0
    Last Post: 7th March 2008, 09:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.