[xsd-users] unsuccessful parse of Siri protocol on linux(x86) with
g++
Hooman Mirhadi
mirhadi at gmail.com
Mon Jul 28 02:20:03 EDT 2014
I used xsdSynthesis to compile the Siri protocol. The schema is
downloadable from:
http://user47094.vs.easily.co.uk/siri/schema/2.0/Siri_XML-v2.0.zip
I compiled the schema into an static library using this command:
*xsd cxx-tree --generate-serialization --type-naming ucc --function-naming
lcc --file-per-type --root-element-all --output-dir $(XSD_OUT) \*
*--generate-polymorphic \*
*--polymorphic-type ErrorCodeStructure \*
*--polymorphic-type AbstractRequestStructure \*
*--polymorphic-type AbstractServiceRequestStructure \*
*--polymorphic-type ResponseStructure \*
*--polymorphic-type AuthenticatedRequestStructure \*
*--polymorphic-type ProducerRequestEndpointStructure \*
*--polymorphic-type RequestStructure \*
*--polymorphic-type AbstractFunctionalServiceRequestStructure \*
*--polymorphic-type AbstractSubscriptionStructure \*
*--polymorphic-type AbstractServiceDeliveryStructure \*
*--polymorphic-type AbstractServiceCapabilitiesResponseStructure \*
*--polymorphic-type AbstractFeederItemStructure \*
*--polymorphic-type AbstractDiscoveryRequestStructure \*
*--polymorphic-type AbstractDiscoveryDeliveryStructure \*
*--namespace-map http://datex2.eu/schema/2_0RC1/2_0=datex2
<http://datex2.eu/schema/2_0RC1/2_0=datex2> \*
*../common/xsd/siri.xsd*
*g++ -W -Wall -O3 -c `ls $(XSD_OUT)/*.cxx`*
*ar rvs $(XSD_OUT)/libxsd.a `ls -1 $(XSD_OUT) | grep .cxx | sed
s/.cxx/.o/g`*
then I used a simple piece of code to test it.
*EH eh;*
*ostringstream os;*
*xml_schema::DateTime dt(2012,6,15,12,46,5,4,0);*
*siri::ParticipantRefStructure ref("305453");*
*ServiceRequest x(dt, ref);*
*serviceRequest((ostream &)os, x, eh);*
*DEBUG(1, "ServiceRequest made: \n%s\n", os.str().c_str());*
*istringstream is(os.str().c_str());*
*try*
*{*
*auto_ptr<ServiceRequest> sr ( serviceRequest(is, eh) );*
*}*
*catch(xsd::cxx::tree::parsing<char> err)*
*{*
*DEBUG(0, "exception(xsd::cxx::tree::parsing<char>):\n%s", err.what());*
*}*
The output:
*ServiceRequest made:*
*<?xml version="1.0" encoding="UTF-8" standalone="no" ?>*
*<p1:ServiceRequest xmlns:p1="http://www.siri.org.uk/siri
<http://www.siri.org.uk/siri>">*
* <p1:RequestTimestamp>2012-06-15T12:46:05+04:00</p1:RequestTimestamp>*
* <p1:RequestorRef>305453</p1:RequestorRef>*
*</p1:ServiceRequest>*
*exception: >< 2 59 >no declaration found for element 'p1:ServiceRequest'<*
*exception: >< 2 59 >attribute '{http://www.w3.org/2000/xmlns/}p1
<http://www.w3.org/2000/xmlns/}p1>' is not declared for element
'p1:ServiceRequest'<*
*exception: >< 4 24 >no declaration found for element
'p1:RequestTimestamp'<*
*exception: >< 6 20 >no declaration found for element 'p1:RequestorRef'<*
*exception(xsd::cxx::tree::parsing<char>):*
*instance document parsing failed*
I expected the code to parse whatever it has serialised itself. But
unfortunately it doesn't:(
Can you help me?
More information about the xsd-users
mailing list