Information générale
Titre:
CursorToXML() / XMLToCursor() and schemas
When you use CursorToXML() to create XML with a schema, the double data type is mapped to "double" in the schema produced, but no decimal places are specified. When XMLToCursor() is used, the double field(s) are mapped to 8 decimal places, no matter how many it started out with. Having more precision than you asked for isn't normally a bad thing, but...
This is creating a problem for us when using TRANSFORM() on the resultant field. The result is #########.########
example:
CREATE CURSOR csrX (astring C(10), abignumber B(0))
INSERT INTO csrX VALUES ('stuff...', 5555555555555555)
CURSORTOXML('csrX','cXML',1,0,0,"1")
XMLTOCURSOR(cXML,'csrY')
?TRANSFORM(csrY.abignumber)
Is there any way to make the schema produced by CURSORTOXML() include the number of decimal places in the schema?
Of course, in this example, we could get around the issue because we know how many decimal places we started with, but this is part of a generic routine that doesn't have that information.
I suppose we could do:
IF VARTYPE(csrY.abignumber)='N'
?ALLTRIM(STR(csrY.abignumber,25,8))
ELSE
TRANSFORM(csrY.abignumber)
ENDIF
I'd much rather have the CURSORTOXML() not drop any of the structure info.
Thanks in advance,
Mike
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement