More snippets from MarkupBuilder

With namespace:

newBldr := XMLBuilder new.
newBldr currentNsPrefix:  ‘myns’;  xmlPreprocessor;
xmlnsPrefix: ‘myns’ nsUrl: ‘http://www.w3.org/myns’;
xmlnsPrefix: ‘h’ nsUrl: ‘http://www.w3.org/html5’;
test: ”
with: [
newBldr copy attributes: #(‘a=”1″‘ ‘b=”2″‘);  currentNsPrefix: ‘h’;  trial;
attributes: #(‘a=”3″‘ ‘b=”4″‘);trial.
newBldr copy  currentNsPrefix: ‘myns’;  trial  ].

to emit: ‘<?xml version=”1.0″ ?><myns:test xmlns:myns=”http://www.w3.org/myns”  xmlns:h=”http://www.w3.org/html5&#8243; ><h:trial a=”1″  b=”2″ ></h:trial><h:trial a=”3″  b=”4″ ></h:trial><myns:trial></myns:trial></myns:test>’

the newBldr copy msg works like a charm…! to keep the same stream all the way through.. but reset the ns ( or anything else one chooses to..).

emit multiple script files:

html := HtmlBuilder new.
html html: ” with: [html head: ” with: [ html jsFileColl: #(‘test1.js’ ‘test2.js’)] . html  body: ” with: [ html h1: ‘text’ ] ] .

| html |
html := HtmlBuilder new.
html html: ” with: [ html linkCssFileColl: #(‘test1.css’ ‘test2.css’) . html  body: ” with: [ html h1: ‘text’ ] ].

now the next step is to integrate callback to anchor tags, buttons.. once that is done I guess this builder can be used with a httpserver to serve pages.. belted out fast n quick.. once extended with more components like the Table  viz: for a Form etc.. it would make it even more easier..

Pick the latest version: MarkupBuilder-Skrish.alpha.1.17.mcz and give it a try..

PS: I do find some issues with latest Pharo build.. 1.1.11409 or maybe bcos of Autotest being loaded.. gives arbitrary bugs in throwing up the debugger ..

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: