Hello,
I am attempting to use the the DXLExporter and DXLImporter classes to replace blocks of text in a RichText field. I would like to use XML tags to identify the text that needs to be replaced.
My problem is that the DXLExporter (I suppose the DXLImporter will do the same thing) convert a tag in the text, say “”, to “<tag1>”. I can understand how this would be the desired effect in many cases, but it’s renders my strategy of using XML to markup my text useless.
Can anyone think of a work-around?
Many thanks !!
PJR
Subject: DXLExporter converts “<” and “>” characters
apparently dxlexporter does not export dxl, yet just strings. I am trying to export dxl from documentcollection, and pick it up in javascript to show in browser. It cannot be done because there is no dxl or xml, there is just escaped xml which is plain text. No node to be found.
Subject: DXLExporter converts “<” and “>” characters
Your text will be character data in an XML element node – it cannot, itself, be XML-formatted, since that would throw false nodes into the document. (Believe it or not, that’s normally a VERY BAD THING.) It appears, though, that that’s pretty much what you’re trying to do. You can get the data node as a string and Split on < then take a left-back on > to get the false node as:
tag1>Data inside the false node</tag1
You can then parse out the tagname and the data, then use DOM methods to CreateElement and AppendChildNode as necessary.
Subject: RE: DXLExporter converts “<” and “>” characters
Many thanks for the reply!!
I completely understand why the exporter would do this … but in my case, I want to take advantage of the parsers to easily replace my text.
I shall give your approach a try …
Thanks again!
PJR
Subject: Use the XSLT processor to modify the DXLExporter output to what you want.
Write a small XSL transformation style sheet which converts the escaped chars back, and then redirect/pipe the output of the DXLExporter into an XSLTransformer object using that XSLT sheet…bingo.
Thomas - IBM