Produced by Araxis Merge on 6/9/2017 3:49:58 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:49:58 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-common\src\main\java\gov\va\nvap\common\transformer\xml | XMLToString.java | Fri Apr 21 20:03:26 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 102 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.nvap. common.tra nsformer.x ml; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.tran sformer.Tr ansformerE xception; | |||||
| 4 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 5 | ||||||
| 6 | import jav a.io.IOExc eption; | |||||
| 7 | import jav a.io.Strin gWriter; | |||||
| 8 | import jav a.io.Write r; | |||||
| 9 | ||||||
| 10 | import jav ax.xml.XML Constants; | |||||
| 11 | import jav ax.xml.tra nsform.Tra nsformer; | |||||
| 12 | import jav ax.xml.tra nsform.Tra nsformerCo nfiguratio nException ; | |||||
| 13 | import jav ax.xml.tra nsform.Tra nsformerFa ctory; | |||||
| 14 | import jav ax.xml.tra nsform.dom .DOMSource ; | |||||
| 15 | import jav ax.xml.tra nsform.str eam.Stream Result; | |||||
| 16 | ||||||
| 17 | import org .apache.xm l.serializ e.OutputFo rmat; | |||||
| 18 | import org .apache.xm l.serializ e.XMLSeria lizer; | |||||
| 19 | import org .w3c.dom.D OMExceptio n; | |||||
| 20 | import org .w3c.dom.D ocument; | |||||
| 21 | ||||||
| 22 | /** | |||||
| 23 | * @author Asha Amri traj | |||||
| 24 | */ | |||||
| 25 | public cla ss XMLToSt ring imple ments | |||||
| 26 | go v.va.nvap. common.tra nsformer.T ransformer <Document, String> | |||||
| 27 | { | |||||
| 28 | ||||||
| 29 | privat e int inde nt = 2; | |||||
| 30 | ||||||
| 31 | privat e int line Width = 65 ; | |||||
| 32 | privat e boolean prettyPrin t = false; | |||||
| 33 | ||||||
| 34 | public XMLToStri ng() | |||||
| 35 | { | |||||
| 36 | ||||||
| 37 | } | |||||
| 38 | ||||||
| 39 | public XMLToStri ng(final b oolean pre ttyPrint) | |||||
| 40 | { | |||||
| 41 | th is.prettyP rint = pre ttyPrint; | |||||
| 42 | } | |||||
| 43 | ||||||
| 44 | public void setI ndent(fina l int inde nt) | |||||
| 45 | { | |||||
| 46 | th is.indent = indent; | |||||
| 47 | } | |||||
| 48 | ||||||
| 49 | public void setL ineWidth(f inal int l ineWidth) | |||||
| 50 | { | |||||
| 51 | th is.lineWid th = lineW idth; | |||||
| 52 | } | |||||
| 53 | ||||||
| 54 | public void setP rettyPrint (final boo lean prett yPrint) | |||||
| 55 | { | |||||
| 56 | th is.prettyP rint = pre ttyPrint; | |||||
| 57 | } | |||||
| 58 | ||||||
| 59 | @Overr ide | |||||
| 60 | public final Str ing transf orm(final Document i nputDoc) | |||||
| 61 | throws T ransformer Exception | |||||
| 62 | { | |||||
| 63 | if (NullChec ker.isEmpt y(inputDoc )) { | |||||
| 64 | return n ull; | |||||
| 65 | } | |||||
| 66 | tr y { | |||||
| 67 | final Wr iter write r = new St ringWriter (); | |||||
| 68 | ||||||
| 69 | if (this .prettyPri nt) { | |||||
| 70 | fina l OutputFo rmat forma t = new Ou tputFormat (inputDoc) ; | |||||
| 71 | form at.setLine Width(this .lineWidth ); | |||||
| 72 | form at.setInde nting(true ); | |||||
| 73 | form at.setInde nt(this.in dent); | |||||
| 74 | fina l XMLSeria lizer seri alizer = n ew XMLSeri alizer(wri ter, forma t); | |||||
| 75 | seri alizer.ser ialize(inp utDoc); | |||||
| 76 | } | |||||
| 77 | else { | |||||
| 78 | fina l DOMSourc e domSourc e = new DO MSource(in putDoc); | |||||
| 79 | fina l StreamRe sult resul t = new St reamResult (writer); | |||||
| 80 | fina l Transfor merFactory tf = Tran sformerFac tory.newIn stance(); | |||||
| 81 | tf.s etFeature( XMLConstan ts.FEATURE _SECURE_PR OCESSING, true); | |||||
| 82 | fina l Transfor mer transf ormer = tf .newTransf ormer(); | |||||
| 83 | tran sformer.tr ansform(do mSource, r esult); | |||||
| 84 | writ er.flush() ; | |||||
| 85 | } | |||||
| 86 | ||||||
| 87 | return w riter.toSt ring(); | |||||
| 88 | } | |||||
| 89 | ca tch (final Transform erConfigur ationExcep tion e) { | |||||
| 90 | throw ne w Transfor merExcepti on(e); | |||||
| 91 | } | |||||
| 92 | ca tch (final IOExcepti on e) { | |||||
| 93 | throw ne w Transfor merExcepti on(e); | |||||
| 94 | } | |||||
| 95 | ca tch (final javax.xml .transform .Transform erExceptio n e) { | |||||
| 96 | throw ne w Transfor merExcepti on(e); | |||||
| 97 | } | |||||
| 98 | ca tch (final DOMExcept ion e) { | |||||
| 99 | throw ne w Transfor merExcepti on(e); | |||||
| 100 | } | |||||
| 101 | } | |||||
| 102 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.