Code Monkey home page Code Monkey logo

ivef-sdk's Introduction

ivef-sdk

Convert ivef.xsd to C++, JAVA and PHP code to easily read or write IVEF

Makes a parser for IVEF XML in a few steps.

  • Step 1: Make a schema to code executable. Needs Qt library
  • Step 2: The executable will generate classes for C++, JAVA or PHP based on a xsd. ivef.xsd is used per default, but the schema-to-code can be used for any xsd file.
  • Step 3: Build the parser library

Examples for how the library can be used to generate XML or read XML are available in the example directory.

Build: Use qmake and then make. Results (schema to code executable, libraries and examples) are in build directory.

ivef-sdk's People

Contributors

ajheres avatar danny-smit avatar icholy avatar jtjbrady avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ivef-sdk's Issues

Parser error

Parser expects prefix in data:

global replace @"IVEF by @"

Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 7:24

Fail to compile in XP with error in "livef"

What steps will reproduce the problem?
1. qmake
2. mingw32-make

What is the expected output? What do you see instead?
ld.exe: cannot find -livef
collect2: Id returned 1 exit status

What version of the product are you using? On what operating system?
Platform: Windows XP SP2
Software: QT SDK 2009.02 (same result with QT 4.5)

Please provide any additional information below.
This error exists when trying to compile examples "illisten". 
Please note that there is no errors in compiling QT tutorial samples and
"ivef-qt".

Thanks.

Original issue reported on code.google.com by [email protected] on 13 May 2009 at 9:34

code generator translates boolean attributes to yes/no i.o. true/false.

Concerns the xsd2code core generation tool.

The code generation tool creates a toXML method to produce XML. For an 
attribute of type xs:boolean it sets the value to "yes" or "no". 

However W3C specifies: An instance of a datatype that is defined as 
·boolean· can have the following legal literals {true, false, 1, 0}.



Original issue reported on code.google.com by [email protected] on 11 Mar 2010 at 10:59

code generator does not provide const-aware hasXYZ() functions.

Concerns the xsd2code code generator tool.

The tool provides member hasXYZ()-functions for classes, which are not const 
functions. This can be troublesome when developers are using the generated 
code with const objects.

Easy to fix by making the functions const, which does not effect the usage 
of the generated code.

Original issue reported on code.google.com by [email protected] on 25 Mar 2010 at 12:08

Several fields cannot be 0

SOG, Breadth and Length cannot be zero according to the schema, however such 
values can occur 
when using AIS

Original issue reported on code.google.com by [email protected] on 24 Feb 2010 at 1:59

Parser cannot handle multpile root elements

What steps will reproduce the problem?
1. Create a string that holds more than one message
2. give it to [parser parse:theString]
3. parser will exit after the first message

What is the expected output? What do you see instead?
- i would expect events for all messages

This went unnoticed since most TCP frames have only a single message or less

Original issue reported on code.google.com by [email protected] on 8 Sep 2009 at 8:13

Member variables not initialized

The generated c++ code contains classes whose member variables are not
initialized. If these member vaiables are not set by the application, the
XML result contains undefined values.


Original issue reported on code.google.com by [email protected] on 11 May 2009 at 7:43

give access to array components

a vesseldata has an array of static datas but access to it is hidden from
the implementor, it would lead to easier code if access was available:

for (staticData *data in [vesselData staticDatas]) .....

iso 

