Hi Team,
I'm getting the below error while launching the application.
Tracing compile failure path for type 'xxx.yyy.zzz.abc.shared.util.XMLBeautify'
[INFO] [ERROR] Errors in 'file:/C:/Projects/SmartGWT%20project/abc/src/main/java/xxx/yyy/zzz/abc/shared/util/XMLBeautify.java'
[INFO] [ERROR] Line 28: No source code is available for type javax.xml.transform.Transformer; did you forget to inherit a required module?
[INFO] [ERROR] Line 33: No source code is available for type javax.xml.transform.dom.DOMSource; did you forget to inherit a required module?
[INFO] [ERROR] Line 35: No source code is available for type javax.xml.transform.stream.StreamResult; did you forget to inherit a required module?
[INFO] [ERROR] Line 24: No source code is available for type org.w3c.dom.Document; did you forget to inherit a required module?
[INFO] [ERROR] Line 27: No source code is available for type javax.xml.transform.TransformerFactory; did you forget to inherit a required module?
[INFO] [ERROR] Line 23: No source code is available for type javax.xml.parsers.DocumentBuilder; did you forget to inherit a required module?
[INFO] [ERROR] Line 34: No source code is available for type java.io.StringWriter; did you forget to inherit a required module?
[INFO] [ERROR] Line 22: No source code is available for type javax.xml.parsers.DocumentBuilderFactory; did you forget to inherit a required module?
[INFO] [ERROR] Line 24: No source code is available for type org.xml.sax.InputSource; did you forget to inherit a required module?
[INFO] [ERROR] Line 24: No source code is available for type java.io.StringReader; did you forget to inherit a required module?
[INFO] [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Code in XMLBeautify.java
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
public class XMLBeautify {
public static String beautifyContent(String xml) {
try {
// Parsing the MX Message in XML to a DOM Document
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xml)));
// Setting up a transformer to beautify the XML
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); // Set indentation
// Transform the DOM Document to a beautified string
DOMSource source = new DOMSource(document);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
transformer.transform(source, result);
return writer.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
Tried to implement the XMLBeautify code in both client and shared path but getting the same error.
Could you please help me in resolving this error?
Thanks in advance
I'm getting the below error while launching the application.
Tracing compile failure path for type 'xxx.yyy.zzz.abc.shared.util.XMLBeautify'
[INFO] [ERROR] Errors in 'file:/C:/Projects/SmartGWT%20project/abc/src/main/java/xxx/yyy/zzz/abc/shared/util/XMLBeautify.java'
[INFO] [ERROR] Line 28: No source code is available for type javax.xml.transform.Transformer; did you forget to inherit a required module?
[INFO] [ERROR] Line 33: No source code is available for type javax.xml.transform.dom.DOMSource; did you forget to inherit a required module?
[INFO] [ERROR] Line 35: No source code is available for type javax.xml.transform.stream.StreamResult; did you forget to inherit a required module?
[INFO] [ERROR] Line 24: No source code is available for type org.w3c.dom.Document; did you forget to inherit a required module?
[INFO] [ERROR] Line 27: No source code is available for type javax.xml.transform.TransformerFactory; did you forget to inherit a required module?
[INFO] [ERROR] Line 23: No source code is available for type javax.xml.parsers.DocumentBuilder; did you forget to inherit a required module?
[INFO] [ERROR] Line 34: No source code is available for type java.io.StringWriter; did you forget to inherit a required module?
[INFO] [ERROR] Line 22: No source code is available for type javax.xml.parsers.DocumentBuilderFactory; did you forget to inherit a required module?
[INFO] [ERROR] Line 24: No source code is available for type org.xml.sax.InputSource; did you forget to inherit a required module?
[INFO] [ERROR] Line 24: No source code is available for type java.io.StringReader; did you forget to inherit a required module?
[INFO] [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
Code in XMLBeautify.java
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
public class XMLBeautify {
public static String beautifyContent(String xml) {
try {
// Parsing the MX Message in XML to a DOM Document
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xml)));
// Setting up a transformer to beautify the XML
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); // Set indentation
// Transform the DOM Document to a beautified string
DOMSource source = new DOMSource(document);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
transformer.transform(source, result);
return writer.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
Tried to implement the XMLBeautify code in both client and shared path but getting the same error.
Could you please help me in resolving this error?
Thanks in advance
Comment