Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » XML Attributes instead of XML Elements?
XML Attributes instead of XML Elements? [message #901329] Fri, 10 August 2012 20:32 Go to next message
Balamurali Ananthan is currently offline Balamurali AnanthanFriend
Messages: 3
Registered: July 2012
Location: Longmont, CO
Junior Member
Pretty much all of the Sapphire examples shows how to create xml files with auxiliary information of an element as child elements. For example, Bug Database creates bugs.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<bug-database>
    <bug>
        :
        <hardware-item>
            <make>Apex</make>
            <model>60</model>
            <type>Other</type>
            <description>Broke during STPS operation</description>
        </hardware-item>
    </bug>
</bug-database>


Instead of make, model, type and description created as child elements of hardware-item, is it possible to create them as XML attributes like this one?

<?xml version="1.0" encoding="UTF-8"?>
<bug-database>
    <bug>
        :
        <hardware-item make="Apex" model="60" type="Other" description="Broke during STPS operation"/>
    </bug>
</bug-database>


Does Sapphire have provisions for this? Thanks much!
.Bala.
Re: XML Attributes instead of XML Elements? [message #901330 is a reply to message #901329] Fri, 10 August 2012 20:38 Go to previous message
Greg Amerson is currently offline Greg AmersonFriend
Messages: 116
Registered: March 2010
Senior Member
Sure things all you have to do is change the path property on the XmlBinding annotation in the for your model properties. So if you use something like this
@XmlBinding(path = "@make")

That will add that property as an attribute on the parent element.
Previous Topic:Announcing Sapphire 0.5.2 Release
Next Topic:Resource class not found while exporting plugin using ant
Goto Forum:
  


Current Time: Sun Nov 23 07:38:17 GMT 2014

Powered by FUDForum. Page generated in 0.02211 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software