Depends on what you want the resulting absolute/relative path to look like in the output text but,I have modifed the class to allow optional parsing of URLs.

Use:
s SuppressURLs=0
do ##class(String.Tools).HTMLToText(.tmpstream,,,,,SuppressURLs)

to include Urls in the form [http://...]

but you can further modify the source code for the desired output format as necessary... :)

Doug Hendricks


Dipl.-Ing. Werner Riegler wrote:
Doug,

thanks for this details !

do you have an idea how to leave the href=http://xxx.com/yy.html?... stuff
in the text ?
I did it in the PHP regexp version (even translated the relative image src
path ;-))
but I feel that could become more complex for me in your tool...

Maybe something like:

  elseif Left(tagBuff,1)="a" then
    hrefIdx=Instr(1,lcase(tagBuff),"href")
    hrefIdx2=Instr(hrefIdx,lcase(tagBuff),"""")
    hrefIdx3=Instr(hrefIdx2,lcase(tagBuff),"""")
    arysplit(i)= Mid(tagBuff, hrefIdx2, hrefIdx3 - hrefIdx2) & arysplit(i)


May be I could translate it before ???

Werner

--------------090409040503010706090302 Content-Type: text/xml; name="StringTools.xml" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="StringTools.xml"

<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="9" zv="Cache for Windows NT (Intel/P4) 5.0.7 (Build 5000U)" 
ts="2004-07-13 22:28:33">
<Class name="String.Stack">
<ProcedureBlock>1</ProcedureBlock>
<Super>%RegisteredObject</Super>
<TimeChanged>59355,61377.221</TimeChanged>
<TimeCreated>59301,84810.494</TimeCreated>

<Property name="Array">
<Type>%ListOfDataTypes</Type>
<Private>1</Private>
</Property>

<Property name="Count">
<Type>%Integer</Type>
<Calculated>1</Calculated>
</Property>

<Property name="IsEmpty">
<Type>%Boolean</Type>
<Calculated>1</Calculated>
</Property>

<Method name="IsEmptyGet">
<Description>
Property Top As %String [ Calculated ];</Description>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
        
        q (..Array.Count()<1)
        

]]></Implementation>
</Method>

<Method name="CountGet">
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
        
        q ..Array.Count()
        

]]></Implementation>
</Method>

<Method name="Push">
<FormalSpec>Value:%String</FormalSpec>
<Implementation><![CDATA[
        
        d ..Array.Insert(Value)
        

]]></Implementation>
</Method>

<Method name="Pop">
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
        
        q ..Array.RemoveAt(..Array.Count())
        

]]></Implementation>
</Method>

<Method name="Top">
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
        
        q ..Array.GetAt(..Array.Count())
        

]]></Implementation>
</Method>

<Method name="ElementAt">
<FormalSpec>El:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
        
        q ..Array.GetAt(El)
        

]]></Implementation>
</Method>

<Method name="RemoveElementAt">
<FormalSpec>El:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
        
        q ..Array.RemoveAt(El)
        

]]></Implementation>
</Method>

<Method name="IsDefined">
<FormalSpec>El:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
        
        q (..Array.GetAt(El)'="")
        

]]></Implementation>
</Method>
</Class>
<Checksum value="1185460409"/>
</Export>

--------------090409040503010706090302--



Reply via email to