I just ran into a similar probem and it was for some reason do to the namespace on the xml document. I was trying to work with spreadSheetXML (Microsoft XML schema for Excel), needless to say it was a complex XML doc. I had to do loops on the child, check the name() agains the fully_qualified_schema::name
 
eg: if(item.name() == 'urn:schemas-microsoft-com:office:spreadsheet::@data')
 
 
Below is my complete short example of how I'm parsing through XML. What I'm doing is using a template to re-build XML with dynamic data... (I'm guessing there's a way to do xml translations via xslt but, I have no idea how... so don't take this example to heart as in what I'm doing, this is just shows parsing at least...)
 

public function parseXMLTemplates(): void {
  parseChildren(templateXML.children());
}
public function parseChildren(xmlChild:XMLList):void {
  var dataXML:XML =
  <test>
   <data>DATA_SECTION</data>
  </test>;
  if(xmlChild.length()) {
    for each(var item:XML in xmlChild) {
      if(item!=='') {
        if(item.name() == 'urn:schemas-microsoft-com:office:spreadsheet::@data') {
          item.parent().replace(item.name(), dataXML);
        }
      }
  }
  if(xmlChild.children().length())
    parseChildren(xmlChild.children());
  }
}

 

 
On 7/27/06, junhufr <[EMAIL PROTECTED]> wrote:

Sorry for the mistake, actually, I couldn't retrive the "companyA"
child by using .child("companyA") method.



--- In [email protected], "junhufr" <[EMAIL PROTECTED]> wrote:
>
> I've tried to convert a remote XML such as "client.xml" to a self
> defined client class, but failed.
>
> <clientList>
> <companyA>
> <client>
> <name>Tom</name>
> </client>
> <client>
> <name>Jerry</name>
> </client>
> </companyA>
>
> <companyB>
> <client>
> <name>Jean</name>
> </client>
> <client>
> <name>Philip</name>
> </client>
> </companyB>
> </clientList>
> 1. I invoked the XML from HTTPService
> 2. Then I could get the child "companyA" from the object that i
> invoked for HTTPService by using .child("companyA") method.
>
>
> Any helps will be appreicated.
>
> Jun
>


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to