Author: bfitzpat
Date: 2012-05-16 11:55:36 -0400 (Wed, 16 May 2012)
New Revision: 41074
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/SOAPDOMParser.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
Log:
JBIDE-10947 - Fixing issue with XML pretty print in WS Tester
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/SOAPDOMParser.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/SOAPDOMParser.java 2012-05-16
15:27:10 UTC (rev 41073)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/SOAPDOMParser.java 2012-05-16
15:55:36 UTC (rev 41074)
@@ -255,6 +255,26 @@
return retBool;
}
+
+ public static boolean isValidXML(String xml) {
+ //get the factory
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+ try {
+
+ //Using factory get an instance of document builder
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ //parse using builder to get DOM representation of the XML file
+ ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
+ db.parse(bais);
+
+ return true;
+
+ }catch(Exception e) {
+ return false;
+ }
+ }
/**
* Simple JSON pretty print to format JSON output
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2012-05-16
15:27:10 UTC (rev 41073)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2012-05-16
15:55:36 UTC (rev 41074)
@@ -1719,7 +1719,7 @@
public void run() {
if (status.getResultsText() != null) {
String results = status.getResultsText();
- if (SOAPDOMParser.isXMLLike(results)) {
+ if (SOAPDOMParser.isValidXML(results)) {
results = SOAPDOMParser.prettyPrint(results);
} else {
results = SOAPDOMParser.prettyPrintJSON(results);
Show replies by date