Clarity

 View Only
  • 1.  Removing XML tags through GEL

    Posted May 10, 2011 06:55 PM
    I'm writing a process to xog out a project, update some attributes, and xog it in as a new project. When I xog out the first project, the output was not a valid input for xog because it added a couple of <constraint/> tags in some of the tasks. I want to just take out these tags. Does anyone know how to do that in GEL? Thanks.


  • 2.  RE: Removing XML tags through GEL

     
    Posted May 13, 2011 04:56 PM
    Hi All,

    Any ideas here for this one?

    Thanks!
    Chris


  • 3.  RE: Removing XML tags through GEL

    Posted May 14, 2011 12:45 PM
    You write "process to XOG" - are you using any of the sample xml files for XOGing and do you need the task data or can you try to use the arguments to exclude them.

    Martti K.


  • 4.  RE: Removing XML tags through GEL

    Posted May 17, 2011 12:21 PM
    I am using the following xml file to xog out a project (which happens to be a template):

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">



    <Header version="8.1.3" action="read" objectType="project" externalSource="NIKU">




    <!-- you change the order by simply swap 1 and 2 number in the name attribute -->




    <args name="order_by_1" value="name"/>




    <args name="order_by_2" value="projectID"/>




    <args name="include_tasks" value="true"/>




    <args name="include_resources" value="true"/>




    <args name="include_custom" value="true"/>




    <args name="include_dependencies" value="true"/>



    </Header>



    <Query>




    <Filter name="projectID" criteria="EQUALS">${templateCode}</Filter>



    </Query>


    </NikuDataBus>

    I then update several attributes on the project, update some attributes and assignments on some tasks, and then xog it back in as a new project. The problem is that some of the templates have records in the prconstraint table, so when those tasks are exported out, they come with a <constraint/> tag. However, something is wrong with how that exports out, since it doesn't contain the type of constraint that it is. I got an error when trying to re-import that project back into Clarity with the <constraint/> tag, so I just wanted to remove it, but I couldn't figure out how to do it. My guess is there was an error in XOG. Since this instance of Clarity is only on 8.1, there may be a fix for it later, but I needed to get this working, so as a workaround I removed the constraints from all the tasks on the template before exporting it out. I would like to be able to avoid doing this and either figure out what is needed for the <constraint/> tag to import correctly, or figure out how to remove it within my GEL script so that I don't have that problem.


  • 5.  RE: Removing XML tags through GEL
    Best Answer

    Posted May 18, 2011 02:42 AM
    I don't know of a way to delete things from XML with jelly. The only approach I have found to work is replacing the XML portion with some empty XML, for example:
    <gel:parse var="xml">
    <a>
      <b>
         <c with="some" attributes="foo" />
      </b>
      <d>
         <e with="some" attributes="bar" />
         <e with="different" attributes="true" />
         <f another="element" />
      </d>
    </a>
    </gel:parse>
    If we do the following:
    <gel:parse var="newB">
         <b />
    </gel:parse>
    and
    <gel:set select="$xml/a/b" value="${newB}" />
    our XML looks like this:
    <a>
      <b> </b>
      <d>
         <e with="some" attributes="bar" />
         <e with="different" attributes="true" />
         <f another="element" />
      </d>
    </a>
    This works fine if we want to remove all the children of an element, but not much good for anything else. As you can see <b /> is still there, and these is no way to remove all the 'e's but leave the 'f', for instance, or delete an attribute from an element. Happy to hear from anyone else that has solved this one.


  • 6.  RE: Removing XML tags through GEL

    Posted Jun 01, 2011 05:08 AM
    Here we can store the xog output into one variable.

    <gel:set
    asString="true"
    select="$project_xog_out" var="v_xml_doc"/>
    Then you need to find the node where you want to keep the if condition and check the node value and remove the xml tag.

    go to main tag.
    <gel:forEach
    select="$project_xog_out/CustomInformation" var="v_custom_node">

    go to tab under the main tab which will under the main loop.
    <gel:forEach
    select="$v_custom_node/column name" var="v_column_node">

    Retrive the value of column name.
    <gel:set
    asString="true"
    select="$v_custom_node/@name" var="v_column_name"/>

    user <core:if to compare the column in the variable and that you want to remove.

    at last

    <gel:set
    insert="true"
    select=here u need to keep the main value="${v_custom_node}"/>

    I have used this kind to code to remove the rights.


  • 7.  RE: Removing XML tags through GEL

    Posted May 20, 2014 05:30 AM
    mansriva:
    <gel:foreach select="$project_xog_out/CustomInformation" var="v_custom_node"><gel:foreach select="$v_custom_node/column name" var="v_column_node">I have used this kind to code to remove the rights.</gel:foreach></gel:foreach>

    Hi,

    Could you please help me to remove an project instance level rights.. for a resource using gel.

    Thanks




     



  • 8.  RE: Removing XML tags through GEL

    Posted May 20, 2014 07:46 AM
    harikumar:

    Hi,

    Could you please help me to remove an project instance level rights.. for a resource using gel.

    Thanks


    See this thread - Removing Rights for a User using a Process - the trick is the complete="true" flag.