home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 December
/
PCWorld_2000-12_cd.bin
/
Komunikace
/
Comanche
/
libplugin
/
xmlPrinter.tcl
< prev
Wrap
Text File
|
2000-11-02
|
1KB
|
58 lines
# xmlPrinter.tcl --
#
# This class converts serializes xui objects into their XML representation
# Problem is that objects' properties are not implemented in a one to one
# straightforward mapping. Which can be done for things like strings, etc
# but not for lists, etc.
# Problem is that if our element is a derived class with an special attribute
# we have to modify the parser.
# (TO-DO: This is incomplete, it needs to be done with DOM calls if we want to
# do it properly)
class xmlPrinter {
# Are we printing the structure or the value
# Values: structure, value
public variable state
variale doc
method init { doc }
method enterState {state}
method visitorString { xuiObject }
method visitorNumber { xuiObject }
method visitorLabel { xuiObject }
method visitorStructure { xuiObject }
method visitorList { xuiObject }
public proc serializeStringValue
public proc serializeString
public proc serializeStructureValue
public proc serializeStructure
public proc serializeList
public proc serializeListValue
}
body xmlPrinter::visitorString {xuiObject} {
switch $state {
definition {
return [serializeString ]
} value {
set result ""
set name [$xuiObject getName]
append result "<$name>[serializeStringValue $xuObject]</$name>"
} onlyValue {
}
}
}
prox xmlPrinterserializeString