Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML preamble customization #274

Open
theseeker58 opened this issue Jul 31, 2023 · 0 comments
Open

XML preamble customization #274

theseeker58 opened this issue Jul 31, 2023 · 0 comments

Comments

@theseeker58
Copy link

theseeker58 commented Jul 31, 2023

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", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant