Re: [flexcoders] parsing complex xml

2008-05-27 Thread Josh McDonald
You should really be copying from your XML object into a flatter AS object
first - for binding and inline editing and whatnot as the XML objects
contain *much* voodoo that can bite you. But here's a quick example using a
datagrid rather than a list. As for updating and persisting the XML object,
that exercise is left to the reader ;-)


http://www.adobe.com/2006/mxml"; layout="absolute">


http://jakarta.apache.org/log4j/";
debug="false">


































On Wed, May 28, 2008 at 9:58 AM, Dennis Falling <[EMAIL PROTECTED]> wrote:

>   I was trying both routes- dataprovider and and iterating.
>
> dataProvider:
>
> function dataReceived(data:XML):void
> {
>list.dataProvider = data.configuration.category;
> }
>
> With the above, nothing showed up in the list.  The xml sample I provided
> in my original email was all wrapped by a con tag by the server.
>
> Iterating over it I tried:
>
> function dataReceived(data:XML):void
> {
>for (var category:XML in data.configuration.category)
>{
>   trace(category.toXMLString();
>}
> }
>
> The flex page that needs to render this will allow the user to configure
> each item, so I need a way to read and write to those items while still
> leaving the comments in tact.
>
> Thanks!
>
>
>
> On Tue, May 27, 2008 at 5:39 PM, Tracy Spratt <[EMAIL PROTECTED]>
> wrote:
>
>>I don't know if I have ever noticed this removal of comments, I'd need
>> to verify.
>>
>>
>>
>> To iterate over nodes, use an e4x expression to return an XMLList, then
>> use a for loop.  Or For Each, or For In.  The docs have some more detail and
>> examples.
>>
>>
>>
>> A list can also use XMLList as a dataProvider if you do not plan to
>> programmaticlly update the dataprovider.  If you do, simply wrap the XMLList
>> in an XMLListCollection.
>>
>>
>>
>> It looks like you will need to declare the default namespace, or use the
>> namespace::node in all e4x expressions.
>>
>>
>>
>> You've not shown any expressions, so I can't say what you're doing wrong.
>>
>>
>>
>> Tracy
>>
>>
>>  --
>>
>> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
>> Behalf Of *dfalling
>> *Sent:* Tuesday, May 27, 2008 6:10 PM
>> *To:* flexcoders@yahoogroups.com
>> *Subject:* [flexcoders] parsing complex xml
>>
>>
>>
>> I'm trying to parse a complex xml file (a log4j config file) and am
>> running into a number of problems:
>>
>> * Flex seems to remove all the comments from the file. Is there any
>> way to prevent this? I don't need access to them in Flex, but do want
>> them to be untouched.
>> * I have no idea how to iterate over the items or to set xml as a
>> list's data provider. The tag containing everything I need to access
>> is log4j:configuration, and when I try to access
>> xml.log4j::configuration flex complains about not having the property
>> log4j.
>>
>> If anyone knows of good xml tutorials that would help me to grasp this
>> better I'd really appreciate it. Most of the ones I've found are
>> basically the "hello world" of xml parsing...the few dealing with
>> namespaces do little to explain what they're doing.
>>
>> http://jakarta.apache.org/log4j/";
>> debug="false">
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>> .
>> .
>> .
>> 
>>
>> Thanks a lot!
>> -dennis
>>
>>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


Re: [flexcoders] parsing complex xml

2008-05-27 Thread Dennis Falling
I was trying both routes- dataprovider and and iterating.

dataProvider:

function dataReceived(data:XML):void
{
   list.dataProvider = data.configuration.category;
}

With the above, nothing showed up in the list.  The xml sample I provided in
my original email was all wrapped by a con tag by the server.

Iterating over it I tried:

function dataReceived(data:XML):void
{
   for (var category:XML in data.configuration.category)
   {
  trace(category.toXMLString();
   }
}

The flex page that needs to render this will allow the user to configure
each item, so I need a way to read and write to those items while still
leaving the comments in tact.

Thanks!


On Tue, May 27, 2008 at 5:39 PM, Tracy Spratt <[EMAIL PROTECTED]> wrote:

>I don't know if I have ever noticed this removal of comments, I'd need
> to verify.
>
>
>
> To iterate over nodes, use an e4x expression to return an XMLList, then use
> a for loop.  Or For Each, or For In.  The docs have some more detail and
> examples.
>
>
>
> A list can also use XMLList as a dataProvider if you do not plan to
> programmaticlly update the dataprovider.  If you do, simply wrap the XMLList
> in an XMLListCollection.
>
>
>
> It looks like you will need to declare the default namespace, or use the
> namespace::node in all e4x expressions.
>
>
>
> You've not shown any expressions, so I can't say what you're doing wrong.
>
>
>
> Tracy
>
>
>  --
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *dfalling
> *Sent:* Tuesday, May 27, 2008 6:10 PM
> *To:* flexcoders@yahoogroups.com
> *Subject:* [flexcoders] parsing complex xml
>
>
>
> I'm trying to parse a complex xml file (a log4j config file) and am
> running into a number of problems:
>
> * Flex seems to remove all the comments from the file. Is there any
> way to prevent this? I don't need access to them in Flex, but do want
> them to be untouched.
> * I have no idea how to iterate over the items or to set xml as a
> list's data provider. The tag containing everything I need to access
> is log4j:configuration, and when I try to access
> xml.log4j::configuration flex complains about not having the property
> log4j.
>
> If anyone knows of good xml tutorials that would help me to grasp this
> better I'd really appreciate it. Most of the ones I've found are
> basically the "hello world" of xml parsing...the few dealing with
> namespaces do little to explain what they're doing.
>
> http://jakarta.apache.org/log4j/";
> debug="false">
> 
> 
> 
>
> 
> 
> 
> 
>
> 
> 
> 
> 
>
> 
> 
> 
> 
> .
> .
> .
> 
>
> Thanks a lot!
> -dennis
>
>  
>


Re: [flexcoders] parsing complex xml

2008-05-27 Thread Dennis Falling
Yeah, I should have mentioned that the server sending this file to me is
wrapping it in con, making that the root and configuration the only element.

On Tue, May 27, 2008 at 6:34 PM, Josh McDonald <[EMAIL PROTECTED]> wrote:

>   Off the top of my head, If the root of your XML doc is ,
> you want xmlObject.category as a list of  elements, not
> xmlObject.configuration.category
>
> -J
>
>
> On Wed, May 28, 2008 at 8:09 AM, dfalling <[EMAIL PROTECTED]> wrote:
>
>>   I'm trying to parse a complex xml file (a log4j config file) and am
>> running into a number of problems:
>>
>> * Flex seems to remove all the comments from the file. Is there any
>> way to prevent this? I don't need access to them in Flex, but do want
>> them to be untouched.
>> * I have no idea how to iterate over the items or to set xml as a
>> list's data provider. The tag containing everything I need to access
>> is log4j:configuration, and when I try to access
>> xml.log4j::configuration flex complains about not having the property
>> log4j.
>>
>> If anyone knows of good xml tutorials that would help me to grasp this
>> better I'd really appreciate it. Most of the ones I've found are
>> basically the "hello world" of xml parsing...the few dealing with
>> namespaces do little to explain what they're doing.
>>
>> http://jakarta.apache.org/log4j/";
>> debug="false">
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>> .
>> .
>> .
>> 
>>
>> Thanks a lot!
>> -dennis
>>
>>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
> 
>


Re: [flexcoders] parsing complex xml

2008-05-27 Thread Josh McDonald
Off the top of my head, If the root of your XML doc is , you
want xmlObject.category as a list of  elements, not
xmlObject.configuration.category

-J

On Wed, May 28, 2008 at 8:09 AM, dfalling <[EMAIL PROTECTED]> wrote:

>   I'm trying to parse a complex xml file (a log4j config file) and am
> running into a number of problems:
>
> * Flex seems to remove all the comments from the file. Is there any
> way to prevent this? I don't need access to them in Flex, but do want
> them to be untouched.
> * I have no idea how to iterate over the items or to set xml as a
> list's data provider. The tag containing everything I need to access
> is log4j:configuration, and when I try to access
> xml.log4j::configuration flex complains about not having the property
> log4j.
>
> If anyone knows of good xml tutorials that would help me to grasp this
> better I'd really appreciate it. Most of the ones I've found are
> basically the "hello world" of xml parsing...the few dealing with
> namespaces do little to explain what they're doing.
>
> http://jakarta.apache.org/log4j/";
> debug="false">
> 
> 
> 
>
> 
> 
> 
> 
>
> 
> 
> 
> 
>
> 
> 
> 
> 
> .
> .
> .
> 
>
> Thanks a lot!
> -dennis
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


Re: [flexcoders] parsing complex xml

2008-05-27 Thread Maciek Sakrejda
XML.ignoreComments = false;
-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com

-Original Message-
From: dfalling <[EMAIL PROTECTED]>
Reply-To: flexcoders@yahoogroups.com
To: flexcoders@yahoogroups.com
Subject: [flexcoders] parsing complex xml
Date: Tue, 27 May 2008 22:09:41 -

I'm trying to parse a complex xml file (a log4j config file) and am
running into a number of problems:

* Flex seems to remove all the comments from the file. Is there any
way to prevent this? I don't need access to them in Flex, but do want
them to be untouched.
* I have no idea how to iterate over the items or to set xml as a
list's data provider. The tag containing everything I need to access
is log4j:configuration, and when I try to access
xml.log4j::configuration flex complains about not having the property
log4j.

If anyone knows of good xml tutorials that would help me to grasp this
better I'd really appreciate it. Most of the ones I've found are
basically the "hello world" of xml parsing...the few dealing with
namespaces do little to explain what they're doing.

http://jakarta.apache.org/log4j/";
debug="false">


















.
.
.


Thanks a lot!
-dennis




 




RE: [flexcoders] parsing complex xml

2008-05-27 Thread Tracy Spratt
I don't know if I have ever noticed this removal of comments, I'd need
to verify.

 

To iterate over nodes, use an e4x expression to return an XMLList, then
use a for loop.  Or For Each, or For In.  The docs have some more detail
and examples.

 

A list can also use XMLList as a dataProvider if you do not plan to
programmaticlly update the dataprovider.  If you do, simply wrap the
XMLList in an XMLListCollection.

 

It looks like you will need to declare the default namespace, or use the
namespace::node in all e4x expressions.

 

You've not shown any expressions, so I can't say what you're doing
wrong.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of dfalling
Sent: Tuesday, May 27, 2008 6:10 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] parsing complex xml

 

I'm trying to parse a complex xml file (a log4j config file) and am
running into a number of problems:

* Flex seems to remove all the comments from the file. Is there any
way to prevent this? I don't need access to them in Flex, but do want
them to be untouched.
* I have no idea how to iterate over the items or to set xml as a
list's data provider. The tag containing everything I need to access
is log4j:configuration, and when I try to access
xml.log4j::configuration flex complains about not having the property
log4j.

If anyone knows of good xml tutorials that would help me to grasp this
better I'd really appreciate it. Most of the ones I've found are
basically the "hello world" of xml parsing...the few dealing with
namespaces do little to explain what they're doing.

http://jakarta.apache.org/log4j/
<http://jakarta.apache.org/log4j/> "
debug="false">


















.
.
.


Thanks a lot!
-dennis

 



[flexcoders] parsing complex xml

2008-05-27 Thread dfalling
I'm trying to parse a complex xml file (a log4j config file) and am
running into a number of problems:

 * Flex seems to remove all the comments from the file.  Is there any
way to prevent this?  I don't need access to them in Flex, but do want
them to be untouched.
 * I have no idea how to iterate over the items or to set xml as a
list's data provider.  The tag containing everything I need to access
is log4j:configuration, and when I try to access
xml.log4j::configuration flex complains about not having the property
log4j.

If anyone knows of good xml tutorials that would help me to grasp this
better I'd really appreciate it.  Most of the ones I've found are
basically the "hello world" of xml parsing...the few dealing with
namespaces do little to explain what they're doing.

http://jakarta.apache.org/log4j/";
debug="false">
   
  
   

   
   
  
   

   
   
  
   

   
   
  
   
.
.
.


Thanks a lot!
-dennis