for (int i=0; i<[vesseldata numberOfstaticDatas];i++) {
   staticdata *data = [vesselData staticDataAtIndex:i];

Original issue reported on code.google.com by [email protected] on 20 Aug 2009 at 9:42

Objc parser still has \n in parse routines

should be: (also check Qt) 

 index[0] = [m_dataBuffer rangeOfString:@"</MSG_VesselData>" options: 
NSBackwardsSearch].location + strlen("</MSG_VesselData>");
     index[1] = [m_dataBuffer rangeOfString:@"</MSG_LoginRequest>" options: 
NSBackwardsSearch].location + strlen("</MSG_LoginRequest>");
     index[2] = [m_dataBuffer rangeOfString:@"</MSG_LoginResponse>" options: 
NSBackwardsSearch].location + strlen("</MSG_LoginResponse>");
     index[3] = [m_dataBuffer rangeOfString:@"</MSG_Ping>" options: 
NSBackwardsSearch].location + strlen("</MSG_Ping>");
     index[4] = [m_dataBuffer rangeOfString:@"</MSG_Pong>" options: 
NSBackwardsSearch].location + strlen("</MSG_Pong>");
     index[5] = [m_dataBuffer rangeOfString:@"</MSG_ServerStatus>" options: 
NSBackwardsSearch].location + strlen("</MSG_ServerStatus>");
     index[6] = [m_dataBuffer rangeOfString:@"</MSG_Logout>" options: 
NSBackwardsSearch].location + strlen("</MSG_Logout>");
     index[7] = [m_dataBuffer rangeOfString:@"</MSG_ServiceRequest>" options: 
NSBackwardsSearch].location + strlen("</MSG_ServiceRequest>");


Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 7:33

stringValue

currently we only have stringValueWithLead which is often called with @""

Original issue reported on code.google.com by [email protected] on 20 Aug 2009 at 9:45

NSParser..

setString does not exist for NSData, use setLength: 0 to reset the buffer

Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 8:12

No check of required attributes/elements

Generating XML output using the library, there are no functions to check if
all the required attributes/elements are filled. Currently it is possible
to output invalid XML.

Original issue reported on code.google.com by [email protected] on 11 May 2009 at 7:48

integers are printed as floats

e.g. in static data StringValue

-        [xml appendString: [NSString stringWithFormat:@"%d", m_objectType]];
+        [xml appendString: [NSString stringWithFormat:@"%f", m_objectType]];

Original issue reported on code.google.com by [email protected] on 20 Aug 2009 at 9:45

restructure code base

Currently the code is case sensitive. This causes problems on systems that
are actually case sensitive. Please make all code lower case.

Original issue reported on code.google.com by [email protected] on 16 Jul 2008 at 7:19

filter on attributes

It would be usefull to implement a filter on attributes. 

This could be done to implement a stack in IVEFHandler which pushes attributes 
(key/value) (like 
"PosReport.SOG = 12" on  a stack, then print the whole MSG_VesselData in the 
endElement call.

Before printing the report it should be evaluated if the attribute specified by 
--filterattribute is 
matched by --filtervalue

eg. ilisten --filterattribute=MMSI --filtervalue=0024* returns dutch vessels.

perhaps --filterequals --filterregexp --filtersmaller --filtergreater is 
better...

Original issue reported on code.google.com by [email protected] on 19 Jul 2008 at 7:43

No destructors for obj-C

--- IVEFStaticData.m    (revision 387)
+++ IVEFStaticData.m    (working copy)
@@ -25,84 +25,94 @@
         m_maxAirDraughtPresent = false;
         m_maxDraughtPresent = false;
         m_deepWaterVesselindPresent = false;
         m_dateFormatter = [[NSDateFormatter alloc] init];
         [m_dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
     }
     return self;
 }

+- (void)dealloc {
+   [m_id release];
+    [m_sourceName release];
+    [m_callsign release];
+    [m_shipName release];
+    [m_ATONName release];
+    [m_natLangShipName release];
+    [m_portOfRegistry release];
+    [m_countryFlag release];
+   [super dealloc];    
+}
+

Original issue reported on code.google.com by [email protected] on 20 Aug 2009 at 9:37

Parser errors are not made available to the end user

What steps will reproduce the problem?
1. introduce some illigal XML 
2. cat illigal.xml | testqt
3. no error is provided

What is the expected output? What do you see instead?
i would expect to see: illigal input statement via a signal so i can handle it 
in the client

Please use labels and text to provide additional information.


Original issue reported on code.google.com by [email protected] on 19 May 2009 at 8:54

Code review request

Purpose of code changes on this branch:

new version of the interface

When reviewing my code changes, please focus on:

- completeness
- documentation
- clarity
- bounding/limiting of ranges

After the review, I'll merge this branch into:
/trunk





Original issue reported on code.google.com by [email protected] on 27 Jan 2009 at 6:35

Invalid dates in Objc parser

                NSDateFormatter *inputFormatter = [[[NSDateFormatter alloc] init] autorelease]; // 
2008-11-16T20:59:25.003
                [inputFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
                NSDate *val = [inputFormatter dateFromString:value];
                //NSDate * val = [NSDate dateWithString: value]; // assume "yyyy-MM-ddThh:mm:ss.zzz"


Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 9:06

IVEF parser cores

in ivefparser.m init:

        m_dataBuffer = [[NSMutableString alloc] init];


Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 3:38

parser errors are passed as casted object

- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError {
    NSLog(@"ILParser.parseErrorOccured: %@", parseError);
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ILParserError" object: self 
userInfo:parseError];
}

should  be:

- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError {
    NSLog(@"ILParser.parseErrorOccured: %@", parseError);
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ILParserError" object: self 
userInfo:[NSDictionary dictionaryWithObject: parseError forKey: @"Error"]];
}

