lappend auto_path /home/daniel/thesis/comanche-1.0/xuibuilder
package require dom
source  /home/daniel/thesis/comanche-1.0/xuibuilder/ddom.tcl


proc processElement {node mesg} {

# Do not touch labels (may be specific)
# Problem. What happens is label is a reserved word?
# Habra que redefinirla y asignarle un valor, que no debera de ser traducido
catch {
if [llength [dom::getAttribute $node label]] {
    switch [dom::getTagName $node] {
    label { } 
    default {
    puts $mesg [list apache1.3_[dom::getAttribute $node name] \
        [dom::getAttribute $node label]]
    dom::setAttribute $node \
         label apache1.3_[dom::getAttribute $node name]
	}
	}
}
if [llength [dom::getAttribute $node value]] {
   switch [dom::getTagName $node] {
    option {
    puts $mesg [list apache1.3_[dom::getAttribute $node name] \
        [dom::getAttribute $node value]]
    dom::setAttribute $node \
         value apache1.3_[dom::getAttribute $node name]
	
    }
    }
}

}
foreach child [dom::getElements $node] {
    processElement $child $mesg
}

}

foreach module [glob *] {
   catch {
   set mesg [open [file join $module mesg.out] w+]
   set f [open [file join $module directives.xml]]
   set xmlDoc [dom::DOMImplementation parse [read $f]]
   processElement $xmlDoc $mesg
   close $f
   set f2 [open [file join $module directives.xml.new] w+]
   puts $f2 [dom::DOMImplementation serialize $xmlDoc]
   close $f2   
   set f [open [file join $module propertyPages.xml]]
   set xmlDoc [dom::DOMImplementation parse [read $f]]
   processElement $xmlDoc $mesg
   close $f
   set f2 [open [file join $module propertyPages.xml.new] w+]
   puts $f2 [dom::DOMImplementation serialize $xmlDoc]
   close $f2   

   close $mesg

   } ll
   #puts $ll
}

