Hi Tim,

        I am using DOM GET XML ELEMENT VALUE and & is not being converted. 
I have declared the value parameter as text and I was surprised that the 
character refs were not being converted…


C_OBJECT($categoryObject)
WEB SERVICE GET RESULT($blob;"XMLOut";*)
$resRoot:=DOM Parse XML variable($blob)
$categoriesRef:=DOM Find XML 
element($resRoot;"/GetCategoriesResponse/GetCategoriesResult/Categories")
$categoryRef:=DOM Get first child XML element($categoriesRef)
DOM GET XML ELEMENT NAME($categoryRef;$name)
While (OK=1)
        $categoryElementRef:=DOM Get first child XML element($categoryRef)
        While (OK=1)
                DOM GET XML ELEMENT NAME($categoryElementRef;$name)
                DOM GET XML ELEMENT VALUE($categoryElementRef;$value)
                OB SET($categoryObject;$name;$value)  //$value contains & 
not &
                $categoryElementRef:=DOM Get next sibling XML 
element($categoryElementRef)

        End while 

                //code to populate a database record with the object values

        $CategoryRef:=DOM Get next sibling XML element($CategoryRef)
        OB_EmptyObject ($categoryObject)

End While

John

 
> On Dec 8, 2016, at 8:07 AM, Timothy Tse <t...@4d.com> wrote:
> 
> Hi John,
> 
> Have you tried using the command DOM GET XML ELEMENT VALUE?
> http://doc.4d.com/4Dv15R5/4D/15-R5/DOM-GET-XML-ELEMENT-VALUE.301-2937609.en.html
> 
> For example:
> $xml: “<xml>Test&amp;</xml>
> $ref:=DOM Parse XML Variable($xml)
> DOM GET XML ELEMENT VALUE($ref;$val)
> 
> $val returns “Text&"
> 
> On Dec 4, 2016, at 9:14 PM, John Baughman 
> <john...@hawaii.rr.com<mailto:john...@hawaii.rr.com>> wrote:
> 
> I thought there was a command to convert text containing character refs…  
> &amp; -> &
> 
> Could swear I used a 4D command for this in the past. Am  I having a brain 
> fart?
> 
> I have XML response from a web service containing character refs. I am using 
> WEB SERVICE GET RESULT($blob;"XMLOut";*) and parsing the XML with XML DOM. 
> Isn’t there an easy way to clean up the XML?
> 
> John
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to