Original issue reported on code.google.com by [email protected] on 5 Jan 2010 at 9:14

Parser error

Objc parser checks on qualifiedname, but should be elementName

Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 7:37

SDK won't build on OS X (Obj-C)

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


Please use labels and text to provide additional information.


Original issue reported on code.google.com by [email protected] on 1 Sep 2009 at 7:22

Minimum and maximum values of attributes

c++ generation qt:

The xsd2code tool uses only the minimum and maximum value of an attribute
if both are defined.

The w3c xml schema specification allows only the minimum value or only the
maximum value.

Currently checks (derived from the minInclusive and maxInclusive) are added
to the c++ code if both are defined (schema).


Original issue reported on code.google.com by [email protected] on 9 Jun 2009 at 8:56

Addition of doxygen comments

It would be nice if the generated c++ header files contains docygen
comments. The annotations of the XML schema can be used.

Original issue reported on code.google.com by [email protected] on 11 May 2009 at 7:50

various parser issues

Index: IVEFParser.m
===================================================================
--- IVEFParser.m    (revision 387)
+++ IVEFParser.m    (working copy)
@@ -9,496 +9,539 @@
     if (self != nil) {
         m_dataBuffer = [[NSMutableString alloc] init];
         m_objStack = [[NSMutableArray alloc] init];
-        [self setDelegate: self]; // we are our own delegate
     }
     return self;
 }

+- (void)dealloc {
+    [super dealloc];
+   [m_dataBuffer release];
+   [m_objStack release];
+}
+


+   if (indexMax > 30) {
+       NSString *messages = [m_dataBuffer substringToIndex: indexMax];
+       [m_dataBuffer deleteCharactersInRange:NSMakeRange(0, indexMax)];
+       //NSLog(@"messages:\n %@", messages);
+       //NSLog(@"buffer:\n %@", m_dataBuffer);
+       
+       //[self initWithData: [messages
dataUsingEncoding:NSASCIIStringEncoding]]; // should probably not call init
more than once
+       //[self parse];
+       
+       
+       // create a seperate memory pool, so we can quickly deallocate temp
objects generated by the parser
+       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+           
+       NSXMLParser *tempParser = [[NSXMLParser alloc] initWithData:[messages
dataUsingEncoding:NSASCIIStringEncoding]];
+       //AQXMLParser *tempParser = [[AQXMLParser alloc] initWithData:[messages
dataUsingEncoding:NSASCIIStringEncoding]];
+       [tempParser setDelegate:self];
+       [tempParser parse];
+       [tempParser release];
+       //[messages release]; // is already autoreleased!!
+       
+       [pool release];
+       
+   } else {
+       return false; // not enough data in string
+   }
+   if (!cont) {
+       [m_dataBuffer setString: @""];
+   }
+   return true;
+}

Original issue reported on code.google.com by [email protected] on 20 Aug 2009 at 9:52

OBjc parser leaks memory


don't retain, they are already allocated once, release or auto release after 
the event

