Tutorial Example Code

# Tutorial Example Code |

### Tutorial Example Code This area has the full code for the examples shown in the binding tutorial. The subdirectories correspond to the sequence of tutorial diagrams. The source code has been modified from the diagrams shown in the tutorial to use a separate package for each example, but should otherwise match what you see in the diagrams. Here's the list of code examples: A basic binding Attributes, optional access, and more Unordered elements Structure mapping - flattened binding Structure mapping - split binding Structure mapping - ignored components Basic collection handling Heterogeneous collection, with factory Collections with mappings Working with IDs Normal multiple mapping Normal multiple mapping Simple abstract mapping Named abstract mappings Abstract and extension mappings Extending a concrete mapping Namespaces User extension method hooks Custom value serialization Custom marshallers and unmarshallers Note that the test for this example may not operate properly on all JVMs because the order in which values are retrieved from a hashmap iterator is not consistent across JVMs. This is only a problem with the test, though, which looks for an exact round-tripping of the input document (including the order of child elements). If the test fails with an error message like "Different attributes - from line ... to line ..." it means that this issue occurs with the JVM you're using. Controlling JiBX with front-end code The Ant build.xml file in this directory gives targets for compiling and running each example. Most don't supply any interesting output (unless there's an error), but if you want to experiment with code based on a particular example (or try out variations of the sample XML documents) the build.xml should at least get you started. ### Disclaimer This code gives samples of working with JiBX data binding. It may be reused and redistributed without restriction, but is supplied subject to the following disclaimer. If you do not accept the terms of the disclaimer, do not use this code. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.