Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Marco Plaza
  Where is Marco Plaza?
 Caracas
 Venezuela
 Marco Plaza
 To: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 Tags
Subject: RE: XML to Table
Thread ID: 393923 Message ID: 393948 # Views: 46 # Ratings: 4
Version: Visual FoxPro 9 SP2 Category: XML
Date: Thursday, December 26, 2013 11:12:11 PM         
   


> >
> > You're getting an attribute based Xml.
> >
> > Try:
> >
> >
> >
> > 
> > text to cxml noshow
> > 
> > <xml name="getSendState" result="1">
> > 	<Item id="1" msgid="25021441091787400" mobile="19901764418" result="2" return="DELIVRD"/>
> > 	<Item id="2" msgid="25021441091787401" mobile="18901754419" result="1" return="DTBLACK"/>
> > 	<Item id="3" msgid="25021441091787402" mobile="18904754419" result="1" return="ACCEPTD"/>
> > 	<Item id="4" msgid="25021441091787403" mobile="18903754419" result="1" return="REJECTD"/>
> > 	<Item id="5" msgid="25021441091787404" mobile="18902754419" result="1" return="DELETED"/>
> > </xml>
> > 
> > endtext
> > 
> > k = createobject('MSxml.DOMDOCUMENT')
> > k.LoadXML(cxml)
> > xmltocursor(K.selectNodes('/xml').item(0).xml,'messages')
> > browse
> > 
> > 

>
> Fine, except all the msgid are the sam!

> Id Msgid Mobile Result Return
> 1 25021441091787400 19901764418 2 DELIVRD
> 2 25021441091787400 18901754419 1 DTBLACK
> 3 25021441091787400 18904754419 1 ACCEPTD
> 4 25021441091787400 18903754419 1 REJECTD
> 5 25021441091787400 18902754419 1 DELETED

> -Anders


Strange behaviour indeed, but can be solved easily:



text to cxml noshow

<xml name="getSendState" result="1">
	<Item id="1" msgid="25021441091787400" mobile="19901764418" result="2" return="DELIVRD"/>
	<Item id="2" msgid="25021441091787401" mobile="18901754419" result="1" return="DTBLACK"/>
	<Item id="3" msgid="25021441091787402" mobile="18904754419" result="1" return="ACCEPTD"/>
	<Item id="4" msgid="25021441091787403" mobile="18903754419" result="1" return="REJECTD"/>
	<Item id="5" msgid="25021441091787404" mobile="18902754419" result="1" return="DELETED"/>
</xml>

endtext

k = createobject('MSxml.DOMDOCUMENT')
k.LoadXML(cxml)
create cursor messages ( id c(1), msgid c(17), mobile c(11), result c(1) , return c(7)) 
xmltocursor(K.selectNodes('/xml').item(0).xml,'messages',8192)
browse



ENTIRE THREAD

XML to Table Posted by michael johnson @ 12/26/2013 11:36:58 AM
RE: XML to Table Posted by Tore Bleken @ 12/26/2013 11:50:00 AM
RE: XML to Table Posted by michael johnson @ 12/26/2013 12:04:51 PM
RE: XML to Table Posted by Tore Bleken @ 12/26/2013 12:16:54 PM
RE: XML to Table Posted by Russell Hill @ 12/27/2013 4:02:48 AM
RE: XML to Table Posted by Marco Plaza @ 12/26/2013 2:54:43 PM
RE: XML to Table Posted by Anders Altberg @ 12/26/2013 4:22:30 PM
RE: XML to Table Posted by Marco Plaza @ 12/26/2013 11:12:11 PM
RE: XML to Table Posted by Cetin Basoz @ 12/27/2013 10:33:44 AM
RE: XML to Table Posted by Marco Plaza @ 12/27/2013 3:36:18 PM