Re: [jibx-users] Q: Binding a matrix of primitive type ?
Hi Hervé, You should be able to do it as: collection name=matrix field=... collection name=row value name=cell/ /collection /collection I'm not sure I've ever tested multidimensional arrays, though, so let me know if this doesn't work properly. - Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 Hervé Bitteur wrote: Hello, Any hint from the JiBX gurus on how to bind a matrix of double? For example, how should I declare the mapping for this Java declaration: double[][] myMatrix; I would expect something like the following xml fragment for a matrix of 2 rows and 3 columns: matrix row cell1.23/cell cell0.25/cell cell99.2/cell /row row cell-0.3/cell cell5.56/cell cell0.01/cell /row /matrix Thanks for any hint /Hervé -- /Hervé callto://herve.bitteur callto://herve.bitteur --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
[jibx-users] Re: Jibx for J2ME
Hi, I never heard any comment on this issue?! I think that it is basically a good idea having jibx available for J2ME environments. This may especially become important for newer releases, as 1.5 features will prevent jibx from running on J2ME at all. Best, Lars Dirk Bade schrieb: Hej, we are currently working on porting an application to a runtime environment for mobile devices (IBM's J9). Our application uses JiBX for reading and writing XML-files. Since the J9 lacks some java-classes (as do all JREs for mobile devices, because of limited device-resources) it is not possible to use the JiBX-runtime on mobile devices. The only Problem is the usage of java.sql.Time, java.sql.Date and java.sql.Timestamp within the jibx.runtime.Utility-class. If you simply remove the imports of these packages within the class and change the methods for serialization and deserialization (using Object instead of java.sql.* in the method-signature) it works fine. And because java.sql.* is not included in the 'Personal Profile' for mobile devices you won't miss the methods anyway. Note: the binding-compiler does not like the changes in the method-signatures, so you have to use the original Utility-class for binding-compiling. Since JiBX is very fast and furthermore really small it fits perfectly for the use on mobile devices. Maybe it is possible to release a slightly modified version of the JiBX-runtime-jar especially for mobile devices either with the above mentioned changes or with some other kind of more generic workaround ? I could offer some help with modifying and testing if neccessary. Greetings, Dirk Bade --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] Marshaling problem
Hi Peter, The NullPointerException occurs when you're marshalling a structure that's missing an object required by your binding. It doesn't look like you're doing any initialization of your Customer instance in your code, so if there are any required fields in the binding you'll get the NullPointerException when JiBX tries to marshal one of these fields. See http://jibx.sourceforge.net/faq.html#npe - Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 Peter Solc wrote: I am new to the jibx and I am having problem to marshall object. I modified given example from jibx tutorial because all of them showed only how to marshall from object which uses input file in xml form. I am trying to create xml file from the object without any input file. I am creating instance of my object which I am trying to marshall to get xml. I am getting this error: check-runtime: run: [echo] Running the sample application... [java] Exception in thread main java.lang.NullPointerException [java] at org.jibx.starter.Customer.JiBX_starter_binding_marshal_1_0(Customer.java) [java] at org.jibx.starter.JiBX_starter_bindingCustomer_access.marshal() [java] at org.jibx.starter.Customer.marshal(Customer.java) [java] at org.jibx.runtime.impl.MarshallingContext.marshalRoot(Unknown Source) [java] at org.jibx.runtime.impl.MarshallingContext.marshalDocument(Unknown Source) [java] at org.jibx.starter.Test.main(Test.java:58) BUILD FAILED C:\local\jibx\starter\build.xml:125: Java returned: 1 The code is here: IBindingFactory bfact = BindingDirectory.getFactory(Customer.class); Customer customer = new Customer(); IMarshallingContext mctx = bfact.createMarshallingContext(); mctx.setIndent(2); FileWriter fileWriter = new FileWriter(output.xml, true); mctx.setOutput(fileWriter); mctx.marshalDocument(customer); It is creating error that marshalDocument has Unknown Source. I tried to create object before the IBindingFactory but that makes no difference. Any idea what is missing in my code? I am completely new to it. Thanks. Peter S. Get MSN Messenger with FREE Video Conversation - the next best thing to being there! http://g.msn.com/8HMBENUS/2746??PS=47575 --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] Bug in UTF8StreamWriter.writeTextContent(String text) ?
Hi Stefano, Your fix looks right to me. I'm trying to recreate the problem in a test case now (and having a hard time for some unknown reason). I'll verify and add the fix in the 1.1 code. The same code is used in all the stream writer variations, so the fix needs to apply to all as well. Thanks for finding this! - Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 Stefano Nichele wrote: Hi All, i think that i found a bug in UTF8StreamWriter.writeTextContent(String text). In this method the entity , are replaced by their escape sequence. Moreover if: else if (chr == '' i 2 text.charAt(i-1) == ']' text.charAt(i-2) == ']') { m_buffer[fill++] = (byte)']'; m_buffer[fill++] = (byte)']'; fill = writeEntity(GT_ENTITY, fill); } the is replaced with gt;. The code above means: if the current char is and the previous chars are ]] escape the . Well, i have a java class that contains a text with: this is my ![CDATA[text]] with some problem My expected xml is: Datathis is my ![CDATA[text]] with some problem/Data but the result is: Datathis is my lt;![CDATA[textgt; with some problem/Data So the ]] are now . I think this is caused because my text doesn't start with CDATA so it is handled as simple text. I fixed it removing: m_buffer[fill++] = (byte)']'; m_buffer[fill++] = (byte)']'; What do you thing about that ? Thanks a lot Stefano --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] Re: Jibx for J2ME
Whoops, sorry for missing this, Lars. I'd like to support this if it can be done easily. Please add it in Jira so I don't forget about the issue. I can use a source processing tool I've got available to switch the code between J2ME and regular versions, so if the only important differences really are the java.sql.* classes I should be able to handle it easily. - Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 Lars Braubach wrote: Hi, I never heard any comment on this issue?! I think that it is basically a good idea having jibx available for J2ME environments. This may especially become important for newer releases, as 1.5 features will prevent jibx from running on J2ME at all. Best, Lars Dirk Bade schrieb: Hej, we are currently working on porting an application to a runtime environment for mobile devices (IBM's J9). Our application uses JiBX for reading and writing XML-files. Since the J9 lacks some java-classes (as do all JREs for mobile devices, because of limited device-resources) it is not possible to use the JiBX-runtime on mobile devices. The only Problem is the usage of java.sql.Time, java.sql.Date and java.sql.Timestamp within the jibx.runtime.Utility-class. If you simply remove the imports of these packages within the class and change the methods for serialization and deserialization (using Object instead of java.sql.* in the method-signature) it works fine. And because java.sql.* is not included in the 'Personal Profile' for mobile devices you won't miss the methods anyway. Note: the binding-compiler does not like the changes in the method-signatures, so you have to use the original Utility-class for binding-compiling. Since JiBX is very fast and furthermore really small it fits perfectly for the use on mobile devices. Maybe it is possible to release a slightly modified version of the JiBX-runtime-jar especially for mobile devices either with the above mentioned changes or with some other kind of more generic workaround ? I could offer some help with modifying and testing if neccessary. Greetings, Dirk Bade --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] Marshaling problem
Thanks!!! This kept me all night up and with pre-get method I noticed that my person field inside the Customer class was null. Believe it or not I sort of overshadow person in my Customer constructor where I redefined Person again. Thanks again, Peter From:Dennis Sosnoski [EMAIL PROTECTED]Reply-To:jibx-users@lists.sourceforge.netTo:jibx-users@lists.sourceforge.netSubject:Re: [jibx-users] Marshaling problemDate:Wed, 10 May 2006 19:16:02 +1200MIME-Version:1.0Received:from lists-outbound.sourceforge.net ([66.35.250.225]) by bay0-mc12-f13.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 10 May 2006 00:17:00 -0700Received:from sc8-sf-list1-b.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7])by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTPid 35E161274D; Wed, 10 May 2006 00:17:00 -0700 (PDT)Received:from [10.3.1.93] (helo=sc8-sf-list1-new.sourceforge.net)by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30)id 1FdivY-0007rV-FUfor jibx-users@lists.sourceforge.net; Wed, 10 May 2006 00:16:08 -0700Received:from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net)by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43)id 1FdivX-0008Dx-Qzfor jibx-users@lists.sourceforge.net; Wed, 10 May 2006 00:16:07 -0700Received:from sosnoski.com ([206.123.75.163])by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256)(Exim 4.44)id 1FdivX-0007aF-APfor jibx-users@lists.sourceforge.net; Wed, 10 May 2006 00:16:07 -0700Received:from [192.168.0.2] (222-152-89-239.jetstream.xtra.co.nz [222.152.89.239])(authenticated bits=0)by sosnoski.com (8.12.10/8.12.10) with ESMTP id k4A7G38C032631for jibx-users@lists.sourceforge.net; Wed, 10 May 2006 03:16:05 -0400Hi Peter,The NullPointerException occurs when you're marshalling a structure that's missing an object required by your binding. It doesn't look like you're doing any initialization of your Customer instance in your code, so if there are any required fields in the binding you'll get the NullPointerException when JiBX tries to marshal one of these fields. See http://jibx.sourceforge.net/faq.html#npe- DennisDennis M. SosnoskiSOA, Web Services, and XMLTraining and Consultinghttp://www.sosnoski.com - http://www.sosnoski.co.nzSeattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117Peter Solc wrote:I am new to the jibx and I am having problem to marshall object. I modified given example from jibx tutorial because all of them showed only how to marshall from object which uses input file in xml form. I am trying to create xml file from the object without any input file. I am creating instance of my object which I am trying to marshall to get xml.I am getting this error:check-runtime:run:[echo] Running the sample application...[java] Exception in thread "main" java.lang.NullPointerException[java] at org.jibx.starter.Customer.JiBX_starter_binding_marshal_1_0(Customer.java)[java] at org.jibx.starter.JiBX_starter_bindingCustomer_access.marshal()[java] at org.jibx.starter.Customer.marshal(Customer.java)[java] at org.jibx.runtime.impl.MarshallingContext.marshalRoot(Unknown Source)[java] at org.jibx.runtime.impl.MarshallingContext.marshalDocument(Unknown Source)[java] at org.jibx.starter.Test.main(Test.java:58)BUILD FAILEDC:\local\jibx\starter\build.xml:125: Java returned: 1The code is here: IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);Customer customer = new Customer(); IMarshallingContext mctx = bfact.createMarshallingContext();mctx.setIndent(2); FileWriter fileWriter = new FileWriter("output.xml", true);mctx.setOutput(fileWriter);mctx.marshalDocument(customer);It is creating error that marshalDocument has Unknown Source. I tried to create object before the IBindingFactory but that makes no difference. Any idea what is missing in my code? I am completely new to it.Thanks.Peter S.Get MSN Messenger with FREE Video Conversation - the next best thing to being there! http://g.msn.com/8HMBENUS/2746??PS=47575 --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users---Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___jibx-users mailing
[jibx-users] Binding of String Array gives Error: Attributes not allowed as child components of collection; on value element...
Hi, Has anyone encountered an error trying to use a binding similar to the one below? collection field=datasinks value name=datasink type=java.lang.String/ /collection I've looked on the mailing list and I found multiple references that refers to this structure that will be able to create a data structure like someRootNode datasinksscott/datasink datasinkstiger/datasink /someRootNode However when I compile or try to create a schema I receive the Error: Attributes not allowed as child components of collection; on value element... Any help is appreciated! Tom --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
[jibx-users] Re: Q: Binding a matrix of primitive type ?
Dennis, I tried your definition, writing the following binding statements : binding mapping name="network" class="omr.math.NeuralNetwork" collection name="matrix" field="hiddenWeights" collection name="row" value name="cell"/ /collection /collection /mapping /binding JiBX compiler answered with : Error: References to collection items must use compatible types: double cannot be used as double[]; on collection element at (line 12, col 36, in double-binding.xml) Error running binding compiler The line referred to by the message is : collection name="row" And the java statement is : private double[][] hiddenWeights; Any idea ??? Thanks for your help -- /Herv
Re: [jibx-users] Re: Q: Binding a matrix of primitive type ?
Hi Hervé, Looks like the binding validation code is getting confused by the nested array references. If you add this in Jira I'll try to get it fixed for the next 1.1 beta release. In the meantime, you should be able to do an ugly workaround by adding load-method, size-method, and add-method methods in the class that contains this matrix. So something like double[] getWeightRow(int i), int weightRowCount(), void addWeightRow(double []). Then just specify the load-method/size-method/add-method for the outer collection element, rather than giving the field=hiddenWeights. You can keep the methods private to avoid polluting your api. - Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 Hervé Bitteur wrote: Dennis, I tried your definition, writing the following binding statements : binding mapping name=network class=omr.math.NeuralNetwork collection name=matrix field=hiddenWeights collection name=row value name=cell/ /collection /collection /mapping /binding JiBX compiler answered with : Error: References to collection items must use compatible types: double cannot be used as double[]; on collection element at (line 12, col 36, in double-binding.xml) Error running binding compiler The line referred to by the message is : collection name=row And the java statement is : private double[][] hiddenWeights; Any idea ??? Thanks for your help -- /Hervé callto://herve.bitteur callto://herve.bitteur --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
[jibx-users] Binding definition question - Ignoring unknown elements?
Is there a way in binding definition to tell JiBX to ignore any unknown elements from the input stream? Since we are consuming an external XML feed, we don't have much control when new elements are added by our partners. ThanksJames