Hello all,
I have a datasource which supplies an xml to the XDP ( created with AEM forms 6.5 designer)
In the XDP I have configured the text field to use the rich text property and provided a binding to the field in the incoming XML which has the html tags.
I would like the text to be formatted based on the <b> and<br /> tags that are present in the XML string.
Below is the XML string:
<orderperson>Sample Text <br /> First Line <br /> <b> Bold Text </b></orderperson>
When i preview the document , i get a Sample ouput like below which just displays the html tags as plain text
I am looking to get the output to be formatted like shown below.
Can any one help me with ways to achieve this?
Regards,
Solved! Go to Solution.
Views
Replies
Total Likes
The rich text is created by xHTML and requires more details in the data than just <br> and <b> tags. The data for you sample text has to look like this:
<body xmlns="http://www.w3.org/1999/xhtml"><p style="text-decoration:none;letter-spacing:0in">Sample Text</p><p style="text-decoration:none;letter-spacing:0in">First Line</p><p style="font-weight:bold;text-decoration:none;letter-spacing:0in">Bold Text</p></body>
The rich text is created by xHTML and requires more details in the data than just <br> and <b> tags. The data for you sample text has to look like this:
<body xmlns="http://www.w3.org/1999/xhtml"><p style="text-decoration:none;letter-spacing:0in">Sample Text</p><p style="text-decoration:none;letter-spacing:0in">First Line</p><p style="font-weight:bold;text-decoration:none;letter-spacing:0in">Bold Text</p></body>
hi radzmar,
i tried the following and faced the below issue. Can you pls advise ?
1. I created an xml containing the line from your above message.
<?xml version="1.0" encoding="UTF-8"?> <body xmlns="http://www.w3.org/1999/xhtml"><p style="text-decoration:none;letter-spacing:0in">Sample Text</p><p style="text-decoration:none;letter-spacing:0in">First Line</p><p style="font-weight:bold;text-decoration:none;letter-spacing:0in">Bold Text</p></body>
2. I created a schema out of the xml to use as data connection.
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="body"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="p"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="style" type="xs:string" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
3. When i import the schema into the data connection , it gives me the below error.
Can you please let me know how to import this into the data connection.
Would it be possible for you to share a small sample file with this working?
Hi,
you don't have to define any fancy XSD, just keep it simple like this.
<?xml version="1.0" encoding="UTF-8"?> <!-- Mit XMLSpy v2014 sp1 (http://www.altova.com) von Detlef Rösner-Katt (TA Triumph-Adler) bearbeitet --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="form"> <xs:annotation> <xs:documentation>Comment describing your root element</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="Text" type="xs:string"/> <xs:element name="Text" type="xs:string"/> <xs:element name="Text" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
This sample gives you a data connection to 3 potential fields named "Text".
Those that are defined to accept Rich Text will display formatted texts and also save the formatting details as simple string into an element <Text> when exporting data.
Here's the XML whre the first Text field accepts Rich Text and the others only plain text.
<?xml version="1.0" encoding="UTF-8"?> <xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> <form> <Text><body xmlns="http://www.w3.org/1999/xhtml"><p style="text-decoration:none;letter-spacing:0in">Sample Text 1</p><p style="text-decoration:none;letter-spacing:0in">First Line</p><p style="font-weight:bold;text-decoration:none;letter-spacing:0in">Bold Text</p></body></Text> <Text>Sample Text 2</Text> <Text>Sample Text 3</Text> </form> </xfa:data>
Views
Likes
Replies