[xsde-users] Potential Bug when Parsing xs:double?

Jonathan Haws Jonathan.Haws at sdl.usu.edu
Thu May 28 18:24:04 EDT 2015


Boris,

I don't know if this is a bug or if I am doing something wrong, but I 
have a very simple schema where I am trying to parse xs:double.

I am parsing the input character stream in pieces, meaning I am calling 
doc_p.parse() and setting the last boolean appropriately.  In nearly 
every case things work just fine.

However, when I am parsing a negative value and the last parse call 
ended with the '-' sign, the first digit of the number is lost.

I've attached a schema, XML, makefile, and test application that shows 
what I am talking about.  Just build and run ./driver instance1.xml 275 
and you'll see that the longitude value is incorrect.

Thoughts?  Is this a bug or am I doing something wrong?  My guess would 
be the latter...

Thanks!
Jon

PS - if some of the files don't make it through (there should be 4) let 
me know and I'll zip them up and send them directly.  Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: driver.cpp
Type: text/x-c++src
Size: 2037 bytes
Desc: driver.cpp
Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20150528/71a37691/driver.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: instance1.xml
Type: text/xml
Size: 332 bytes
Desc: instance1.xml
Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20150528/71a37691/instance1.bin
-------------- next part --------------
###############################################################################
#
# XML Makefile
#
# Author:	Jonathan R. Haws
# Date:		2012-05-23
#
###############################################################################

###############################################################################
# XSD/e Root Settings
# These must be first since they (can) overwrite variables I set here
###############################################################################

ifeq ($(XSDE_ROOT),)
	XSDE_ROOT := /usr/xsde
endif

root := $(XSDE_ROOT)
include $(root)/build/cxx/rules.make

###############################################################################
# Debug Settings
#
# Set DEBUG = y to enable debugging code
###############################################################################
DEBUG = y

ifeq ($(DEBUG),y)
	DFLAGS = -g -O0
else
	DFLAGS = -O2
endif

OBJECTS = test-pskel.o \
  				test-pimpl.o \
  				test.o \
  				driver.o
  				
TARGETS = driver

INC_PATHS = -I../ -I$(root)/libxsde
LIB_PATHS = -L. -L$(root)/libxsde/xsde

CPPFLAGS += -Wall $(DFLAGS) $(INC_PATHS)
LDFLAGS = $(LIB_PATHS) -lxsde

###############################################################################
# XSD/e Settings
###############################################################################
#EXTRA_CPPFLAGS := -I$(root)/libxsde

ifeq ($(XSDE_ENCODING),iso8859-1)
EXTRA_XSDFLAGS += --char-encoding iso8859-1
endif

ifeq ($(XSDE_LONGLONG),n)
EXTRA_XSDFLAGS += --no-long-long
endif

ifeq ($(XSDE_PARSER_VALIDATION),n)
EXTRA_XSDFLAGS += --suppress-parser-val
endif

ifeq ($(XSDE_SERIALIZER_VALIDATION),n)
EXTRA_XSDFLAGS += --suppress-serializer-val
endif

ifeq ($(XSDE_REUSE_STYLE),mixin)
EXTRA_XSDFLAGS += --reuse-style-mixin
endif

ifeq ($(XSDE_POLYMORPHIC),y)
EXTRA_XSDFLAGS += --runtime-polymorphic
endif

GENERATED_SRC = test-pskel.hxx \
  							test-pimpl.hxx \
  							test.hxx

###############################################################################
# Targets
###############################################################################
all: $(OBJECTS) $(TARGETS)
	@echo " -> Finished compiling!"

driver: $(root)/libxsde/xsde/libxsde.a driver.cpp
	$(CXX) -o driver $(OBJECTS) $(CPPFLAGS) $(LDFLAGS)

test.o: test.cxx
test-pskel.o: test-pskel.cxx
test-pimpl.o: test-pimpl.cxx

# Mark the generated files as precious so that they do not get deleted on a
# failed build
.PRECIOUS: test.hxx test.cxx \
	test-pskel.hxx test-pskel.cxx \
	test-pimpl.hxx test-pimpl.cxx \

test.hxx test.cxx \
test-pskel.hxx test-pskel.cxx \
test-pimpl.hxx test-pimpl.cxx: test.xsd
	xsde cxx-hybrid $(XSDFLAGS) $(EXTRA_XSDFLAGS) \
	--generate-parser --generate-aggregate --root-element rootelement $<

.PHONY: gen
gen: test.xsd $(GENERATED_SRC)

.PHONY: clean
clean:
	rm -f driver *.exe *.o *.cxx *.hxx *.ixx *.a testapp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.xsd
Type: application/xml
Size: 633 bytes
Desc: test.xsd
Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20150528/71a37691/test.xml


More information about the xsde-users mailing list