EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  XSD to EGL Record and to String

    Posted Mon November 10, 2014 05:01 AM

    Hello,

    I have a XSD with me and I have created a EGL record using File->New->Record->import XML Schema from File option, everything looks fine.

    Based on the EGL record, I have manipulated the inputs for EGL record and trying to convert that as a string using inbuilt utility "XMLLib.convertToXML(EGLRecordName)"

    In XSD I have the parms as

    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xxxx.ibm.com/splm-service" xmlns:tns="http://xxxx.ibm.com/xxxx-service" elementFormDefault="qualified">
    <element name="PartInquiryService">
    <complexType>
    <sequence>
    <element name="control">

    But in the result "XMLLib.convertToXML(EGLRecordName)", I see it bit different

    <ns1:PartInquiryService xmlns:ns1="http://xxxx.ibm.com/splm-service">
    <ns1:control>

    All the tags are appended/prefixed with ns1:, how do I remove those from xml tag's and add other parms needs to be include, lets say I am looking for the XML with the below format

    <?xml version="1.0" encoding="UTF-8"?>
    <PartInquiryService xmlns="http://xxxx.ibm.com/xxxx-service" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:SchemaLocation="http"//xxxx.ibm.com/xxxx-services ifle.xsd >
    <control>

    Thanks in advance.

    navana


  • 2.  Re: XSD to EGL Record and to String

    Posted Fri November 14, 2014 05:09 PM

    Hi Navana,

    Create the record like:

    Record PartInquiryService {@XMLRootElement{}}    xmlns string {@XMLAttribute{}};    xmlns_xsi string {@XMLAttribute{name = "xmlns:xsi"}};    control string {@XMLElement{}};end

    Create the command like:

    myRecord PartInquiryService{};myRecord.xmlns = "http://xxxx.ibm.com/xxxx-service";myRecord.xmlns_xsi = "http://www.w3.org/2001/XMLSchema-instance";xmlString string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + XMLLib.convertToXML(myRecord);

    Result is:

    <?xml version="1.0" encoding="UTF-8"?><PartInquiryService xmlns="http://xxxx.ibm.com/xxxx-service" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  <control></control></PartInquiryService>

    Ortwin

    Ortwin


  • 3.  Re: XSD to EGL Record and to String

    Posted Mon November 17, 2014 02:20 AM

    Ortwin,

    Thanks for your response. I have tried with your code but when running the same, I get the exception as below.

    "org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.".

    Some record definition is wrong and not able to proceed with.

    Thanks.

     

     

     

    navana


  • 4.  Re: XSD to EGL Record and to String

    Posted Mon November 17, 2014 11:30 AM

    What version of RBD are you running?

    I assume you run your code in an EGL Rich UI ruihandler?

    Ortwin

    Ortwin


  • 5.  Re: XSD to EGL Record and to String

    Posted Mon November 17, 2014 12:55 PM

    Hi Ortwin,

    I am using RBD 8.5.1.1. Yes I run it with EGL Rich UI handler only.

    Thanks.

    navana


  • 6.  Re: XSD to EGL Record and to String

    Posted Wed November 19, 2014 04:06 PM

    Attached is the ruihandler that runs fine in my RBD 8.5.1.1 installation.

    Ortwin

    Ortwin


  • 7.  Re: XSD to EGL Record and to String

    Posted Wed November 26, 2014 01:39 PM

    Hi Ortwin,

    Gr8. It worked well. By any chance is there a possibility to make it work with basic library?

    Thanks for your response.

    Naveen.R

    navana


  • 8.  Re: XSD to EGL Record and to String

    Posted Thu November 27, 2014 08:50 AM

    It does work with BasicLibrary.

    Ortwin

    Ortwin


  • 9.  Re: XSD to EGL Record and to String

    Posted Fri January 09, 2015 04:05 AM

    Thanks for the support Ortwin.

    navana