This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In enterprise/jbiTester subcomponent, there is a requirement to use XDM for pretty print and diff of XML. I set this priority to P2 as the dependent jbiTester issue needs to be resolved for FCS. Discussed with Ayub through email and then create this issue. Below are the discussion of items. 1. public static String prettyPrintXML(String doc, String indentation){ } 2. /* type is the comparison type - currently only equal, identical. */ public static List<XMLUtil.Difference> compareXML(String firstDoc, String secondDoc, type) { }; 3. create XMLUtil classese that are used in showDiff() sample code that support for locating the difference. public void showDiff(javax.swing.Document doc1, javax.swing.Document doc2) { //illustrating how to find xml difference and display in ui String xmlstring1 = doc1.getText(0, doc1.getLength()); String xmlstring2 = doc2.getText(0, doc1.getLength()); XMLUtil.DiffInfo diffInfo = XMLUtil.findDiff(xmlstring1, xmlstring2); //diffInfo is an object that holds onto the internal representation. List<XMLUtil.Difference> diffs = diffInfo.getDifferences(); //returns the difference for(XMLUtil.Difference diff: diffs) { XMLUtil.OldNodeInfo oldInfo = diff.getOldNodeInfo(); XMLUtil.NewNodeInfo oldInfo = diff.getNewNodeInfo(); if(oldInfo != null ) { XMLUtil.Position p1 = diffInfo.findPosition(oldInfo.getNode()); //AttributeSet could indicate a different color for Add, Delete, Change ((StyledDocument)doc1).setCharacterAttributes(p1.getBegin, p1.getEnd()-p1.getBegin, AttributeSet s, true); } if(oldInfo != null ) { XMLUtil.Position p1 = diffInfo.findPosition(oldInfo.getNode()); //AttributeSet could indicate a different color for Add, Delete, Change ((StyledDocument)doc1).setCharacterAttributes(p1.getBegin, p1.getEnd()-p1.getBegin, AttributeSet s, true); } } }
Implemented XDMUtil.prettyPrintXML(...) XDMUtil.compareXML(...) See the testcases XDMUtilTest.java for usages. XDMUtil.showDiff(...) - cannot be implmenetd inside of XDM, since XDM is a model, do not have UI infrastructure. I think this method should be some UI related module. I think this is not for NB55 FCS. New files added: /cvs/xml/xdm/src/org/netbeans/modules/xml/xdm/diff/Attic/XDMUtil.java new revision: 1.1.2.1; previous revision: 1.1 /cvs/xml/xdm/test/unit/src/org/netbeans/modules/xml/xdm/diff/Attic/XDMUtilTest.java new revision: 1.1.2.1; previous revision: 1.1
fix VERIFIED in NetBeans IDE Dev (Build 200704091800)