I am trying to fetch the xml from the file, but while fetching the order of the attributes are changing I know it will not matter but in my case it does, as I am hashing the document
I am trying the below code but it is ordering the attributes in an alphabetical manner
File fXmlFile = new File("C:\\Users\\Desktop\\abc.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
String xml=writer.toString();
this is the xml that I am trying to read in the variable xml, I am getting the xml with the attributes sorted in an alphabetical order