1. Trang chủ
  2. » Công Nghệ Thông Tin

Java 2 Bible Enterprise Edition phần 5 docx

71 302 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 71
Dung lượng 164,71 KB

Nội dung

<head> <title> <xsl:value−of select="TITLE" /> </title> </head> <body> <h1> <xsl:value−of select="TITLE" /> </h1> <xsl:apply−templates select="ACT" /> </body> </html> </xsl:template> <xsl:template match="ACT"> <xsl:apply−templates /> </xsl:template> <xsl:template match="SCENE"> <xsl:apply−templates /> </xsl:template> <xsl:template match="SPEECH"> <br /> <xsl:apply−templates /> </xsl:template> <xsl:template match="SPEAKER"> <br /> <b> <xsl:apply−templates /> </b> </xsl:template> <xsl:template match="TITLE"> <br /> <h2> <xsl:apply−templates /> </h2> </xsl:template> <xsl:template match="STAGEDIR"> <br /> <em> <xsl:apply−templates /> </em> </xsl:template> <xsl:template match="LINE"> <br /> <xsl:apply−templates /> </xsl:template> </xsl:stylesheet> XLST transformations using JDOM So far you've used JAXP to transform rich_iii.xml using program.xsl. You could also have written your Java program using JDOM instead of JAXP. Just like the JAXP program Transform1, Transform2 is an adaptation of CueMyLine5. In Chapter 13, you created this program to make changes to rich_iii.xml by using JDOM and then saved the changes. You may need to refer back to Chapter 13 to review setting up your computer to run JDOM applications. Here's a partial listing of the JDOM version of CueMyLine5.java: package cue; // imports Chapter 14: Transforming and Binding Your XML Documents 276 public class CueMyLine5 { Document document; public CueMyLine5() { try{ SAXBuilder builder = new SAXBuilder(); document = builder.build(new File("rich_iii.xml")); } catch(JDOMException e){ System.out.println( "There's a JDOM problem."); } } public void addPrologue(){ // } public void saveTheDocument(){ try{ XMLOutputter xmlOutputter = new XMLOutputter(" ", true); xmlOutputter.setTextNormalize(true); xmlOutputter.output(document, new FileWriter("rewrite.xml")); } catch (Exception e) { System.out.println("Transformer Config Exception"); } } public static void main(String[] args) { CueMyLine5 cueMyLine = new CueMyLine5(); cueMyLine.addPrologue(); cueMyLine.saveTheDocument(); } } As with Transform1, other than renaming the class and methods, you need to make surprisingly few alterations. You will create Transform2.java in the change directory. You will parse rich_iii.xml and then transform it using the XSLT style sheet program.xsl. Finally, you will output the transformed file as JDOMalteredRichard.html. The differences between Transform2 and CueMyLine5 are shown in boldface in the following code: package change; import org.jdom.input.SAXBuilder; import org.jdom.Document; import org.jdom.JDOMException; import java.io.File; import java.io.FileWriter; import org.jdom.output.XMLOutputter; import org.jdom.transform.JDOMSource; import org.jdom.transform.JDOMResult; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamSource; import java.io.IOException; public class Transform2 { Document document; public Transform2() { try{ SAXBuilder builder = new SAXBuilder(); Chapter 14: Transforming and Binding Your XML Documents 277 document = builder.build(new File("rich_iii.xml")); } catch(JDOMException e){ System.out.println( "There's a JDOM problem."); } } public void transformTheDocument(String stylesheet){ try { Transformer transformer = TransformerFactory .newInstance().newTransformer( new StreamSource(stylesheet)); JDOMResult out = new JDOMResult(); transformer.transform(new JDOMSource(document), out); XMLOutputter xmlOutputter = new XMLOutputter(" ", true); xmlOutputter.setTextNormalize(true); xmlOutputter.output(out.getDocument(), new FileWriter("JDOMAlteredRichard.html")); } catch (TransformerException e) { System.out.println("Transformer Exception"); } catch (IOException e) { System.out.println("IOException"); } } public static void main(String[] args) { Transform2 transform2 = new Transform2(); transform2.transformTheDocument("program.xsl"); } } From now on, you can decide whether you prefer to use JAXP or JDOM to transform your XML. Transforming XML In the last section you looked at ways of presenting your XML files to human consumers. Often the clients for your XML documents are other machines. You've seen that if you know the DTD for a given XML file then you can easily write an application that extracts the information you need. If you are processing hundreds of resumes each day, you may want to pre−screen the submissions to make certain that they meet some minimal qualification before you hand−process them. Consider the difficulties that will arise when you interact with another organization that is processing résumés that have been validated against a different DTD, one that the organization has developed in−house. In this section, you are concerned with transforming XML documents so that they can be read and understood. This time, however, you aren't concerned with how they look but in how the data is structured. Although this type of transformation is usually applied to data−centric XML documents, you can continue with the Richard III example by converting a document that conforms to the existing play.dtd to a document that conforms to a new DTD that you'll define. Chapter 14: Transforming and Binding Your XML Documents 278 A second DTD for Shakespeare's plays You've no doubt noticed by now that play.dtd defines elements but no attributes. There continue to be arguments about what belongs in an attribute and what belongs in an element. At one extreme are those who believe you should never use attributes. At the other are those who put anything they consider to be non−displayable data in attributes. The DTD play.dtd takes the "never use attributes" approach. As a reminder, here's play.dtd: <!−− DTD for Shakespeare J. Bosak 1994.03.01, 1997.01.02 −−> <!−− Revised for case sensitivity 1997.09.10 −−> <!−− Revised for XML 1.0 conformity 1998.01.27 (thanks to Eve Maler) −−> <!−− <!ENTITY amp "&#38;#38;"> −−> <!ELEMENT PLAY (TITLE, FM, PERSONAE, SCNDESCR, PLAYSUBT, INDUCT?,PROLOGUE?, ACT+, EPILOGUE?)> <!ELEMENT TITLE (#PCDATA)> <!ELEMENT FM (P+)> <!ELEMENT P (#PCDATA)> <!ELEMENT PERSONAE (TITLE, (PERSONA | PGROUP)+)> <!ELEMENT PGROUP (PERSONA+, GRPDESCR)> <!ELEMENT PERSONA (#PCDATA)> <!ELEMENT GRPDESCR (#PCDATA)> <!ELEMENT SCNDESCR (#PCDATA)> <!ELEMENT PLAYSUBT (#PCDATA)> <!ELEMENT INDUCT (TITLE, SUBTITLE*, (SCENE+|(SPEECH|STAGEDIR|SUBHEAD)+))> <!ELEMENT ACT (TITLE, SUBTITLE*, PROLOGUE?, SCENE+, EPILOGUE?)> <!ELEMENT SCENE (TITLE, SUBTITLE*, (SPEECH | STAGEDIR | SUBHEAD)+)> <!ELEMENT PROLOGUE (TITLE, SUBTITLE*, (STAGEDIR | SPEECH)+)> <!ELEMENT EPILOGUE (TITLE, SUBTITLE*, (STAGEDIR | SPEECH)+)> <!ELEMENT SPEECH (SPEAKER+, (LINE | STAGEDIR | SUBHEAD)+)> <!ELEMENT SPEAKER (#PCDATA)> <!ELEMENT LINE (#PCDATA | STAGEDIR)*> <!ELEMENT STAGEDIR (#PCDATA)> <!ELEMENT SUBTITLE (#PCDATA)> <!ELEMENT SUBHEAD (#PCDATA)> Now it's time to create a second DTD for specifying one of Shakespeare's plays. This exercise is not intended to suggest that this DTD needs improvements; the point of this section is to arrive at a different DTD. In the next section, you'll construct an XSLT style sheet to convert rich_iii.xml into an XML document that conforms to this new DTD. The structure of a <SCENE>, <EPILOGUE>, and <PROLOGUE> are similar enough that you can treat them all as if they were the same thing. The description of <ACT> in play.dtd restricts each act to having one or no prologue, followed by at least one scene, followed by one or no epilogue. Although this new DTD can't enforce this existing structure, the new DTD will only be used for Shakespeare's plays, none of which violate this structure. Although it would be a bit more problematic, you can eliminate <INDUCT> and treat it as a type of <SCENE>. Doing this will require you to revise the new DTD for plays with introductions that consist of multiple scenes. For your purposes in this Richard III example, you can get away with the oversimplification of the new DTD. A tradeoff is that the specification of <PLAY> will be a little less clear as <scene> can refer to more than one type of element. The first optional <scene> is the introduction, the second is the prologue, and the third is the epilogue. Chapter 14: Transforming and Binding Your XML Documents 279 In the revised DTD, you can take advantage of a decision not to display the front matter or the list of characters in the play. Elements such as <TITLE>, <SUBTITLE>, and <SPEAKER> are now treated as attributes. Here's the new DTD, which you can save as newPlay.dtd (to avoid confusion later as to which DTD is being discussed, this one uses lower case for all elements and attributes): <!−− DTD example derived from the revised version of J. Bosak's DTD for Shakespeare −−> <!ELEMENT play (scndescr, scene?,scene?, act+, scene?)> <!ELEMENT p (#PCDATA)> <!ELEMENT scndescr (#PCDATA)> <!ELEMENT act (scene+)> <!ELEMENT scene ((speech | stagedir | subhead)+)> <!ELEMENT speech ((line | stagedir | subhead)+)> <!ELEMENT line (#PCDATA | stagedir)*> <!ELEMENT stagedir (#PCDATA)> <!ELEMENT subhead (#PCDATA)> <!ATTLIST play title CDATA #REQUIRED subtitle CDATA #IMPLIED > <!ATTLIST act title CDATA #REQUIRED subtitle CDATA #IMPLIED > <!ATTLIST scene title CDATA #REQUIRED subtitle CDATA #IMPLIED > <!ATTLIST speech speaker CDATA #REQUIRED > Translating with a style sheet You can think of the two DTDs as defining different dialects. Your next job is to provide the translation. When Midwesterners refer to a carbonated beverage, they call it a pop. When they offer one to a New Yorker, they have to ask if the New Yorker would like a soda if they wish to be understood. You could use an XSLT style sheet to convert a <POP> element to a <SODA> element. Compare the two DTDs and look for ways in which you might map the elements in play.dtd to the elements and attributes in newPlay.dtd. Creating elements Start by considering the simplest sort of map. A <LINE> as it is defined by play.dtd is exactly mapped to a <line> as it is defined by newPlay.dtd. Whenever the translator encounters a <LINE> element, you want it to create a <line> element and put the contents of <LINE> into the newly created <line>. Here's how you arrange this: <xsl:template match="LINE"> <xsl:element name="line"> <xsl:apply−templates /> </xsl:element> </xsl:template> The tag <xsl:element name="line"> creates the <line> element in the target file. The end tag for <line> will be placed where the corresponding </xsl:element> tag and the <xsl:apply−templates /> tag will be replaced by the contents of <LINE>. Suppose for a minute that you instead used this code: <xsl:template match="LINE"> <xsl:element name="line"> </xsl:element> </xsl:template> Chapter 14: Transforming and Binding Your XML Documents 280 Because you haven't placed any content between the start and end <xsl:element> tags, the translator is smart enough to replace these with the empty tag <line />. Creating attributes In play.dtd the element <SPEECH> had <SPEAKER> as a child element. In newPlay.dtd the element <speech> has an attribute named speaker. In addition, <SPEECH> has <LINE>, <STAGEDIR>, and <SUBHEAD> elements that need to be mapped across to the corresponding children of <speech>. You can do this mapping with the following code: <xsl:template match="SPEECH"> <xsl:element name="speech"> <xsl:attribute name="speaker"> <xsl:value−of select="SPEAKER" /> </xsl:attribute> <xsl:apply−templates /> </xsl:element> </xsl:template> Inside the <xsl:element> tags that map to the <speech> start and end tags, you include <xsl:attribute> tags that specify the name of the attribute you are declaring as an attribute of the <xsl:attribute> tag. The contents of the tag will be the value of the attribute: In this case the tag contains the value of the <SPEAKER> element. Leaving elements out Not all of the elements in play.dtd are being mapped over. For example, in the <PLAY> element, you won't be keeping the front matter or the dramatis personae. You could specify this in either of two ways. The first way is by explicitly listing the children of <PLAY> that you will keep in the target XML document, as follows: <xsl:template match="PLAY"> <xsl:element name="play"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="PLAYSUBT" /> </xsl:attribute> <xsl:apply−templates select="SCNDESCR" /> <xsl:apply−templates select="INDUCT" /> <xsl:apply−templates select="PROLOGUE" /> <xsl:apply−templates select="ACT" /> <xsl:apply−templates select="EPILOGUE" /> </xsl:element> </xsl:template> An alternate approach with the same end result is to start by using the <xsl:apply−templates> to process all the children of the <PLAY> element, like this: <xsl:template match="PLAY"> <xsl:element name="play"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="PLAYSUBT" /> Chapter 14: Transforming and Binding Your XML Documents 281 </xsl:attribute> <xsl:apply−templates /> </xsl:element> </xsl:template> For any element that you don't want included in the resulting document, you can create an empty rule, like this: <xsl:template match="FM" /> Setting the document type declaration When you were transforming rich_iii.xml into an HTML document, your XSLT style sheet included the following element: <xsl:output method="html" /> Now you are transforming one XML document into another one, so the value of method is now xml. Set the doctype−system attribute to newPlay.dtd to point to your new DTD. Here's your new <output> element: <xsl:output method="xml" doctype−system="newPlay.dtd" /> The XSLT translator will turn this input into the following output in alteredRichard.xml: <!DOCTYPE play SYSTEM "newPlay.dtd"> You can also set the doctype−public attribute to include a PUBLIC declaration in your document type declaration. The complete style sheet Now that you know how to construct the pieces of the style sheet, you can put them all together into a file called translate.xsl, as shown in Listing 14−1. Listing 14−1: The translate.xsl style sheet <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml" doctype−system="newPlay.dtd" /> <xsl:template match="PLAY"> <xsl:element name="play"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="PLAYSUBT" /> </xsl:attribute> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="ACT"> <xsl:element name="act"> <xsl:attribute name="title"> Chapter 14: Transforming and Binding Your XML Documents 282 <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="SUBTITLE" /> </xsl:attribute> <xsl:apply−templates select="PROLOGUE" /> <xsl:apply−templates select="SCENE" /> <xsl:apply−templates select="EPILOGUE" /> </xsl:element> </xsl:template> <xsl:template match="SCNDESCR"> <xsl:element name="scndescr"> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="INDUCT"> <xsl:element name="scene"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="SUBTITLE" /> </xsl:attribute> <xsl:apply−templates/> </xsl:element> </xsl:template> <xsl:template match="PROLOGUE"> <xsl:element name="scene"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="SUBTITLE" /> </xsl:attribute> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="EPILOGUE"> <xsl:element name="scene"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="SUBTITLE" /> </xsl:attribute> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="SCENE"> <xsl:element name="scene"> <xsl:attribute name="title"> <xsl:value−of select="TITLE" /> </xsl:attribute> <xsl:attribute name="subtitle"> <xsl:value−of select="SUBTITLE" /> </xsl:attribute> Chapter 14: Transforming and Binding Your XML Documents 283 <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="SPEECH"> <xsl:element name="speech"> <xsl:attribute name="speaker"> <xsl:value−of select="SPEAKER" /> </xsl:attribute> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="STAGEDIR"> <xsl:element name="stagedir"> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="LINE"> <xsl:element name="line"> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="P"> <xsl:element name="p"> <xsl:apply−templates /> </xsl:element> </xsl:template> <xsl:template match="TITLE" /> <xsl:template match="SUBTITLE" /> <xsl:template match="SPEAKER" /> <xsl:template match="PLAYSUBT" /> <xsl:template match="PERSONAE" /> <xsl:template match="FM" /> </xsl:stylesheet> Adjust Transform1.java to use translate.xsl instead of program.xsl as the style sheet. You also need to change the name of the output file from alteredRichard.html to alteredRichard.xml. Compile and run Transform1.java. Figure 14−7 shows part of alteredRichard.xml viewed in IE 5.5. Figure 14−7: The results of applying translate.xsl Chapter 14: Transforming and Binding Your XML Documents 284 Binding with JAXB Thus far in this chapter, you've looked at two types of transformations. You transformed elements of an XML document into HTML so that you could easily display the resulting document in a browser. You also transformed one XML document into another so an organization using a different DTD would be able to use it. Now you will look at transforming XML into Java objects so that Java developers can use them more easily. In this section, you'll create a binding schema and examine the generated files. In the next section, you'll use this binding in a sample application. The point of binding is that you are creating a mapping. This will enable you to more quickly translate data stored in XML into Java objects, manipulate those objects, and then translate them back to persist them. As a starting point, you'll transform the play.dtd that you've been working with to get a feel for what is created by JAXB. Once you understand the default behavior of the schema compiler, you'll customize this behavior with an example that features different datatypes. Installing and running JAXB Currently JAXB is available as an early−access release. You can download the distribution from http://java.sun.com/xml/jaxb/index.html. The release notes describe the installation on a UNIX platform. There is no quick launcher for Windows, but you can easily run JAXB on a Windows box: Either copy the two jar files in the lib directory of the distribution into your \jre\lib\ext directory, or change your CLASSPATH to point to these two jars. Now you can run the schema compiler that generates the Java classes from the command line. In any case, you will need a binding schema that contains instructions for the schema compiler. At the very minimum this binding schema must specify a root element. For example, the Shakespearean plays have a root element of <PLAY>. Create a binding schema called Shakespeare.xjs that contains the following three lines: <xml−java−binding−schema version="1.0ea"> <element name="PLAY" type="class" root="true" /> </xml−java−binding−schema> Save the file in the same directory as play.dtd. Shakespeare.xjs has a root element called <xml−java−binding−schema> with the version specified as early−access 1.0. For now, the only other content of this file is the element <element> that has the name attribute set to the play.dtd element <PLAY> with instructions that this element will become a class and that it can be the root element of a document. You can specify that multiple elements can be root elements by using more than one <element> tag. You can now use play.dtd to generate Java classes by using the schema compiler and passing it the name of the DTD as well as the name of the binding schema. Open a command window and navigate to the directory containing play.dtd and Shakespeare.xjs. Enter this command: java com.sun.tools.xjc.Main "play.dtd" "Shakespeare.xjs" This command runs the schema−compiler application and passes in two parameters. The first is for the schema specified, in this case, by play.dtd. The second is for the binding schema Shakespeare.xjs. After a moment you'll see feedback in the console window to let you know that .java files are being generated with the names ACT.java, EPILOGUE.java, FM.java, INDUCT.java, LINE.java, PERSONAE.java, PGROUP.java, PLAY.java, PROLOGUE.java, SCENE.java, and SPEECH.java. Chapter 14: Transforming and Binding Your XML Documents 285 [...]... javax.xml.bind.InvalidAttributeException; javax.xml.bind.InvalidContentObjectException; javax.xml.bind.LocalValidationException; javax.xml.bind.MarshallableObject; javax.xml.bind.MarshallableRootElement; javax.xml.bind.Marshaller; javax.xml.bind.MissingContentException; javax.xml.bind.NoValueException; javax.xml.bind.PredicatedLists; javax.xml.bind.PredicatedLists.Predicate; javax.xml.bind.RootElement; javax.xml.bind.StructureValidationException;... Listing 14−4: Final version of UserStoriesApp2 .java import import import import import java. io.File; java. io.FileInputStream; java. io.FileOutputStream; java. util.List; java. util.Date; public class UserStoriesApp2 { public static UserStory aUserStory = new UserStory(); public static void main(String[] args) throws Exception { UserStoriesApp2 ua2 = new UserStoriesApp2(); //File story = null; FileInputStream... UserStory .java import import import import import import import import import import import import import import import import import import import import import import import import import import java. io.IOException; java. io.InputStream; java. util.ArrayList; java. util.Iterator; java. util.List; javax.xml.bind.ConversionException; javax.xml.bind.Dispatcher; javax.xml.bind.DuplicateAttributeException; javax.xml.bind.InvalidAttributeException;... 1 Buy Lunch Items 304 Chapter 14: Transforming and Binding Your XML Documents Get a jar of peanutbutter and a loaf of bread. Justin 2 2 2 Eat lunch... javax.xml.bind.StructureValidationException; javax.xml.bind.UnmarshalException; javax.xml.bind.Unmarshaller; javax.xml.bind.ValidatableObject; javax.xml.bind.Validator; javax.xml.marshal.XMLScanner; javax.xml.marshal.XMLWriter; public class UserStory extends MarshallableRootElement implements RootElement { private boolean _IsCompleted; private boolean isDefaulted_IsCompleted = true; private final static boolean DEFAULT_ISCOMPLETED = false; 29 2... ChangedUserStory class import java. io.File; import java. io.FileInputStream; import javax.xml.bind.Dispatcher; public class UserStoriesApp3 { public static ChangedUserStory anotherUserStory = new ChangedUserStory(); public static void main(String[] args) throws Exception { UserStoriesApp2 ua2 = new UserStoriesApp2(); FileInputStream fileInputStream=null; try { File story = new File("SampleStories2.xml"); fileInputStream... 307 Part V: Abstracting the System Chapter List Chapter 15: Exploring the RMI Mechanism Chapter 16: Introducing Enterprise JavaBeans Chapter 17: Using Advanced EJB Techniques Chapter 18: Introducing CORBA Chapter 19: CORBA Applications in the Enterprise Chapter 20 : Why Dream of Jini? 308 Chapter 15: Exploring the RMI Mechanism Overview If you have Java on the client and the server, you can use Remote... purchaseTask.setEstimate (2) ; purchaseTask.setDateAssigned(new Date()); myTasks.add(purchaseTask); } } Compile and run UserStoriesApp2 .java, and you will produce this file, named alteredStories.xml: 7 Make Lunch Prepare something to eat. ... file; now you'll use Java code to add a Task to the UserStory You can use this technique to create the entire content tree from scratch Here the addNewTask() method adds all the required elements and attributes The changes are in boldface in the following code: import import import import java. io.File; java. io.FileInputStream; java. util.List; java. util.Date; public class UserStoriesApp2 { public static... estimate) > Use the schema compiler to once again generate Stories .java, Task .java, and UserStory .java You can see that the items in UserStory .java that correspond to the element are the following: private Task _Task; public Task getTask() { return _Task; } public void setTask(Task _Task) { this._Task = _Task; if (_Task == null) { 29 0 Chapter 14: Transforming and Binding Your XML Documents invalidate(); . that .java files are being generated with the names ACT .java, EPILOGUE .java, FM .java, INDUCT .java, LINE .java, PERSONAE .java, PGROUP .java, PLAY .java, PROLOGUE .java, SCENE .java, and SPEECH .java. Chapter. UserStory .java import java. io.IOException; import java. io.InputStream; import java. util.ArrayList; import java. util.Iterator; import java. util.List; import javax.xml.bind.ConversionException; import javax.xml.bind.Dispatcher; import. version of CueMyLine5 .java: package cue; // imports Chapter 14: Transforming and Binding Your XML Documents 27 6 public class CueMyLine5 { Document document; public CueMyLine5() { try{ SAXBuilder

Ngày đăng: 12/08/2014, 19:21