Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Creating bookmark titles with characters like " (quot), & (amp), ' (apos)

Avatar

Former Community Member
We build the DDX dynamically based on a list of PDF files to be assembled. For each file we want to add a bookmark title based on the file content's title. This title may contain characters like " (quot), & (amp), ' (apos). E.g. this is an extract from a DDX:<br /><PDF source="rapportbok_49" bookmarkTitle=""Background levels": More text"><br /></PDF><br />This will cause assembling to fail (naturly). In this case we could have enclosed the title text with apostroph instead of quotation. But what do we do if the title contains both characters? <br />We tried to rewrite the DDX to (this would have solved the problem with quot and apos):<br /><PDF source="rapportbok_49"><br /> <bookmarkTitle>"Background levels": More text</bookmarkTitle><br /></PDF><br />However, this is not a legal DDX syntax.<br />We tried to substitute " with &quot;, resulting in &quot; in the output.<br />We tried to escape " with \", giving syntax failure.<br /><br />Does anyone have a suggestion to how to solve our problem?
12 Replies

Avatar

Level 7
I don't know the product, but have you tried using standard XML

escapes?



Aandi Inston

Avatar

Former Community Member
Yes, the DDX is parsed by an XML parser so you do need to use the standard XML escapes (in fact, I have to use XML escapes in this post):



<PDF source=rapportbok_49" bookmarkTitle="&quot;Background levels&quot;: More text">

Avatar

Former Community Member
We also tried using standard XML escapes. In the generated PDF, the bookmarktitle text in the table of contents contained the standard XML escape characters we specified, i.e. they were not replaced by their proper characters.

Avatar

Level 7
If that is the case you have found a bug, because every XML consumer

is required to process the escapes correctly. There are no exceptions

allowed. All conforming XML readers and viewers must do this.



Make sure you are getting the actual escapes into the XML at a direct

level. Look in Notepad, not a higher level XML viewer like IE, which

will only show & A M P ; if the file actually contains & A M P ; A M P

;



Aandi Inston

Avatar

Former Community Member
You'll need to use XML entities:

<PDF source="rapportbok_49" bookmarkTitle="&quot;Background levels&quot;: More text"/>

Avatar

