tags:

views:

40

answers:

0

I'm using SSAX-SXML for working with a tree structure that just mimics the XML data encoding. So I thought of using the SXML representation directly as the data structure to work with. Everything works very well, and I get all the functionality of default accessors and XPath, which I found very useful.

But I have a problem. XML represents everything as strings, so I need to convert from string to numbers and viceversa, all the time. That will kill performance and just a bad design idea. I was thinking of taking the SXML list and transform all strings to numbers in one pass. But, is there a way that SXML directly does that or any way to tell via XML that something should be represented as a number, not a string?

This is my SXML list:

((wall (@ (uid "2387058723"))
   (pt (@ (y "2.0") (x "1.0")))
   (pt (@ (y "4.0") (x "3.0"))))
(wall (@ (uid "5493820876"))
   (pt (@ (y "0.0") (x "0.0")))
   (pt (@ (y "100.0") (x "0.0")))
   (window (@ (to "0.4") (from "0.2")))
   (window (@ (size "1.0") (from "0.2")))
   (door (@ (size "1.0") (from "0.2"))))
(pilar (@ (uid "692034802"))
    (center (@ (y "5.0") (x "5.0")))
    (dim (@ (b "0.45") (a "0.3"))))
(room (@ (label "salon"))
   (wall (@ (uid "2387058723")))
   (wall (@ (uid "5493820876")))
   (wall (@ (uid "5394501263")))
   (wall (@ (uid "0034923049"))))
(entry (@ (doorNumber "0")) (wall (@ (uid "5493820876"))))
(num "0,9")
(pipe (@ (y "8.0") (x "10.0"))))

From a XML that looks like this (extract):

        <wall uid="2387058723">
            <pt x="1.0" y="2.0"/>
            <pt x="3.0" y="4.0"/>
        </wall>

Thank you.