ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google

Mail Archive Home | xmlc List | May 2000 Index

<--  Date Index  --> <--  Thread Index  -->

Rocks: Status on Rock


I just dived into Enhydra and XMLC and
my general impression is that XMLC and DOM-manipulations
is the way to go.
I'm facing the usual beginner's problems with manipulating
the DOM tree and would like to ask, what the current
status on tools for typical DOM-manipulations is.

I read the proposal about the XMLC metalanguage,
but currently there seems to be no proposals
for adding methods for common DOM operations.
(like adding rows or complex entries to a DOM tree)

For example, if I have something like this
<tr id="Row"><td><span id="Col1">Bla</span></table>

the current way to add new lines isn't too obvious
and gets quickly complicated if your table is going to be

TableHTML page = (TableHTML)getComms().xmlcFactory.create(TableHTML.class);

Element row = page.getElementRow();
Node parent = row.getParentNode();
for(bla;bla;bla) {
   page.setTextCol1("foo"); // note: you have to use page to address the 
element NOT row
   Node cloned = (Node)row.clone();

This is not very satisfying and things get really ugly,
if you need to create additional tags manually 
(for example, if your column count isnt fixed)

Instead, I'd like to mark the ID 'row' in the meta-description as of type 
'row' or something
and then can do something like this:

Element row = page.getElementRow();
for (bla;bla;bla) {
        row.setTextCol1("foo");  // note that the Col1 id is addressed 
relative to the row tag
        page.addElementRow(row); // add the row, reset values on row to 

Looks much simpler and you don't need to take care about deleting attributes 
cloning nodes or removing the 'prototype' row.

Using Richard Kunze's proposal for multiple ID's (hidden in new attributes), 
the often used
two row prototype (for example with a changing background color) for tables 
or lists
or whatever can be handled with the exactly same code, avoiding changes to 
the code
when the design changes this way.
(Let's just hope the web tool supports arbitrary attributes on tags)
Example: (using the attribute eid as identifier slot)
<tr eid="Row"><td><span eid="Col1">Bla</span>
<tr eid="Row"><td bgcolor="#FFFFFF"><span eid="Col2">Blub</span>

Again marking ID 'Row' as of type 'row' creates the code to add new rows
and takes care about using the right prototypical 'Row'.

I read the mail about adding similar behaviour with the use of helper classes,
but this doesn't seem to be very reasonable. It would boil down
to use the IDs as Strings in your java code in the worst case.
To model my proposal with helper classes, you'd probably have to do something 
like this:

Element row = page.getElementRow();
for (bla;bla;bla) {
        page.setTextCol1("foo"); // again the quite unobvious 'page' 
references this column
        TableHelper.addRow(row); // ok, no ID Strings involved, compile time 
safe (maybe)
TableHelper.remove(row); // not much gained after all


for (bla;bla;bla) {
        TableHelper.addRow(row, "col1", "foo"); // or use a hashtable for 
additional mappings   
        // not compile time safe and quite ugly

I'm aware of the complexities with tables, but simply adding rows is used so 
it should be available in an easy to use way.
(Ok, I'm a bit spoiled with Webmacro's foreach statement and missing this 
simple command
a lot :)

Any comments?

To unsubscribe from this mailing list, send email to majordomo@xxxxxxxxxxx
with the text "unsubscribe rocks-group" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-rocks-group@xxxxxxxxxxxx

<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.