/    Sign up×
Community /Pin to ProfileBookmark

xmlns and html tags

Greetings,

I’m currently developing an html application. part of this application involves parsing very large text files and producing formatted tables.

Parsing speed is becomng an issue, so now I’m looking for ways to reduce the amount of text being concatenated.

One of the major functions involve transforming each particular line as such:

Sample Line Before:

[CODE]XXX XXX ##### XX #### #### ##############XXX # XXX[/CODE]

After: (just 1 field shown as a sample)

[CODE]<tr><td oncontextmenu=’Lcon6(this)’><pre><a href=’#’ onclick=’STATDetail(Trim(this.innerText))’>XXX</a></pre></td></tr>[/CODE]

Its apparent that with larger and larger text files this function will get increasingly slow. Is there a way to reduce the output length without losing functionality? (besides changing the name of the functions to 1-2 digit names)
Perhaps xmlns is the answer? I haven’t used it enought to know its abilities in regards to something like this.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@TNOauthorOct 05.2006 — *bump*

I'll rephrase the question. Is it possible to have xmlns attach events to an HTML tag that already exists, vice defining a new one? (attach to <td> instead of <myelement:td>). if so, how would this be accomplished? A simple link to an xmlns guide would suffice (hopefully one with more than 2 sentences....).
Copy linkTweet thisAlerts:
@TNOauthorOct 05.2006 — Nevermind, I figured it out. Instead of programmatically adding "onclick='SomeFunction()'" or other events to all 30,000 <td> tags, I used this instead:

[CODE]function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}[/CODE]
Copy linkTweet thisAlerts:
@KorOct 05.2006 — I guess you might have used only the JSON statement. It is crossbrowser
<i>
</i>function addEvent(elm,evType,fn) {
elm['on' + evType] = function(){fn);
}


And I would have used the crossbrowser [B]Trim(this.firstChild.data)[/B] instead of Trim(this.innerText), which is IE only.
×

Success!

Help @TNO spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...