Java has two main ways to work with XML: the lower-level parsing APIs (DOM, SAX, StAX, XPath) for reading and writing XML directly, and JAXB for binding XML to Java objects automatically.
1. XML Parsing: DOM, SAX, StAX and XPath
DOM vs SAX vs StAX Parser in Java compares the three approaches before picking one.
- Read XML File in Java using DOM Parser
- Convert String to XML Document (DOM, Secure Parsing)
- Convert XML Document to String and Write XML File
- Java SAX Parser: Read XML with DefaultHandler
- Java StAX Parser: Read XML with Cursor and Iterator APIs
- Read XML With JDOM2: SAXBuilder, XPath, Examples
- Convert XML to Properties and Properties to XML
2. XPath
- Java XPath Tutorial With Examples (javax.xml.xpath)
- Java XPath Get Attribute Value (String, List, Number)
- Java XPath Find Nodes by Attribute Value
- XPath: Check if a Node or Attribute Exists
- Java XPath NamespaceContext: Namespace Resolution
3. JAXB: Binding XML to Java Objects
- Jakarta JAXB Annotations (with Example)
- JAXB Marshaller Example: Converting POJO to XML
- JAXB Unmarshaller Example: Convert XML to Java Object
- JAXB Read XML to Java Object Example
- JAXB @XmlRootElement Annotation Example
- JAXB @XmlElementWrapper Example
- JAXB Marshal List and Set to XML and Unmarshal Back
- JAXB: Marshal / Unmarshal a Map in Java
- JAXB Marshal Java Objects without @XmlRootElement
- [Solved] JAXB UnmarshalException: unexpected element
- JAXB Schema Validation
- Generate XSD from JAXB Java Classes using Eclipse
- Using JAXB XmlAdapter and XmlJavaTypeAdapter with Interfaces
- Eclipse MOXy: Marshal Java Object to JSON
- Eclipse MOXy: Unmarshal JSON to Java Object
4. JAXB Error Troubleshooting
- [Solved] JAXB Error: No default constructor found on class
- JAXB AnnotationsException: 3 counts of IllegalAnnotationExceptions
- JAXBException: ArrayList is not known to this context
Happy Learning !!