WOXMLCoder XML tag output ordering issue
WOXMLCoder XML tag output ordering issue
- Subject: WOXMLCoder XML tag output ordering issue
- From: Deirdre Saoirse Moen <email@hidden>
- Date: Sun, 1 May 2005 17:47:07 -0700
Given the following mapping file:
<model>
<entity name="Guests" xmlTag="Guest">
<property name="guestName" xmlTag="GuestName"/>
<property name="bio" xmlTag="HGuestBiography"/>
<property name="panels" xmlTag="Panel"/>
</entity>
<entity name="Panels" xmlTag="Panel">
<property name="toTimeSlots.timeSlotStartDateAM" xmlTag="Time"/>
<property name="panelTitle" xmlTag="PanelTitle"/>
<property name="roomList" xmlTag="Room"/>
</entity>
</model>
I'm getting the following output (the beginning and end items are added
in the function below):
<?xml version="1.0" encoding="ISO-8859-1"?><Biographies><Guest>
<Biography>A Guest Biography</Biography>
<GuestName>A Guest Name</GuestName>
<Panel>
<Time>Friday 08:00 pm</Time>
<Room>Pine/Fir/Oak</Room>
<PanelTitle>Meet the Guests</PanelTitle>
</Panel>
<Panel>
<Time>Saturday 11:30 am</Time>
<Room>San Jose</Room>
<PanelTitle>A fun event</PanelTitle>
</Panel>
</Guest>
</Biographies>
So, basically, the order I specified in the mapping file is:
A
B
C
1
2
3
...and what I got was:
B
A
C
1
3
2
...the 1-3-2 I can live with, but this XML is going into Adobe
inDesign, which respects the tag order. It's not a simple task to
re-order the fields in post-processing. Clearly, it makes no sense to
list a guest's biography BEFORE their name.
Google searches didn't seem to turn up anything helpful. Reordering the
fields in the mapping file produces the exact same result.
Does anyone have any constructive suggestions on what I can do to get
the items in the correct order?
public WOComponent printBiographies() {
String path = "/Volumes/Users/deirdre/Desktop/";
String bioMapping =
application().resourceManager().pathForResourceNamed("mBios.xml", null,
null);
BufferedWriter f = null;
// sorting
String xmlString;
int countp = guestList.count();
int i;
System.err.println("Number of topics = " + countp);
try {
f = new BufferedWriter(new FileWriter(path + "Biographies.xml"));
f.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
f.write("<Biographies>");
for (i=0; i< countp; i++)
{
guestItem = (Guests)guestList.objectAtIndex(i);
if (guestItem != null)
{
System.err.println("Guest name = " + guestItem.guestName());
xmlString =
WOXMLCoder.coderWithMapping(bioMapping).encodeRootObjectForKey(guestItem
, guestItem.getClass().getName());
/* Write the XML document out to disk. */
f.write(xmlString);
}
}
f.write("</Biographies>");
f.close();
}
catch (Exception e) {
System.err.println(e.getMessage());
}
return null;
}
--
_Deirdre http://deirdre.net
"Ideally pacing should look like the stock market for the year 1999, up
and up and up, but with lots of little dips downwards...."
-- Wen Spencer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden