XML/DOM serialization: Difference between revisions
Content added Content deleted
(Undo revision 8141 by Special:Contributions/Cf2Nem (User talk:Cf2Nem)) |
mNo edit summary |
||
Line 1: | Line 1: | ||
[http://bestieditozzi.midways.cn/index.html bestie di tozzi] [http://snailtail.cn/xsat/index.html xsat] [http://bennybanasisatisfaction.fast-road.cn/index.html benny banasi satisfaction] [http://bolognaaccompagnatrici.kittiss.cn/index.html bologna accompagnatrici] [http://boysgayporn.romanikki.cn/index.html boys gay porn] [http://blacksabbat.romanikki.cn/index.html black sabbat] [http://bitchbrooks.midways.cn/index.html bitch brooks] [http://bennasibrosfeatdhanyhitmyheart.clung.cn/index.html bennasi bros feat dhany hit my heart] [http://bilalmidi.romanikki.cn/index.html bilal midi] [http://babyhmerenaseeb.romanikki.cn/index.html baby h mere naseeb] [http://bojate.romanikki.cn/index.html bojate] [http://wonted.cn/www-lagos-cd/index.html www lagos cd] [http://bibliotecanazionalediroma.fast-road.cn/index.html biblioteca nazionale di roma] [http://quoits.cn/anno-domini.html anno domini] [http://bloodpatche.fast-road.cn/index.html bloodpatche] [http://britishtvbeautygetsfiredfor3.fast-road.cn/index.html british tv beauty gets fired for 3] [http://bigbadlove.midways.cn/index.html big bad love] [http://snailtail.cn/www-ronaldo-it/index.html www ronaldo it] [http://bigbroders.fast-road.cn/index.html big broders] [http://knock-knock.cn/www-vivicorato/index.html www vivicorato it] [http://bicisportfirenze.midways.cn/index.html bici sport firenze] [http://burkhard.kittiss.cn/index.html burkhard] [http://kitmun.cn/yougame.html yougame] [http://snailtail.cn/www-plaiaton/index.html www plaiaton it] [http://bluice.kittiss.cn/index.html blu ice] [http://bia2com.fast-road.cn/index.html bia2 com] [http://bellasenzanima.fast-road.cn/index.html bella senz anima] [http://kitmun.cn/zip-da-corsa.html zip da corsa] [http://quoits.cn/zeta-reticuli.html zeta reticuli] [http://snailtail.cn/xxl-tv-hex/index.html xxl tv hex files] [http://wonted.cn/www-tg5it/index.html www tg5it] [http://quoits.cn/amanti-criminali.html amanti criminali] [http://wonted.cn/www-schicchi/index.html www schicchi] [http://barcheusatedavendere.kittiss.cn/index.html barche usate da vendere] [http://biagioantonaccimidi.fast-road.cn/index.html biagio antonacci midi] [http://backinthedayronankeating.fast-road.cn/index.html back in the day ronan keating] [http://quoits.cn/zoio-de.html zoio de lua] [http://brigittabulgarikocis.midways.cn/index.html brigitta bulgari kocis] [http://basilicatacampeggisulmare.fast-road.cn/index.html basilicata campeggi sul mare] [http://wonted.cn/www-porconi/index.html www porconi it] [http://blackgaysites.romanikki.cn/index.html blackgaysites] [http://biba.midways.cn/index.html biba] [http://snailtail.cn/xxx-orgasms/index.html xxx orgasms] [http://quoits.cn/zingaretti.html zingaretti] [http://kitmun.cn/you-needed.html you needed me] [http://knock-knock.cn/www-free/index.html www free tv it] [http://snailtail.cn/yerva-barva/index.html yerva barva] [http://snailtail.cn/www-i-d/index.html www i d i it] [http://kitmun.cn/you-re-so-vain.html you re so vain] [http://baciotracarolinaekatia.clung.cn/index.html bacio tra carolina e katia] [http://quoits.cn/attica.html attica] [http://snailtail.cn/y-all-want/index.html y all want a single] [http://wonted.cn/www-scopami/index.html www scopami com] [http://beachvolleybibione.kittiss.cn/index.html beach volley bibione] [http://bestofbowie.fast-road.cn/index.html best of bowie] [http://kitmun.cn/yer-cuntry.html yer cuntry] [http://beautifulsoundtrack.kittiss.cn/index.html beautiful soundtrack] [http://quoits.cn/zion-y-lennon.html zion y lennon baila conmigo] [http://wonted.cn/www-sessoit/index.html www sessoit] [http://knock-knock.cn/www-thesims/index.html www thesims com] [http://snailtail.cn/www-russian/index.html www russian model com] [http://knock-knock.cn/www-meduno/index.html www meduno it] [http://snailtail.cn/yammat-putujem/index.html yammat putujem] [http://quoits.cn/alambrado.html alambrado] [http://snailtail.cn/y-305-ld-305/index.html y 305 ld 305 z tilbe] [http://bossmagazine.kittiss.cn/index.html boss magazine] [http://breveamoremina.fast-road.cn/index.html breve amore mina] [http://quoits.cn/zoohaven.html zoohaven] [http://knock-knock.cn/www-casadei/index.html www casadei industria it] [http://knock-knock.cn/www-ty-com/index.html www ty com] [http://wonted.cn/www-latinchat/index.html www latinchat con pe] [http://wonted.cn/www-555-com/index.html www 555 com] [http://bandaaffori.clung.cn/index.html banda affori] [http://knock-knock.cn/www-luiss-it/index.html www luiss it] [http://benladen.clung.cn/index.html benladen] [http://beatricemozzi.midways.cn/index.html beatrice mozzi] [http://blutmussfliesen.midways.cn/index.html blut muss fliesen] [http://kitmun.cn/yuliya-mayarchuk.html yuliya mayarchuk] [http://brisahectorytito.kittiss.cn/index.html brisa hector y tito] [http://snailtail.cn/www-ilsognodigiada/index.html www ilsognodigiada com] [http://bmwsicilia.fast-road.cn/index.html bmw sicilia] [http://bnlcontocorrente.midways.cn/index.html bnl conto corrente] [http://bollettinoregionepiemonte.clung.cn/index.html bollettino regione piemonte] [http://beutiful.romanikki.cn/index.html beutiful] [http://knock-knock.cn/www-vegiemite/index.html www vegiemite com au] [http://wonted.cn/www-adipso-org/index.html www adipso org] [http://baldanbembolamicohe.kittiss.cn/index.html baldanbembo l amico he] [http://bluedanubio.fast-road.cn/index.html blue danubio] [http://berlinerzeitungaugust2004.fast-road.cn/index.html berliner zeitung august 2004] [http://knock-knock.cn/www-wind1055/index.html www wind1055] [http://barzellettegay.romanikki.cn/index.html barzellette gay] [http://benignicarra.fast-road.cn/index.html benigni carra] [http://snailtail.cn/www-genialloyd/index.html www genialloyd] [http://quoits.cn/zaino-scuola.html zaino scuola seven 2004] [http://kitmun.cn/your-bodys-a.html your bodys a wonderland] [http://knock-knock.cn/www-catasto/index.html www catasto it] [http://quoits.cn/arac-attack.html arac attack - mostri a otto zampe] [http://brugesturismo.clung.cn/index.html bruges turismo] [http://wonted.cn/www-trigliceridi/index.html www trigliceridi it] [http://bellasrtonza.fast-road.cn/index.html bella srtonza] [http://wonted.cn/wwew-ansa/index.html wwew ansa it] [http://boleroravel.fast-road.cn/index.html bolero ravel] [http://kitmun.cn/zelda.html zelda] [http://snailtail.cn/ya-rayah/index.html ya rayah] [http://wonted.cn/www-dollzmania/index.html www dollzmania com] [http://knock-knock.cn/www-reddito/index.html www reddito di cittadinanza it] [http://bluclubegitto.midways.cn/index.html blu club egitto] [http://knock-knock.cn/www-fattora/index.html www fattora] [http://snailtail.cn/yeti/index.html yeti] [http://quoits.cn/ad-ogni.html ad ogni costo] [http://bruscaglioneespaltro.kittiss.cn/index.html bruscaglione e spaltro] [http://snailtail.cn/xtv-key/index.html xtv key] [http://snailtail.cn/www-hochegger/index.html www hochegger] [http://wonted.cn/www-cinderella/index.html www cinderella boyx com] [http://knock-knock.cn/www-orologi/index.html www orologi omega com] [http://bigliettidavisitagratis.midways.cn/index.html bigliettidavisitagratis] [http://knock-knock.cn/winddows/index.html winddows xp informazioni] [http://knock-knock.cn/www-webcamporno/index.html www webcamporno it] [http://bigley.midways.cn/index.html bigley] [http://snailtail.cn/yaga-ny-mackie/index.html yaga ny mackie] [http://quoits.cn/artico-selvaggio.html artico selvaggio] [http://knock-knock.cn/www-giochionline/index.html www giochionline it] [http://quoits.cn/zordon.html zordon] [http://baglioniamorebello.kittiss.cn/index.html baglioni amore bello] [http://basimusicalianni60.kittiss.cn/index.html basi musicali anni 60] [http://bloodraynenude.fast-road.cn/index.html blood rayne nude] [http://kitmun.cn/yo-soy-una.html yo soy una mujre] [http://snailtail.cn/yackety-sax/index.html yackety sax] [http://kitmun.cn/zanrooz.html zanrooz] [http://ballanation.romanikki.cn/index.html balla nation] [http://snailtail.cn/yal-305-n/index.html yal 305 n] [http://knock-knock.cn/www-lavoro/index.html www lavoro it] [http://bpl.kittiss.cn/index.html bpl] [http://wonted.cn/wonderwall/index.html wonderwall i m just more] [http://bratheeasy.romanikki.cn/index.html brathe easy] [http://wonted.cn/www-ministero/index.html www ministero istruzione it] [http://wonted.cn/www-youpicklive/index.html www youpicklive com] [http://knock-knock.cn/www-paracucchilocanda/index.html www paracucchilocanda it] [http://quoits.cn/zip-genius.html zip genius] [http://quoits.cn/zdob-zdub.html zdob zdub] [http://wonted.cn/www-casalinghe/index.html www casalinghe porno com] [http://wonted.cn/www-newporktimes/index.html www newporktimes it] [http://bacolinet.fast-road.cn/index.html bacoli net] [http://bigleydecapitazione.kittiss.cn/index.html bigley decapitazione] [http://brena.midways.cn/index.html brena] [http://quoits.cn/zlatan.html zlatan] [http://baraccasound.clung.cn/index.html baracca sound] [http://wonted.cn/www-pattayalivecam/index.html www pattayalivecam com] [http://snailtail.cn/xuxa-fucking/index.html xuxa fucking with her driver] [http://wonted.cn/www-timtour/index.html www timtour net] {{task}} |
|||
{{task}} |
|||
Create a simple DOM and having it serialize to: |
Create a simple DOM and having it serialize to: |
||
Line 29: | Line 29: | ||
println(document.saveXML(root)) |
println(document.saveXML(root)) |
||
(On the use of <code> |
|||
(On the use of <code><unsafe></code>: The class has not yet been reviewed for E safety, so <code><import:...makeDocumentBuilderFactory></code> is not yet allowed. The review would probably be straightforward.) |
|||
==[[JavaScript]]== |
|||
[[Category: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(); |
|||
==[[Perl]]== |
|||
[[Category:Perl]] |
|||
use XML::DOM::BagOfTricks qw(createDocument createTextElement); |
|||
my ($doc, $root) = createDocument('root'); |
|||
$root->appendChild( |
|||
createTextElement($doc, 'element', 'Some text here') |
|||
); |
|||
print $doc->toString; |
|||
==[[PHP]]== |
|||
[[Category: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]]== |
|||
[[Category: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) |
|||
'''Interpreter:''' [[Python]] 2.5 |
|||
from xml.etree import ElementTree as et |
|||
root = et.Element("root") |
|||
et.SubElement(root, "element").text = "Some text here" |
|||
xmlString = et.tostring(root) |
|||
==[[Ruby]]== |
|||
[[Category: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) |