How to Canonicalize a Stax XML object.
- by Enrique San Martín
Hello, i want to Canonicalize a Stax object, the program it's doing it with DOM, but dom can't manage big XML documents (like 1GB), so STAX it's the solution.
The Code that i have it's:
File file=new File("big-1gb.xml");
org.apache.xml.security.Init.init();
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = dfactory.newDocumentBuilder();
Document doc = documentBuilder.parse(file);
Canonicalizer c14n = Canonicalizer.getInstance("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
outputBytes = c14n.canonicalizeSubtree(doc.getElementsByTagName("SomeTag").item(0));
The idea it's do the code below with Stax...
Thx :)