Java Examples

This is the Java example section of the XML Tutorial site. The examples are organized as follows:

  • XML & Java
  • XPATH & Java
  • XSLT & Java

This is an ongoing project - Be sure to follow our site as we are constantly adding new content just for you! If you have a special request, contact us and let us know!

Latest Additions

  • How to remove invalid characters from XML - The XML specification supports a very specific character set. Characters that fall outside of the specified ranges result in a parser error whenever the XML string is parsed.
  • How to use the correct XML character encoding - The XML specification allows for the use of various encodings. UTF-8 or UTF-16 are typically expected; however, it is recognised that other encodings exist in the world: Correctly encoding XML allows for portable applications.
  • How to create a XML document - A newly created, in-memory, XML document is sometimes necessary for ad-hoc data manipulation and / or document generation.