dxa-web-application-java icon indicating copy to clipboard operation
dxa-web-application-java copied to clipboard

The view has any XML inline comment then XPM rendering of fields breaks

Open avmgan opened this issue 7 years ago • 1 comments

The view contains this <!—Solution for Exercise -> comment. When there are any XML comment, the XPM rendering of fields breaks and XPM editing not working. seems to be an issue with DXA.

Story.jsp:

<%@ taglib prefix="dxa" uri="http://www.sdl.com/tridion-dxa" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<jsp:useBean id="entity" type="com.sdl.modules.Training.model.StoryModel" scope="request"/>
<jsp:useBean id="markup" type="com.sdl.webapp.common.markup.Markup" scope="request"/>

<!-- Solution for Exercise -->
<div class="container-fluid ${entity.htmlClasses}" ${markup.entity(entity)}>

    <div id="location-tile" class="row">
        <c:if test="${not empty entity.picture}">
            <div ${markup.property(entity, "picture")}>
                <dxa:media media="${entity.picture}" />
            </div>
        </c:if>

        <div class="col-sm-6">
            <div class="tile">
                <h2>My Story</h2>
                <h1 ${markup.property(entity, "name")}> ${ entity.name }</h1>
                Article: <br />
                <p ${markup.property(entity, "article")}> ${ entity.article }</p>
            </div>
        </div>
    </div>
</div>

Html Source output:

<span>
  <!--  Start Component Presentation: {
  "ComponentTemplateID" : "tcm:22-814-32",
  "ComponentModified" : "2018-03-22T21:35:16",
  "ComponentTemplateModified" : "2018-03-22T21:10:22",
  "ComponentID" : "tcm:22-813",
  "IsRepositoryPublished" : false
}  -->
  <!-- Solution for Exercise --> 
  <div class="container-fluid "> 
   <div id="location-tile" class="row"> 
    <div data-entity-property-xpath="tcm:Content/custom:Story/custom:picture[1]"> 
     <img src="/campaign/media/Buddy_Passport_tcm22-812_w1024_n.jpg" data-aspect="0" width="" /> 
    </div> 
    <div class="col-sm-6"> 
     <div class="tile"> 
      <h2>My Story</h2> 
      <h1 data-entity-property-xpath="tcm:Content/custom:Story/custom:name[1]"> Velmurugan Arjunan</h1> Article: 
      <br /> 
      <p data-entity-property-xpath="tcm:Content/custom:Story/custom:article[1]"> Woohooo this is a great article!</p> 
     </div> 
   </div> 
  </div></span> 

Without Inline XML Comment Working Html source:

 <div class="container-fluid "> 
  <!--  Start Component Presentation: {
  "ComponentTemplateID" : "tcm:22-814-32",
  "ComponentModified" : "2018-03-22T21:35:16",
  "ComponentTemplateModified" : "2018-03-22T21:10:22",
  "ComponentID" : "tcm:22-813",
  "IsRepositoryPublished" : false
}  --> 
  <div id="location-tile" class="row"> 
   <div> 
    <!-- Start Component Field: {"XPath":"tcm:Content/custom:Story/custom:picture[1]"} --> 
    <img src="/campaign/media/Buddy_Passport_tcm22-812_w1024_n.jpg" data-aspect="0" width="" /> 
   </div> 
   <div class="col-sm-6"> 
    <div class="tile"> 
     <h2>My Story</h2> 
     <h1> 
      <!-- Start Component Field: {"XPath":"tcm:Content/custom:Story/custom:name[1]"} --> Velmurugan Arjunan</h1> Article: 
     <br /> 
     <p> 
      <!-- Start Component Field: {"XPath":"tcm:Content/custom:Story/custom:article[1]"} --> Woohooo this is a great article! for Hello World Training1111</p> 
    </div> 
   </div> 
  </div> 
 </div>

Please let me know if there any further information required.

image

avmgan avatar Mar 23 '18 16:03 avmgan

This looks like a DXA bug, found on DXA 1.7, likely to appear in DXA 1.8 as well. Unknown if this still exists in DXA 2.0.

jhorsman avatar Mar 23 '18 16:03 jhorsman