- (void)     parser:(NSXMLParser *)parser 
      didEndElement:(NSString *)qualifiedName
       namespaceURI:(NSString *)namespaceURI
      qualifiedName:(NSString *)qualifiedName2 {
    // check all possible options
    //NSLog(@"end %@", qualifiedName);
    if ([qualifiedName isEqualToString: @"Header"]) {

        IVEFHeader *obj = (IVEFHeader*) [m_objStack lastObject];
        //[obj retain];
        [m_objStack removeLastObject];
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_VesselData class]]) {
                [((IVEFMSG_VesselData*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_LoginRequest class]]) {
                [((IVEFMSG_LoginRequest*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_LoginResponse class]]) {
                [((IVEFMSG_LoginResponse*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_Ping class]]) {
                [((IVEFMSG_Ping*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_Pong class]]) {
                [((IVEFMSG_Pong*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_ServerStatus class]]) {
                [((IVEFMSG_ServerStatus*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_Logout class]]) {
                [((IVEFMSG_Logout*) [m_objStack lastObject] ) setHeader: obj ];
        }
        if ( [[m_objStack lastObject] isKindOfClass: [IVEFMSG_ServiceRequest class]]) {
                [((IVEFMSG_ServiceRequest*) [m_objStack lastObject] ) setHeader: obj ];
        }
        [obj release]; 
    }
    else if ([qualifiedName isEqualToString: @"MSG_VesselData"]) {

        IVEFMSG_VesselData *obj = (IVEFMSG_VesselData*) [m_objStack lastObject];
        //[obj retain];
        [m_objStack removeLastObject];
        //NSLog(@"sending");
        [[NSNotificationCenter defaultCenter] postNotificationName:@"NewIVEFMSG_VesselData" 
object: self userInfo:[NSDictionary dictionaryWithObject: obj forKey: 
@"Data"]]; 
        [obj release]; 
    }



Original issue reported on code.google.com by [email protected] on 14 Aug 2009 at 8:06

error sending login message

    [xml appendString: [NSString stringWithFormat:@"%d", m_encryption]];

probably all ints are sent as floats (%f)

Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 3:46

Possible leak on new message

- (void)     parser:(NSXMLParser *)parser 
    didStartElement:(NSString *)elementName
       namespaceURI:(NSString *)namespaceURI
      qualifiedName:(NSString *)qualifiedName
         attributes:(NSDictionary *)attributeDict {
    // check all possible options
    if ([elementName isEqualToString: @"MSG_LoginRequest"]) {
        ILMSG_LoginRequest *obj = [[ILMSG_LoginRequest alloc] init];
        [obj setAttributes: attributeDict];
        [m_objStack addObject: obj ];
    }

object is allocated but never released!

Original issue reported on code.google.com by [email protected] on 20 Aug 2009 at 12:49

ilisten parses xs:dateTime incorrect

the sdk requires miliseconds to be present, but according to:
http://www.w3.org/TR/xmlschema-2/#dateTime this is not required. The
documentation in the XSD does specify miliseconds, this should be updated
too. (esp. for ETA/ATA)

Original issue reported on code.google.com by [email protected] on 25 Feb 2009 at 1:37

xsd2code generates duplicate member functions.

Using the attached example XSD to generate (Qt) code, the code generation 
tool creates one "Body" class with multiple occurrences of the same method.

This result in conflicts during compilation:

Body.h:64: error: ‘void Body::addReferencedData(ReferencedData)’ cannot be 
overloaded
Body.h:51: error: with ‘void Body::addReferencedData(ReferencedData)’
Body.h:68: error: ‘ReferencedData Body::getReferencedDataAt(int) const’ 
cannot be overloaded
Body.h:55: error: with ‘ReferencedData Body::getReferencedDataAt(int) 
const’
Body.h:73: error: ‘int Body::countOfReferencedDatas() const’ cannot be 
overloaded
Body.h:60: error: with ‘int Body::countOfReferencedDatas() const’
Body.h:112: error: declaration of ‘QVector<ReferencedData> 
Body::m_referencedDatas’
Body.h:110: error: conflicts with previous declaration 
‘QVector<ReferencedData> Body::m_referencedDatas’
Body.h:113: error: declaration of ‘bool Body::m_referencedDataPresent’
Body.h:111: error: conflicts with previous declaration ‘bool 
Body::m_referencedDataPresent’
Body.cpp:68: error: redefinition of ‘void Body::addReferencedData
(ReferencedData)’
Body.cpp:50: error: ‘void Body::addReferencedData(ReferencedData)’ 
previously defined here
Body.cpp:74: error: redefinition of ‘ReferencedData 
Body::getReferencedDataAt(int) const’
Body.cpp:56: error: ‘ReferencedData Body::getReferencedDataAt(int) const’ 
previously defined here
Body.cpp:80: error: redefinition of ‘int Body::countOfReferencedDatas() 
const’
Body.cpp:62: error: ‘int Body::countOfReferencedDatas() const’ previously 
defined here

Original issue reported on code.google.com by [email protected] on 12 Mar 2010 at 4:31

Attachments:

Not enough comments in generated code

Only the Qt lib comes close to "well commented" code, the others do not.

this can be easily overcome by expanding the xsd2code tool with more comment 
output.


Original issue reported on code.google.com by [email protected] on 5 Jan 2010 at 10:24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.