Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    No source code is available Error

    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

    #2
    Hi Kalaibharathi,

    please see what java classes are made available on the clientside by GWT. You will notice that the javax package is not part of it.

    Best regards
    Blama

    Comment


      #3
      Hi

      Initially I implemented the XMLBeautify code directly in the client package and it was throwing some error.
      So i moved the code to shared package and made a call to it from the client side java class. And it was throwing the above mentioned error. Could you please advise how this XMLBeautify code can be implemented so that we can make a call to it from the client side to display the XML file in a indented format.
      If it is not possible how can i indent the content in the HTMLPane?

      Thanks in advance
      Last edited by Kalaibharathi; 6 May 2024, 01:54.

      Comment


        #4
        Hi Team,

        Any update on the above issue?

        Comment


          #5
          Hello, you seem to be asking about a problem using someone else's product with somebody else's IDE, and you don't have a Support contract with us.

          We can solve whatever you'd like - even if it involves someone else's products - that help is available as part of our Consulting service.

          https://smartclient.com/services/

          Comment


            #6
            Isomorphic

            Our first choice of preference is to use the product which are provided by smart client. So Could you please advise on how the XML content in the HTML pane component can be indented using our smart client product, if that's not possible please provide a component which can be used to implement the above requirement\

            Thanks in advance

            Comment


              #7
              No problem. Please see the link above for how you can get our help implementing whatever you need.

              We have a superb team, and once you have our expertise on tap, you'll be surprised how much faster you can move!

              Comment

              Working...
              X