XML/DOM serialization: Difference between revisions

From Rosetta Code
< XML
Content added Content deleted
(Undo revision 5220 by Special:Contributions/82.228.8.158 (User talk:82.228.8.158) - linkspam)
No edit summary
Line 1: Line 1:
[http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=267 free motorola ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/JustinJonson/kuluc.htm buy zanaflex] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/JustinJonson/gekiw.htm cheap flexeril] [http://www.hollins.edu/ubb/Forum32/HTML/000369.html free samsung ringtones] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=259 free nokia ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=22 cheap diazepam] [http://www.hollins.edu/ubb/Forum32/HTML/000376.html sonyericsson ringtones] [http://ist.greenville.edu/drupal/files/devowy.html lorazepam online] [http://ist.greenville.edu/drupal/files/role.html free real ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000351.html cheap rivotril] [http://www.hollins.edu/ubb/Forum32/HTML/000312.html buy ambien] [http://www.hollins.edu/ubb/Forum32/HTML/000337.html albuterol online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49018 buy cialis] [http://dcc.syr.edu/dforum/message.asp?MessageID=49035 buy ambien] [http://bugzilla.internet2.edu/attachment.cgi?id=746 sagem ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49025 cheap norco] [http://ist.greenville.edu/drupal/files/puweso.html meridia online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/RobertSmith/cibedis.htm cheap nexium] [http://ccfl.unl.edu/twiki/pub/Main/PaulinePauline/zivy.htm free mono ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000352.html cheap hgh] [http://bugzilla.internet2.edu/attachment.cgi?id=754 cheap ultram] [http://ist.greenville.edu/drupal/files/ruwyze.html cheap ativan] [http://ccfl.unl.edu/twiki/pub/Main/AlexCarneyham/linefej.htm buy wellbutrin] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/rofev.htm free ringtones] [http://ist.greenville.edu/drupal/files/pobiwi.html diazepam online] [http://bugzilla.internet2.edu/attachment.cgi?id=751 sprint ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000345.html buy lortab] [http://grid.unimelb.edu.au/twiki/pub/Main/JamesMiller/bopogo.htm carisoprodol online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49071 free verizon ringtones] [http://ccfl.unl.edu/twiki/pub/Main/HermanHogg/relu.htm buy clomid] [http://ccfl.unl.edu/twiki/pub/Main/AlexCarneyham/sifus.htm cheap xenical] [http://bugzilla.internet2.edu/attachment.cgi?id=759 xanax online] [http://www.hollins.edu/ubb/Forum32/HTML/000360.html free free ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=43 wellbutrin online] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=15 buy carisoprodol] [http://cyrusimap.web.cmu.edu/twiki/bin/view/Main/DikVolirev free tracfone ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/SherylDiu/popuxo.htm sharp ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000291.html buy ativan] [http://ist.greenville.edu/drupal/files/covubi.html buy norco] [http://ccfl.unl.edu/twiki/pub/Main/PaulinePauline/wetule.htm free sony ericsson ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000362.html free tracfone ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49075 sonyericsson ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=48901 cheap soma] [http://www.hollins.edu/ubb/Forum32/HTML/000293.html order meridia] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/JustinJonson/gelol.htm buy zyban] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/rigyse.htm online clonazepam] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/SelmaJeremy/kohe.htm free music ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/RobertSmith/pybex.htm cheap cyclobenzaprine] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/pero.htm ativan online] [http://ccfl.unl.edu/twiki/pub/Main/AlexCarneyham/huvixu.htm cheap paxil] [http://grid.unimelb.edu.au/twiki/pub/Main/JackLawson/nunuso.htm ativan online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49046 nexium] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/cohufyk.htm mp3 ringtones] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/vekorot.htm hgh online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/RobertSmith/kuky.htm buy propecia] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=268 free samsung ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BettySmith/kyzefe.htm ortho] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/wydyty.htm zyban] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/SherylDiu/gefu.htm free punk ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000340.html order lipitor] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/SherylDiu/ruviti.htm mtv ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000346.html cheap vigrx] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=41 lorazepam online] [http://cyrusimap.web.cmu.edu/twiki/bin/view/Main/RingoFloper fioricet online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/RobertSmith/tuju.htm order lorazepam] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/SherylDiu/sypev.htm cool ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=30 free qwest ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000289.html cheap diazepam] [http://ccfl.unl.edu/twiki/pub/Main/HermanHogg/kuhufid.htm tenuate online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49028 cheap clonazepam] [http://dcc.syr.edu/dforum/message.asp?MessageID=49015 fioricet online] [http://bugzilla.internet2.edu/attachment.cgi?id=725 ativan online] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=36 clonazepam online] [http://ccfl.unl.edu/twiki/pub/Main/HermanHogg/zivesup.htm propecia online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49061 free mp3 ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/RobertSmith/donyki.htm hydrocodone online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BilyKroft/hywi.htm cheap carisoprodol] [http://dcc.syr.edu/dforum/message.asp?MessageID=49051 didrex online] [http://www.hollins.edu/ubb/Forum32/HTML/000300.html levitra] [http://bugzilla.internet2.edu/attachment.cgi?id=738 free nextel ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000356.html cheap zyban] [http://bugzilla.internet2.edu/attachment.cgi?id=736 free mp3 ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=38 levitra] [http://www.hollins.edu/ubb/Forum32/HTML/000341.html buy celexa] [http://grid.unimelb.edu.au/twiki/pub/Main/NoriJohn/rupo.htm tracfone ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=27 adipex online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49056 free ringtones] [http://ccfl.unl.edu/twiki/pub/Main/PaulinePauline/wypo.htm music ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=29 free nextel ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49054 free nokia ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/putyh.htm cheap levitra] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/PhillipRewers/wozone.htm free ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49049 cheap propecia] [http://www.hollins.edu/ubb/Forum32/HTML/000320.html nexium online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BilyKroft/piwyh.htm cialis] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=250 buy soma] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=263 mp3 ringtones] [http://cyrusimap.web.cmu.edu/twiki/bin/view/Main/BillKukin cheap tramadol] [http://ist.greenville.edu/drupal/files/xuxuw.html cheap phentermine] [http://dcc.syr.edu/dforum/message.asp?MessageID=49059 free funny ringtones] [http://ccfl.unl.edu/twiki/pub/Main/AlexCarneyham/zupu.htm nexium online] [http://www.hollins.edu/ubb/Forum32/HTML/000316.html wellbutrin online] [http://ccfl.unl.edu/twiki/pub/Main/SummersFrank/runuz.htm adipex online] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=23 cheap cialis] [http://ist.greenville.edu/drupal/files/rire.html cheap ultram] [http://ccfl.unl.edu/twiki/pub/Main/PaulinePauline/hulupeg.htm free alltel ringtones] [http://grid.unimelb.edu.au/twiki/pub/Main/NoriJohn/nywytew.htm funny ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/PhillipRewers/cevo.htm funny ringtones] [http://ccfl.unl.edu/twiki/pub/Main/HermanHogg/nidexyk.htm celexa online] [http://ccfl.unl.edu/twiki/pub/Main/PaulinePauline/pelyvug.htm free real ringtones] [http://cyrusimap.web.cmu.edu/twiki/bin/view/Main/LeonPokert free free ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=33 samsung ringtones] [http://bugzilla.internet2.edu/attachment.cgi?id=757 cheap viagra] [http://grid.unimelb.edu.au/twiki/pub/Main/JamesMiller/pusug.htm cheap diazepam] [http://grid.unimelb.edu.au/twiki/pub/Main/JamesMiller/byvuf.htm cheap ultram] [http://bugzilla.internet2.edu/attachment.cgi?id=758 cheap vicodin] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=35 buy alprazolam] [http://ist.greenville.edu/drupal/files/tego.html cheap propecia] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=257 diazepam online] [http://www.hollins.edu/ubb/Forum32/HTML/000364.html free mp3 ringtones] [http://bugzilla.internet2.edu/attachment.cgi?id=733 meridia online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/xyvibi.htm meridia online] [http://www.hollins.edu/ubb/Forum32/HTML/000359.html free nokia ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/lyxex.htm buy adipex] [http://ist.greenville.edu/drupal/files/huduc.html cheap xenical] [http://ist.greenville.edu/drupal/files/nezy.html online hydrocodone] [http://ccfl.unl.edu/twiki/pub/Main/PaulinePauline/kyxud.htm cingular ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000375.html free sagem ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000286.html buy xanax] [http://www.hollins.edu/ubb/Forum32/HTML/000338.html cheap lisinopril] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/wybuk.htm free funny ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=48909 valium online] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=51 tracfone ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/PhillipRewers/gotu.htm free samsung ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49020 ativan online] [http://www.hollins.edu/ubb/Forum32/HTML/000386.html free kyocera ringtones] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=19 online xanax] [http://grid.unimelb.edu.au/twiki/pub/Main/NoriJohn/xehepoc.htm free mp3 ringtones] [http://ist.greenville.edu/drupal/files/gogo.html tramadol online] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=32 free motorola ringtones] [http://ist.greenville.edu/drupal/files/typutu.html free samsung ringtones] [http://grid.unimelb.edu.au/twiki/pub/Main/JackLawson/fuju.htm buy adipex] [http://dcc.syr.edu/dforum/message.asp?MessageID=49040 xenical online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/JustinJonson/vyxypu.htm cheap pharmacy online] [http://www.hollins.edu/ubb/Forum32/HTML/000367.html free real ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/tirev.htm cheap vicodin] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BilyKroft/gogy.htm ultram online] [http://ccfl.unl.edu/twiki/pub/Main/HermanHogg/woty.htm didrex online] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=16 valium] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=258 cialis online] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=252 cheap phentermine] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BettySmith/bogo.htm prozac online] [http://bugzilla.internet2.edu/attachment.cgi?id=728 free cingular ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000378.html free mono ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000297.html alprazolam online] [http://www.hollins.edu/ubb/Forum32/HTML/000355.html hoodia online] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BilyKroft/widokyj.htm cheap xanax] [http://www.hollins.edu/ubb/Forum32/HTML/000373.html free polyphonic ringtones] [http://ccfl.unl.edu/twiki/pub/Main/AlexCarneyham/jotu.htm lorazepam online] [http://www.hollins.edu/ubb/Forum32/HTML/000366.html free qwest ringtones] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/tytugok.htm diethylpropion online] [http://ist.greenville.edu/drupal/files/wywe.html cheap didrex] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/AshleighRodriquez/toro.htm but norco] [http://ist.greenville.edu/drupal/files/sodere.html cheap viagra] [http://dcc.syr.edu/dforum/message.asp?MessageID=49042 wellbutrin online] [http://www.hollins.edu/ubb/Forum32/HTML/000385.html free wwe ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BettySmith/pybido.htm cheap lisinopril] [http://bugzilla.internet2.edu/attachment.cgi?id=734 free mono ringtones] [http://grid.unimelb.edu.au/twiki/pub/Main/NoriJohn/woco.htm nokia ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000379.html free alltel ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49069 free music ringtones] [http://bugzilla.internet2.edu/attachment.cgi?id=745 free real ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BilyKroft/liko.htm cheap tramadol] [http://ist.greenville.edu/drupal/files/potyke.html ambien] [http://bugzilla.internet2.edu/attachment.cgi?id=739 nokia ringtones] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=265 qwest ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000287.html fioricet] [http://dcc.syr.edu/dforum/message.asp?MessageID=49038 lorazepam online] [http://cyrusimap.web.cmu.edu/twiki/bin/view/Main/AlexandrMumer cheap diazepam] [http://www.hollins.edu/ubb/Forum32/HTML/000381.html free cool ringtones] [http://ccfl.unl.edu/twiki/pub/Main/SummersFrank/xuropys.htm meridia online] [http://dcc.syr.edu/dforum/message.asp?MessageID=49062 free nextel ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000323.html propecia online] [http://ccfl.unl.edu/twiki/pub/Main/SummersFrank/wyfyzil.htm buy carisoprodol] [http://ist.greenville.edu/drupal/files/cykekud.html wellbutrin online] [http://ccfl.unl.edu/twiki/pub/Main/MarthaBell/xuvoz.htm free tracfone ringtones] [http://dcc.syr.edu/dforum/message.asp?MessageID=49068 sprint ringtones] [http://www.hollins.edu/ubb/Forum32/HTML/000372.html free verizon ringtones] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/BilyKroft/tibyx.htm cheap fioricet] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=48 didrex online] [http://ist.greenville.edu/drupal/files/lebu.html buy alprazolam] [http://ccfl.unl.edu/twiki/pub/Main/AlexCarneyham/sirid.htm cyclobenzaprine online] [http://devel.linux.duke.edu/bugzilla/attachment.cgi?id=264 free nextel ringtones] [http://cyrusimap.web.cmu.edu/twiki/bin/view/Main/TimLeen cheap carisoprodol] [http://wwwx.cs.unc.edu/~kmp/twiki40/pub/Main/PhillipRewers/gigyfy.htm free nextel ringtones] [http://ccfl.unl.edu/twiki/pub/Main/SummersFrank/tezowi.htm cheap ultram] [http://ccfl.unl.edu/twiki/pub/Main/SummersFrank/cytic.htm buy valium] [http://www.hollins.edu/ubb/Forum32/HTML/000387.html free sony ringtones] [http://ist.greenville.edu/drupal/files/kugidez.html cheap fioricet] [http://www.coe.unt.edu/chec/forum/forum_posts.asp?TID=45 cheap nexium] {{task}}
{{task}}


Create a simple DOM and having it serialize to:
Create a simple DOM and having it serialize to:

Revision as of 20:07, 4 May 2007

free motorola ringtones buy zanaflex cheap flexeril free samsung ringtones free nokia ringtones cheap diazepam sonyericsson ringtones lorazepam online free real ringtones cheap rivotril buy ambien albuterol online buy cialis buy ambien sagem ringtones cheap norco meridia online cheap nexium free mono ringtones cheap hgh cheap ultram cheap ativan buy wellbutrin free ringtones diazepam online sprint ringtones buy lortab carisoprodol online free verizon ringtones buy clomid cheap xenical xanax online free free ringtones wellbutrin online buy carisoprodol free tracfone ringtones sharp ringtones buy ativan buy norco free sony ericsson ringtones free tracfone ringtones sonyericsson ringtones cheap soma order meridia buy zyban online clonazepam free music ringtones cheap cyclobenzaprine ativan online cheap paxil ativan online nexium mp3 ringtones hgh online buy propecia free samsung ringtones ortho zyban free punk ringtones order lipitor mtv ringtones cheap vigrx lorazepam online fioricet online order lorazepam cool ringtones free qwest ringtones cheap diazepam tenuate online cheap clonazepam fioricet online ativan online clonazepam online propecia online free mp3 ringtones hydrocodone online cheap carisoprodol didrex online levitra free nextel ringtones cheap zyban free mp3 ringtones levitra buy celexa tracfone ringtones adipex online free ringtones music ringtones free nextel ringtones free nokia ringtones cheap levitra free ringtones cheap propecia nexium online cialis buy soma mp3 ringtones cheap tramadol cheap phentermine free funny ringtones nexium online wellbutrin online adipex online cheap cialis cheap ultram free alltel ringtones funny ringtones funny ringtones celexa online free real ringtones free free ringtones samsung ringtones cheap viagra cheap diazepam cheap ultram cheap vicodin buy alprazolam cheap propecia diazepam online free mp3 ringtones meridia online meridia online free nokia ringtones buy adipex cheap xenical online hydrocodone cingular ringtones free sagem ringtones buy xanax cheap lisinopril free funny ringtones valium online tracfone ringtones free samsung ringtones ativan online free kyocera ringtones online xanax free mp3 ringtones tramadol online free motorola ringtones free samsung ringtones buy adipex xenical online cheap pharmacy online free real ringtones cheap vicodin ultram online didrex online valium cialis online cheap phentermine prozac online free cingular ringtones free mono ringtones alprazolam online hoodia online cheap xanax free polyphonic ringtones lorazepam online free qwest ringtones diethylpropion online cheap didrex but norco cheap viagra wellbutrin online free wwe ringtones cheap lisinopril free mono ringtones nokia ringtones free alltel ringtones free music ringtones free real ringtones cheap tramadol ambien nokia ringtones qwest ringtones fioricet lorazepam online cheap diazepam free cool ringtones meridia online free nextel ringtones propecia online buy carisoprodol wellbutrin online free tracfone ringtones sprint ringtones free verizon ringtones cheap fioricet didrex online buy alprazolam cyclobenzaprine online free nextel ringtones cheap carisoprodol free nextel ringtones cheap ultram buy valium free sony ringtones cheap fioricet cheap nexium

Task
XML/DOM serialization
You are encouraged to solve this task according to the task description, using any language you may know.

Create a simple DOM and having it serialize to:

 <?xml version="1.0" ?>
 <root>
     <element>
         Some text here
     </element>
 </root>

JavaScript

Interpreter: Firefox 2.0

DOM

var doc = document.implementation.createDocument( null, 'root', null );
var root = doc.documentElement;
var element = doc.createElement( 'element' );
root.appendChild( element );
element.appendChild( document.createTextNode('Some text here') );
var xmlString = new XMLSerializer().serializeToString( doc );

E4X

 var xml = <root>
   <element>Some text here</element>
 </root>;
 var xmlString = xml.toXMLString();

E4X — with processing instruction

 XML.ignoreProcessingInstructions = false;
 var xml = <?xml version="1.0"?>  
 <root>
   <element>Some text here</element>
 </root>;
 var xmlString = xml.toXMLString();

PHP

Interpreter: PHP 5

 <?php
 $dom = new DOMDocument();//the constructor also takes the version and char-encoding as it's two respective parameters
 $dom->formatOutput = true;//format the outputted xml
 $root = $dom->createElement('root');
 $element = $dom->createElement('element');
 $element->appendChild($dom->createTextNode('Some text here'));
 $root->appendChild($element);
 $dom->appendChild($root);
 $xmlstring = $dom->saveXML();
 

Python

Interpreter: Python 2.5

 from xml.dom.minidom import getDOMImplementation
 
 dom = getDOMImplementation()
 document = dom.createDocument(None, "root", None)
 
 topElement = document.documentElement
 firstElement = document.createElement("element")
 topElement.appendChild(firstElement)
 textNode = document.createTextNode("Some text here")
 firstElement.appendChild(textNode)
 
 xmlString = document.toprettyxml(" " * 4)

Ruby

 require("rexml/document")
 include REXML
 (xml = Document.new) << XMLDecl.new
 root=xml.add_element('root')
 element=root.add_element('element')
 element.add_text('Some text here')
 puts xml.to_s(0)