Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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"?>
            <description>Broke during STPS operation</description>

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"?>
        <hardware-item make="Apex" model="60" type="Other" description="Broke during STPS operation"/>

Does Sapphire have provisions for this? Thanks much!
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: 119
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: Sat Jan 28 06:45:55 GMT 2023

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

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

Back to the top