Posts tagged ‘XML’

XML output from MsSQL Management Studio

DECLARE @xmloutput xml
SET @xmloutput = (
SELECT * FROM ....
FOR XML AUTO [,TYPE,XMLSCHEMA,ELEMENTS XSINIL]
)
SELECT @xmloutput
  • Facebook
  • Twitter
  • Digg
  • del.icio.us
  • LinkedIn
  • RSS
  • StumbleUpon
  • Google Bookmarks
  • Yahoo! Buzz
  • email
  • MySpace
  • PDF
  • Print
  • Reddit
  • Tumblr

Ugly way to export contacts from Hotmail to Mdaemon

Very ugly way for exportation of contacts from Hotmail to Mdaemon, it will only export email addresses not the names respectively.

After you’ve exported your contacts from Hotmail and got your .CSV, run it through this to get the email addresses:

cat WLMContacts.txt |perl -ne 'print "$1\n" if m/\b([A-Z0-9]+@[A-Z\.\-0-9]+\.[A-Z]+)\b/i' >> contacts.txt

Afterwards, run this to change format to Mdaemons XML.

<?php
 
  function uuidgen($len) {
        $uuid = "";
        for($i = 0; $i < $len; $i++) {
                $uuid .= dechex(rand(0,15));
        }
        return $uuid;
  }
 
  $emails = file("contacts.txt");
  foreach($emails as $email) {
 
?>
      <contact>
      <guid><![CDATA[<?=uuidgen(32)?>]]></guid>
      <modified<![CDATA[2010-01-01 00:00:00]]></modified>
      <fullName><![CDATA[<?=trim($email)?>]]></fullName>
      <email><![CDATA[<?=trim($email)?>]]></email>
      </contact>
 
<?php
 
}
 
?>

Don’t forget to add the remaining tags

Current starttag:

<?xml version="1.0"?>
<addressBook version="9.5.4" encoding="utf-8">

Current endtag:

</addressBook>

Name the file AddrBook.mrk and put inside users contact folder.

  • Facebook
  • Twitter
  • Digg
  • del.icio.us
  • LinkedIn
  • RSS
  • StumbleUpon
  • Google Bookmarks
  • Yahoo! Buzz
  • email
  • MySpace
  • PDF
  • Print
  • Reddit
  • Tumblr