 | 
04-25-2011, 06:58 AM
| | Senior Member | | Join Date: Sep 2009
Posts: 130
| | XMLWriter: Simple JavaScript XML Creator XML - a type of data defining - becoming more popular at present because of its flexibility and convenience, data defined by XML become more visual and... detail at JavaScriptBank.com - 2.000+ free JavaScript codes How to setup Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript Code: <script type="text/javascript">
// Created by: Ariel Flesler | http://flesler.blogspot.com/2008/03/xmlwriter-for-javascript.html
// Licensed under: BSD License
// This script downloaded from www.JavaScriptBank.com
/**
* XMLWriter - XML generator for Javascript, based on .NET's XMLTextWriter.
* Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
* Date: 3/12/2008
* @version 1.0.0
* @author Ariel Flesler
* http://flesler.blogspot.com/2008/03/xmlwriter-for-javascript.html
*/
function XMLWriter( encoding, version ){
if( encoding )
this.encoding = encoding;
if( version )
this.version = version;
};
(function(){
XMLWriter.prototype = {
encoding:'ISO-8859-1',// what is the encoding
version:'1.0', //what xml version to use
formatting: 'indented', //how to format the output (indented/none) ?
indentChar:'\t', //char to use for indent
indentation: 1, //how many indentChar to add per level
newLine: '\n', //character to separate nodes when formatting
//start a new document, cleanup if we are reusing
writeStartDocument:function( standalone ){
this.close();//cleanup
this.stack = [ ];
this.standalone = standalone;
},
//get back to the root
writeEndDocument:function(){
this.active = this.root;
this.stack = [ ];
},
//set the text of the doctype
writeDocType:function( dt ){
this.doctype = dt;
},
//start a new node with this name, and an optional namespace
writeStartElement:function( name, ns ){
if( ns )//namespace
name = ns + ':' + name;
var node = { n:name, a:{ }, c: [ ] };//(n)ame, (a)ttributes, (c)hildren
if( this.active ){
this.active.c.push(node);
this.stack.push(this.active);
}else
this.root = node;
this.active = node;
},
//go up one node, if we are in the root, ignore it
writeEndElement:function(){
this.active = this.stack.pop() || this.root;
},
//add an attribute to the active node
writeAttributeString:function( name, value ){
if( this.active )
this.active.a[name] = value;
},
//add a text node to the active node
writeString:function( text ){
if( this.active )
this.active.c.push(text);
},
//shortcut, open an element, write the text and close
writeElementString:function( name, text, ns ){
this.writeStartElement( name, ns );
this.writeString( text );
this.writeEndElement();
},
//add a text node wrapped with CDATA
writeCDATA:function( text ){
this.writeString( '<![CDATA[' + text + ']]>' );
},
//add a text node wrapped in a comment
writeComment:function( text ){
this.writeString('<!-- ' + text + ' -->');
},
//generate the xml string, you can skip closing the last nodes
flush:function(){
if( this.stack && this.stack[0] )//ensure it's closed
this.writeEndDocument();
var
chr = '', indent = '', num = this.indentation,
formatting = this.formatting.toLowerCase() == 'indented',
buffer = '<?xml version="'+this.version+'" encoding="'+this.encoding+'"';
/*
* modded by Phong Thai @ JavaScriptBank.com
*/
buffer = buffer.replace( '?', '?' );
if( this.standalone !== undefined )
buffer += ' standalone="'+!!this.standalone+'"';
buffer += ' ?>';
buffer = [buffer];
if( this.doctype && this.root )
buffer.push('<!DOCTYPE '+ this.root.n + ' ' + this.doctype+'>');
if( formatting ){
while( num-- )
chr += this.indentChar;
}
if( this.root )//skip if no element was added
format( this.root, indent, chr, buffer );
return buffer.join( formatting ? this.newLine : '' );
},
//cleanup, don't use again without calling startDocument
close:function(){
if( this.root )
clean( this.root );
this.active = this.root = this.stack = null;
},
getDocument: window.ActiveXObject
? function(){ //MSIE
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = false;
doc.loadXML(this.flush());
return doc;
}
: function(){// Mozilla, Firefox, Opera, etc.
return (new DOMParser()).parseFromString(this.flush(),'text/xml');
}
};
//utility, you don't need it
function clean( node ){
var l = node.c.length;
while( l-- ){
if( typeof node.c[l] == 'object' )
clean( node.c[l] );
}
node.n = node.a = node.c = null;
};
//utility, you don't need it
function format( node, indent, chr, buffer ){
var
xml = indent + '<' + node.n,
nc = node.c.length,
attr, child, i = 0;
for( attr in node.a )
xml += ' ' + attr + '="' + node.a[attr] + '"';
xml += nc ? '>' : ' />';
buffer.push( xml );
if( nc ){
do{
child = node.c[i++];
if( typeof child == 'string' ){
if( nc == 1 )//single text node
return buffer.push( buffer.pop() + child + '</'+node.n+'>' );
else //regular text node
buffer.push( indent+chr+child );
}else if( typeof child == 'object' ) //element node
format(child, indent+chr, chr, buffer);
}while( i < nc );
buffer.push( indent + '</'+node.n+'>' );
}
};
})();
</script> Step 2: Place HTML below in your BODY section
HTML Code: <script type="text/javascript">
var xw = new XMLWriter('UTF-8');
xw.formatting = 'indented';//add indentation and newlines
xw.indentChar = ' ';//indent with spaces
xw.indentation = 2;//add 2 spaces per level
xw.writeStartDocument( );
xw.writeDocType('"items.dtd"');
xw.writeStartElement( 'items' );
xw.writeComment('button');
xw.writeStartElement('item');
xw.writeAttributeString( 'id', 'item-1');
xw.writeAttributeString( 'enabled', 'true' );
xw.writeStartElement( 'code');
xw.writeCDATA( '<button>Save</button>' );
xw.writeEndElement();
xw.writeElementString('description', 'a save button');
xw.writeEndElement();
xw.writeComment('image');
xw.writeStartElement('item');
xw.writeAttributeString( 'id', 'item-2');
xw.writeAttributeString( 'enabled', 'false' );
xw.writeStartElement( 'code');
xw.writeCDATA( '<img src="photo.gif" alt="me" />' );
xw.writeEndElement();
xw.writeElementString('description', 'a pic of myself!');
xw.writeEndElement();
xw.writeComment('link');
xw.writeStartElement('item');
xw.writeAttributeString( 'id', 'item-3');
xw.writeAttributeString( 'enabled', 'true' );
xw.writeStartElement( 'code');
xw.writeCDATA( '<a href="http://google.com">Google</a>' );
xw.writeEndElement();
xw.writeElementString('description', 'a link to Google');
xw.writeEndElement();
xw.writeEndElement();
xw.writeEndDocument();
var xml = xw.flush(); //generate the xml string
xw.close();//clean the writer
xw = undefined;//don't let visitors use it, it's closed
//set the xml
document.getElementById('parsed-xml').value = xml;
</script> |  Sponsored Ads | | Member | | Join Date: LongTime Posts: 1100 | | New Sponsored Ads This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today! | 
05-30-2011, 09:53 AM
| | Member | | Join Date: Sep 2010
Posts: 64
| | Better yet we have made this money making forex robot with complete newbies in mind. That means that as an affiliate you don't even have to know what forex is to make money from this launch - you can send leads from whatever your niche is - they all convert!
---------- criminal lawyer toronto | 
07-18-2011, 06:08 AM
| | Junior Member | | Join Date: Jul 2011
Posts: 5
| | Better yet we have made this money making forex robot with complete newbies in mind. | 
12-27-2011, 07:21 AM
| | Senior Member | | Join Date: Dec 2011 Location: USA
Posts: 202
| | How To Authorize Love A well-behaved superintend in favour of staying together is to dwell a fulfilling human being as an unitary and to support your colleague in doing the same. A alliance based on equality and feature is the perfect milieu after appreciate, romance and spontaneity to furbelow, while a kin based on neediness and dependence creates an air of precluding, hate and defensiveness. It is the discrepancy between expressing authentic out of and living an false impression of love, between creating a mod sustenance away continuing to develop your ability to fondle and recreating an superannuated subsistence by reliving past hurts, between accepting warmth and acting cold... and from time to time regular between summer weddings and winter divorces.
--------------------------------- gucci bags moncler outlet coach uk moncler uk | 
12-27-2011, 07:24 AM
| | Senior Member | | Join Date: Dec 2011 Location: USA
Posts: 202
| | How To Authorize Lover A well-behaved direction for staying together is to remain a fulfilling life as an sole and to assistance your partner in doing the same. A union based on likeness and esteem is the whole conditions for appreciate, story and spontaneity to furbelow, while a link based on neediness and dependence creates an atmosphere of terminating, hate and defensiveness. It is the balance between expressing genuine love and living an illusion of out of, between creating a mod ‚lan vital by continuing to evolve your ability to love and recreating an old subsistence by reliving quondam hurts, between accepting tenderness and acting cold... and now even between summer weddings and winter divorces.
--------------------------------- gucci uk moncler outlet coach uk moncler uk | 
12-27-2011, 08:40 AM
| | Senior Member | | Join Date: Dec 2011 Location: USA
Posts: 202
| | How To Fantasize Disposition A well-behaved superintend for staying together is to dwell a fulfilling human being as an unitary and to support your partner in doing the same. A union based on equality and feature is the blameless environment after appreciate, romance and spontaneity to furbelow, while a link based on neediness and dependence creates an feel of suppression, enmity and defensiveness. It is the balance between expressing bona fide relish and living an vision of love, between creating a new ‚lan vital during continuing to develop your aptitude to fondle and recreating an hoary life close reliving ago hurts, between accepting zeal and acting cold... and from time to time composed between summer weddings and winter divorces.
--------------------------------- moncler jackets moncler jackets moncler uk moncler jackets | 
02-27-2012, 01:34 PM
| | Junior Member | | Join Date: Aug 2011
Posts: 7
| | All the issues you described in publish is too amazing and can be very useful. I will keep it in ideas, thanks for providing details keep changing, vitalized for more articles. Thanks. |  Sponsored Ads | | Member | | Join Date: LongTime Posts: 1100 | | New Sponsored Ads This message will go away once you are registered. Also, by registering, you will have access to all post topics, communicate privately with other members (PM), respond to polls, upload graphics, and access other special features! Registration is fast, simple and absolutely free so please Click Here to join our Web Hosting community today! | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT. The time now is 06:29 PM. |  | |