My Document Object Model tree is complete in memory and…now, I want to output it as an XML string.…I'll show you how to do this in the project DOMTransform.…If I run this project, I see that the…data is all packed into the XML structure, in memory.…But, now I want to output it as an XML string with tags, quotes and so on.…To do this, I'll use…the TrAX API.…TrAX stands for the Transformation API for XML and it includes a bunch of…classes such as transformer, transformer factory, DOM source and others.…
I'm not going to need a lot of this debugging code.…So I'm going to select all of the code after…I've created my document object and I'll comment it out.…Then I'll add some space right here.…In order to transform my document into XML, I'll first wrap the document…inside the class called DOMSource. It's a member of the TrAX API.…Be sure to add an import statement for the class.…I'll name the object source, and I'll use a constructor…method from this class that's wrapped around the document object.…
You can wrap a DOMSource around a document, an element, or…
Author
Released
11/8/2013- Choosing a Java-based XML API
- Reading XML as a string
- Comparing streaming and tree-based APIs
- Parsing XML with SAX
- Creating and reading XML with DOM
- Adding data to an XML document with JDOM
- Reading and writing XML with StAX
- Working with JAXB and annotated classes
- Comparing Simple XML Serialization to JAXB
Skill Level Intermediate
Duration
Views
Related Courses
-
Introduction
-
Welcome55s
-
What you should know1m 43s
-
Using the exercise files4m 48s
-
-
1. Getting Started
-
Reviewing XML terminology9m 56s
-
Reading XML as a string5m 42s
-
-
2. Parsing XML with SAX (Simple API for XML)
-
How SAX works6m 7s
-
-
3. Creating and Parsing XML with Document Object Model
-
How DOM works7m 56s
-
Creating a DOM document8m 5s
-
-
4. Creating and Parsing XML with JDOM
-
How JDOM works5m 52s
-
-
5. Creating and Parsing XML with StAX
-
How StAX works6m 11s
-
-
6. Creating and Parsing XML with JAXB
-
7. Creating and Parsing with Simple XML Serialization
-
Comparing Simple to JAXB3m 59s
-
-
Conclusion
-
Next steps1m 7s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Serializing a DOM document to a string