jakartaee / jakartaee/jaxb-api
XML preamble customization
- Dominant language
- Java
- Stars
- 79
- Forks
- 48
- Avg merge
- 7h 12m
- Merged PRs (30d)
- 2
Description
I'm trying to customize XML preamble. In particular I need to remove standalone flag.
These are the statements I'm using
```
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "urn:iso:std:iso:20022:tech:xsd:pain.013.001.010 pain.013.001.10.xsd");
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
marshaller.setProperty("org.glassfish.jaxb.xmlHeaders", "");
FileOutputStream out = new FileOutputStream(new File("src/test/resources/test.xml"));
marshaller.marshal(document, out);
```
Everything works fine as long as I use a FileOutputStream.
Nothing happens when I use a StringWriter even though Writer is one of the classes allowed, according to documentation
Contributor guide
Research direction
No repository file or test path is mentioned. Start by reproducing the JAXB marshalling difference between FileOutputStream and StringWriter using the statements in the issue, then inspect the relevant XML-header property and writer-handling documentation. Done means the preamble customization behaves consistently for StringWriter, or the supported behavior and workaround are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100