Example code demonstrating an extension built with the {@linkplain tv.amwa.maj.util.AutoGeneration auto generator}.
The input to the auto generator was the "SimpleExtension.xml
" file.
The "Main.java
" class produces the output in "MainOut.xml
". These are
both shown below:
Cut down Main.java
:
public static void main(String[] args) { EgFactory.initialize(); SimpleDescription description = EgFactory.make("SimpleDescription", "Title", "Test Description", "Identifier", "123/456/789/000", "DateAccepted", "2011-01-13", "Creator", EgFactory.make("Person", "Name", "Richard Rogers", "DOB", Forge.makeDate((byte) 11, (byte) 10, (short) 2003))); System.out.println(description.toString()); }
Running the above produces:
<?xml version="1.0" encoding="UTF-8"?> <eg:SimpleDescription xmlns:eg="http://amwa.tv/maj/extensions/example"> <eg:Identifier>123/456/789/000</eg:Identifier> <eg:Title>Test Description</eg:Title> <eg:Creator> <eg:Person> <eg:Name>Richard Rogers</eg:Name> <eg:DOB>2003-10-11+0000</eg:DOB> </eg:Person> </eg:Creator> <eg:DateAccepted>2011-01-13+0000</eg:DateAccepted> </eg:SimpleDescription>@see tv.amwa.maj.util.AutoGeneration