1
neda_barna
change to xml
  • 2008/2/27 12:47

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


hi i want get data from database and change it to xml
for example properties of one paper
i want get name,lastname,title,....
and change it to xml like this
what must i do??????????/
<?xml version="1.0" encoding="UTF-8"?>
<records>
  <record>
    <language>eng</language>
    <publisher>Popular Chemistry</publisher>
    <journalTitle>Botanical Magazine</journalTitle>
    <issn>17497221</issn>
    <publicationDate>2002-09-04</publicationDate>
    <volume>98</volume>
    <issue>2</issue>
    <startPage>1234</startPage>
    <endPage>1235</endPage>
    <doi>1234567</doi>
    <publisherRecordId>12345</publisherRecordId>
    <documentType>article</documentType>
    <title language="eng">Roses and Lilies</title>
    <title language="ger">Roses und Lilies</title>
    <authors>
      <author>
        <name>Fritz Haber </name>
        <email>fritz.haber@some.university.org</email>
        <affiliationId>1</affiliationId>
        <affiliationId>2</affiliationId>
        <affiliationId>3</affiliationId>
      </author>
    </authors>
    <affiliationsList>
      <affiliationName affiliationId="1">
        University of A     
      </affiliationName>
      <affiliationName affiliationId="2">
        Universitaty of B
      </affiliationName> 
      <affiliationName affiliationId="3">
        University of C
      </affiliationName>
    </affiliationsList>

    




 <= The language tag content must conform to the
    iso 639-2b standard.

 <= Here is the issn number of the journal in which
    the article has been published. If you have an eissn
    number instead then this line should be replaced by
    <eissn>17497221</eissn>. If you have both issn
    and eissn numbers then the eissn tag should occur
    after the issn tag. 



 <= If the title occurs in more than one language
    then you may list the titles here. The title tag
    has got the attribute language that must be set
    according to the ISO638.2 standard.



 <= Note that the affilitationId numbers denote the
    affilitations in the affiliationslist below. 

    <abstract language="eng">
      The catalytic formation of ammonia from hydrogen
      and atmospheric nitrogen under conditions of high
      temperature and high pressure.
    </abstract>
    <fullTextUrl format="pdf">
      http://www.science.org/articles/HaberBosch.pdf
    </fullTextUrl>
    <keywords language="eng">    
      <keyword>garden</keyword>
      <keyword>rose</keyword>
    </keywords>
  </record>

  <record>
   ...
  </record>
   ...

</records>

2
neda_barna
Re: change to xml
  • 2008/3/1 10:39

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


who can help me???????????????

3
neda_barna
Re: change to xml
  • 2008/3/2 11:45

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


please see this code why it is work but i use it to XOOPS it dosent work
it is into php
<?php
$connection 
mysql_connect("localhost""root""") or die("Could not connect.");
$table_name 'xoops_papers';
$db mysql_select_db("aero2008");
$query "select * from " $table_name;
$result mysql_query($query$connection) or die("Could not complete database query");
$num mysql_num_rows($result);

if (
$num != 0) {

 
$filefopen("results.xml""w");
 
 
$_xml ="<?xml version="1.0" encoding="UTF-8" ?>rn";

 
$_xml .="<site>rn";

 while (
$row mysql_fetch_array($result)) {
 
$ss=$row["sid"];

 if (
$row["sid"]) {

 
$_xml .="t<page title="" . $row["sid"] . "">rn";

 
$_xml .="tt<title>" $row["title"] . "</title>rn";
$_xml .="t</page>rn";
 } else {

 
$_xml .="t<page title="Nothing Returned">rn";
$_xml .="tt<title>none</title>rn";

 
$_xml .="t</page>rn";
 } }

 
$_xml .="</site>";

 
fwrite($file$_xml);

 
fclose($file);

 echo 
"XML has been written.  <a href="results.xml">View the XML.</a>";

 } else {

 echo 
"No Records found";

 }



?>



and it is into xoops
if ( is_http_var'sid' ) ) {
    
$sid get_http_var'sid' ) ;
    
$paper = new RefereePaper$sid );
}  



$title $paper->getVar'title' );
$filefopen("results.xml""w");

 
$_xml ="<?xml version="1.0" encoding="UTF-8" ?>rn";

 
$_xml .="<site>rn";



 if (
$sid) {

 
$_xml .="t<records="" . $sid . "">rn";

 
$_xml .="tt<title>" $title "</title>rn";
$_xml .="t</page>rn";
 } else {

 
$_xml .="t<records="Nothing Returned">rn";
$_xml .="tt<title>none</title>rn";

 
$_xml .="t</records>rn";
 } 

 
$_xml .="</site>";

 
fwrite($file$_xml);
echo 
$file;
 
fclose($file);


 echo 
"XML has been written.  <a href="results.xml">View the XML.</a>";

Login

Who's Online

172 user(s) are online (101 user(s) are browsing Support Forums)


Members: 0


Guests: 172


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits