Here's my first-cut. It generates valid XML (from my player, anyway), as checked by

SP_CHARSET_FIXED=YES SP_ENCODING=XML nsgmls -wxml -mdeclaration/xml.soc -gues playlists.xml

I've simply overwritten the existing XMLExporter class; since we want to keep it alongside the new stuff, I'm assuming you're willing to move the code to the right place. The encode() method is unchanged, so it may be worth having an abstract base class containing it and declarations of the other methods.

In passing, I noticed that the code puts my owner name in the root element's attributes. I'm guessing that you wanted to have the player's name there, but I don't know how to retrieve that from the core of jEmplode.

The DTD is emitted inline to make it easier for people to use without needing to copy or reference any ancillary files. I've used a variant of my proposal (attribute values are content, not attributes), and I've corrected a syntax error and included declarations for the standard XML general entities (copied directly from the standard). Here's the DTD:


<!ELEMENT player (playlist|tune)* >
<!ATTLIST player
name CDATA #IMPLIED >

<!ELEMENT playlist (attribute*) >
<!ATTLIST playlist
id ID #REQUIRED
content IDREFS #IMPLIED >

<!ELEMENT tune (attribute*) >
<!ATTLIST tune
id ID #REQUIRED >

<!ELEMENT attribute (#PCDATA) >
<!ATTLIST attribute
name CDATA #REQUIRED >

<!ENTITY lt "&#38;#60;">
<!ENTITY gt "&#62;">
<!ENTITY amp "&#38;#38;">
<!ENTITY apos "&#39;">
<!ENTITY quot "&#34;">


Let's see if I can remember enough DSSSL to actually use this now!


Attachments
104308-XMLExporter.java (137 downloads)

_________________________
Toby Speight
030103016 (80GB Mk2a, blue)
030102806 (0GB Mk2a, blue)