SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Earth
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Querying XML documents in Databases?

    Hi,


    I am storing Job requests into database table in the following manner:

    requster_id, requster_id, requset_status, request_type, request_content

    inside the request_content I strore the content of the request as XML document, I have more than 100 request type and based on that I have more than 100 XML structure.. for example this is a snippit of Flyer Printing Request:

    <size>A4</size>
    <colors>4</colors>
    <quantity>100000</quantity>
    <when>10</when>


    Other type of request will be completely different..


    My question is: What is the best approche to do searches againest values inside those XML elements? for examle

    select all the request for flyer printing jobs with quantities between 10000 and 50000?

    or give me all requests for book keeping requests with budgets more than $15000 or office locations in such and such city..




    TIA
    AbuAnas

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your searches can be done with XPath, are you pulling the relevent records into a DOM object? Are you working with just 1 record at a time?

    request[quantity > '10000' and quantity < '50000']
    request[budget > '15000' or location/@city='New York']
    for example

  3. #3
    SitePoint Addict Richard Conyard's Avatar
    Join Date
    Jun 2005
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you query like that in T-SQL under SQL 2000?

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Earth
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,


    I havn't started writing the code. I am still in the desgin stage and trying to figure out the best practices so I am not sure either to use DOM or other means. I'll be pulling many records at a time I think since I'll be searching the whole table.. I'll be using PHP+MySQL.


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
  •