Current location: Hot Scripts Forums » Other Discussions » Database » xml field


xml field

Reply
  #1 (permalink)  
Old 01-24-12, 04:32 AM
altarek's Avatar
altarek altarek is offline
Newbie Coder
 
Join Date: Dec 2010
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
xml field

i have mysql xml field like this
Code:
<?xml version="1.0" encoding="UTF-8"?>
<record
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
    xmlns="http://www.loc.gov/MARC21/slim">
 
  <leader>00764nas </leader>
  <controlfield tag="221">011258</controlfield>
 
  <datafield tag="578" ind1=" " ind2=" ">
    <subfield code="a">jaun</subfield>
  </datafield>
  <datafield tag="356" ind1=" " ind2=" ">
    <subfield code="a"></subfield>
    <subfield code="c"></subfield>
  </datafield>
  <datafield tag="333" ind1=" " ind2=" ">
    <subfield code="d">ali</subfield>
    <subfield code="p">22</subfield>
  </datafield>
  <datafield tag="222" ind1=" " ind2=" ">
    <subfield code="c"></subfield>
    <subfield code="d">1984</subfield>
  </datafield>
 
</record>
i don't know how to apply SELECT ExtractValue at this field?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-24-12, 04:45 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 75
Thanks: 0
Thanked 6 Times in 6 Posts
Code:
select @somevalue, extractvalue(@xml,  '//b[$@somefield]'
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-24-12, 04:51 AM
altarek's Avatar
altarek altarek is offline
Newbie Coder
 
Join Date: Dec 2010
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
I used query like this

Code:
SELECT
  ExtractValue(marcxml,'//datafield[@tag="952"]/*') AS ITEM
FROM marcbib
WHERE bibno=14;
and it give error

FUNCTION employee.ExtractValue does not exist
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-24-12, 05:20 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 75
Thanks: 0
Thanked 6 Times in 6 Posts
first off as far as i can see there is no such tag as 952. second it should be something like

Code:
SELECT @datafield, 
  ExtractValue(@xml ,'//datafield[@tag="952"]/*') AS ITEM
FROM marcbib
WHERE bibno=14;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-24-12, 05:39 AM
altarek's Avatar
altarek altarek is offline
Newbie Coder
 
Join Date: Dec 2010
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
it give me the same error
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 01-24-12, 09:18 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 75
Thanks: 0
Thanked 6 Times in 6 Posts
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 01-29-12, 06:06 AM
altarek's Avatar
altarek altarek is offline
Newbie Coder
 
Join Date: Dec 2010
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
mysql version not supported this function ?is there another solution?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 01-29-12, 10:53 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 75
Thanks: 0
Thanked 6 Times in 6 Posts
update it. the easiest that comes on my mind.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
posting php to xml IFS PHP 1 10-19-09 11:24 AM
XML PHP MYSQL- Writing to a xml file punky79 PHP 8 05-18-09 05:21 AM
Mental XML and attributes mogant0 PHP 2 05-16-09 09:30 AM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
Disable form fields to be submitted RickyRod JavaScript 2 05-24-04 11:15 AM


All times are GMT -5. The time now is 01:12 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.