1

i am using the answer mentioned in the below link to merge XML files
https://stackoverflow.com/a/10760236/1643087
but the output files seems to be missing the encoding

 <?xml version="1.0"?>
<DataFile>
    <Contact id="1" time="13vsxv:01" KeyCd="cxcEfsd191cxzcate="2012-11-19"><Name><Title>01</Title><FirstName>Chrcxzcan</FirstName><LastName>methot</LastName></Name><Address><Street>9xcz</Street><City>Repentigny</City><State>QC</State><Zip>J5Y1c9</Zip></Address><ContactInfo><Email>ancxcec@ucxcet</Email><EvePhone>4fds277</EvePhone></ContactInfo><Language><Lang>0cxc</Lang></Language></Contact>
    <Contact id="2" time="13:02:01" KeyCd="0dasdEC201sda3dad000036" date="2012-11-19">....</Contact>
    .............
</DataFile>

can anybody tell me how to set encoding="ISO-8859-1" and instead of
XMLInputFactory xmlInFactory = XMLInputFactory.newFactory();
i have used
XMLInputFactory xmlInFactory = XMLInputFactory.newInstance();

Community
  • 1
  • 1
user1643087
  • 643
  • 1
  • 6
  • 11

2 Answers2

0

On the marshaller, you set the property for the encoding.

m.setEncoding("jaxb.encoding", "ISO-8859-1");
Zagrev
  • 2,000
  • 11
  • 8
0

When creating the document, you pass in the encoding you want to use.

xmlEventFactory.createStartDocument("ISO-8859-1");
Zagrev
  • 2,000
  • 11
  • 8