Former Community Member
Here is an extract from my generated DDX:<br /><PDF source="rapportbok_1" bookmarkTitle="Prosjektnummer 173686. Prosjekttittel: Prosjekt med test av spesialkarakterer &amp;amp; &amp;apos; &amp;quot;" ><br /><br />(Edited the amp to avoid HTML formatting to visulize content of XML as happend in my original posting when trying to explain how we substituted ")<br /><br />The resulting text in the TOC of the PDF is:<br />Prosjektnummer 173686. Prosjekttittel: Prosjekt med test av spesialkarakterer &amp;amp; &amp;apos; &amp;quot;<br /><br />Has anyone tried successfully generating TOC text containing e.g. &quot;?

Avatar

Former Community Member
I copied your text into a DDX and got the corret results. How are you invoking Assembler? Probably the ampersand characters are being re-escaped before Assembler sees the DDX.

Avatar

Former Community Member
We got a weblogic server running with javacode generating the DDX and invoking the remote interface (assembler.invoke(ddxDoc,fileMap,environment,null) to the Assembler that is running on a jboss application server. The ddxDoc refer to a DDX file that is written to a shared directory. It is from this DDX file I've extracted my example. I've not able to see any errors in this file.

The assembler home is created using:

Assembler7Home home = Assembler7Util.getHome(propsJNDI);

where props is a HashMap that contains the following properties:

java.naming.factory.initial="org.jnp.interfaces.NamingContextFactory"

java.naming.provider.url="jnp://server:port/"

java.naming.factory.url.pkgs="org.jboss.naming:org.jnp.interfaces"

com.adobe.idp.globalDocumentStorageRootDir="sharedDir"

jnp.partitionName="partitionName"

Avatar

Former Community Member
Tested generating PDF directly inputing the generated DDX with the supplied web interface (adobe/livecycle/samples/assembler7/commands.jsp).<br />Still same problem with the text in the TOC.<br />Here is the DDX (with edited amp):<br /><?xml version="1.0" encoding="UTF-8"?><br /> <DDX xmlns="http://ns.adobe.com/DDX/1.0/"><br /><br /> <StyleProfile name="genericFooter"><br /> <br /> <Footer><br /> <Right><br /> <StyledText color="black" font-family="Minion Pro" font-size="12pt" font-stretch="normal" font-style="normal" font-weight="normal" line-height="normal" text-decoration="none"><br /> <p>Side <_PageLabel/> av <_LastPageLabel/></p><br /> </StyledText><br /> </Right><br /> </Footer><br /> <br /> </StyleProfile><br /> <br /> <br /> <br /> <StyleProfile name="TOC" ><br /> <br /> <TableOfContents bookmarkTitle="Innholdsfortegnelse" maxBookmarkLevel="2" createLiveLinks="true" includeInTOC="false"> <br /> <br /> <PageLabel mode="Define" start="1" format="LowerRoman" /><br /> <br /> <TableOfContentsPagePattern pages="1"><br /> <Header padding="12pt"><br /> <Center><br /> <StyledText font-size= "18pt" font-weight="bold" font-family="Arial" ><br /> <p>Innholdsfortegnelse</p><br /> </StyledText><br /> </Center><br /> </Header><br /> <Footer><br /> <Center><br /> <StyledText><br /> <p><_PageLabel/></p><br /> </StyledText><br /> </Center><br /> </Footer> <br /> <br /> </TableOfContentsPagePattern><br /> <TableOfContentsPagePattern pages="2-last"><br /> <Footer><br /> <Center><br /> <StyledText><br /> <p><_PageLabel/></p><br /> </StyledText><br /> </Center><br /> </Footer> <br /> </TableOfContentsPagePattern><br /> <br /> <TableOfContentsEntryPattern applicableLevel="1"><br /> <StyledText<br /> color="black"<br /> font-family="Minion Pro"<br /> <br /> font-size="12pt"<br /> font-stretch="normal" <br /> font-style="normal" <br /> font-weight="bold"<br /> <br /> line-height="normal" <br /> text-align="left" <br /> text-decoration="none" <br /> text-indent="0pt" <br /> xml:space="default"<br /> ><br /> <p margin-right="6pt"> <br /> <_BookmarkTitle/><leader leader-pattern="dotted"/><_BookmarkPageCitation/><br /> </p><br /> </StyledText><br /> </TableOfContentsEntryPattern><br /> <br /> <TableOfContentsEntryPattern applicableLevel="2"><br /> <StyledText<br /> color="black"<br /> font-family="Minion Pro"<br /> <br /> font-size="12pt"<br /> font-stretch="normal" <br /> font-style="normal" <br /> font-weight="normal"<br /> <br /> line-height="normal" <br /> text-align="left" <br /> text-decoration="none" <br /> text-indent="12pt"<br /> xml:space="default"<br /> ><br /> <p margin-right="3pt"> <br /> <_BookmarkTitle/><leader leader-pattern="dotted"/><_BookmarkPageCitation/><br /> </p><br /> </StyledText><br /> </TableOfContentsEntryPattern><br /> <!-- Dersom fleire nivaa enn 3, blir siste nivaa bruk for resten. --><br /> <TableOfContentsEntryPattern applicableLevel="3"><br /> <StyledText<br /> color="black"<br /> font-family="Minion Pro"<br /> <br /> font-size="12pt"<br /> font-stretch="normal" <br /> font-style="normal" <br /> font-weight="normal"<br /> <br /> line-height="normal" <br /> text-align="left" <br /> text-decoration="none" <br /> text-indent="24pt"<br /> xml:space="default"<br /> ><br /> <p> <br /> <_BookmarkTitle/><leader leader-pattern="dotted"/><_BookmarkPageCitation/><br /> </p><br /> </StyledText><br /> </TableOfContentsEntryPattern><br /> </TableOfContents> <br /> <br /> </StyleProfile><br /><br /> <PDF result="out.pdf"> <br /> <PDF source="fileIn2" includeInTOC="false" > <br /> <NoFooters/><br /> <NoForms/><br /> </PDF> <br /> <TableOfContents styleReference="TOC"/> <br /> <PDFGroup> <br /> <PageLabel mode="Define" start="1" format="Decimal" /><br /> <Footer styleReference="genericFooter"/> <br /> <PDF source="fileIn1" bookmarkTitle="Prosjektnummer 173686. Prosjekttittel: Prosjekt med test av spesialkarakterer &amp;amp; &amp;apos; &amp;quot;" ><br /> </PDF><br /> </PDFGroup> <br /> </PDF><br /><br /> </DDX>

Avatar

Level 7
Are you definitely looking in the XML file with Notepad, not an XML

viewer?



Aandi Inston

Avatar

Former Community Member
Yes. Viewing the DDX with a Notepad type of editor, I see the XML escapes characters, and viewing the DDX with e.g. IE I see the translated characters & ' ".