RE: [Flashcoders] XML and best method

2008-08-28 Thread Merrill, Jason
I think it depends on how much data there would be in one big file, and
how complex it would be loading in separate other files - how big each
of those would be. 

I would try and keep it all in one file if possible, but if it's a huge
amount of data, I would separate them and load them one at a time - you
could build a cool loader animation for them.  

Also, consider the content of the XML - if it's all related, makes sense
to have them in the same file, but if the XML server totally different
purposes, I think it can make sense to make the files separate.  For
example:

settings.xml --- application settings
media.xml  --application content
services.xml  --application web services

But then those are OK to all put in the same file too so it's both
an architecture performance question, and also a style question.  

Be careful of creating references in one XML to another, that can get
messy and buggy unless you do it right - doesn't mean it's bad, it just
depends on how you implement it.

Jason Merrill 
Bank of America 
Enterprise Technology  Global Risk LLD 
Instructional Technology  Media

Join the Bank of America Flash Platform Developer Community 

Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal  Innovative Learning Blog  subscribe. 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread Matt S.
Speaking from recent experience, lots of little XML files is ok if
you're accessing them one at a time, but if you need to pull up more
than one at a time, it can get slow quick. I had a project where I had
to load 5-10 small xmls (really small, just basic image galleries, 10
items max each), and it seemed like the initial process of loading the
XML files (load one, increment xml ID, load the next, etc) was the
lions share of the load time, so that when it was 10 xmls at once it
started to take annoyingly long (especially since that was then
followed by the actual images needing to be loaded). In the end we
compiled all the xmls into one big XML and loaded that up front. But
on other projects, when I was just loading single small xml files one
at a time, it wasnt a problem.

I would be curious though, my impression from that experience was that
alot of the load time on an XML file comes from that initial loading
of the file, not so much the stepping through the XML, is that
accurate? And is there any difference in load time between this:

image
   pathimageurl/path
   nameimagename.jpg/name
   width800/width
   height600/height
/image

vs this:

image path=imageurl name=imagename.jpg width=800 height=600 /

.m

On Thu, Aug 28, 2008 at 9:35 AM, Lehr, Theodore M (N-SGIS)
[EMAIL PROTECTED] wrote:
 I have a project that involves xml... I am wondering how I should
 organize my xml... would it be best (from a flash perspective) for it to
 be on huge xml file with lots and lots of children - or would I be
 better off breaking it into multiple xml files where one xml tag
 references another xml file and so on...

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread allandt bik-elliott (thefieldcomic.com)
yes the second one is shorter :)

i try to keep child nodes to a minimum - 1 per 'object' and only really use
them when describing one of several same-level objects

On Thu, Aug 28, 2008 at 2:58 PM, Matt S. [EMAIL PROTECTED] wrote:

 Speaking from recent experience, lots of little XML files is ok if
 you're accessing them one at a time, but if you need to pull up more
 than one at a time, it can get slow quick. I had a project where I had
 to load 5-10 small xmls (really small, just basic image galleries, 10
 items max each), and it seemed like the initial process of loading the
 XML files (load one, increment xml ID, load the next, etc) was the
 lions share of the load time, so that when it was 10 xmls at once it
 started to take annoyingly long (especially since that was then
 followed by the actual images needing to be loaded). In the end we
 compiled all the xmls into one big XML and loaded that up front. But
 on other projects, when I was just loading single small xml files one
 at a time, it wasnt a problem.

 I would be curious though, my impression from that experience was that
 alot of the load time on an XML file comes from that initial loading
 of the file, not so much the stepping through the XML, is that
 accurate? And is there any difference in load time between this:

 image
   pathimageurl/path
   nameimagename.jpg/name
   width800/width
   height600/height
 /image

 vs this:

 image path=imageurl name=imagename.jpg width=800 height=600 /

 .m

 On Thu, Aug 28, 2008 at 9:35 AM, Lehr, Theodore M (N-SGIS)
 [EMAIL PROTECTED] wrote:
  I have a project that involves xml... I am wondering how I should
  organize my xml... would it be best (from a flash perspective) for it to
  be on huge xml file with lots and lots of children - or would I be
  better off breaking it into multiple xml files where one xml tag
  references another xml file and so on...
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread alpha
 I have a project that involves xml... I am wondering how I should
 organize my xml... would it be best (from a flash perspective) for it to
 be on huge xml file with lots and lots of children - or would I be
 better off breaking it into multiple xml files where one xml tag
 references another xml file and so on...

There is no hard and fast answer. My personal preference is to have fewer
XML files--one is ideal, because then you only have one to download. And
XML files are just text, so it typically takes less time than a single
audio file. If you're using AS3, you can use the XML and XMLList classes
to break the file into manageable chunks. It's very fast.

It depends on how big the file is, though. If it's really huge and
complex, it can be cumbersome to maintain, and difficult for the next
programmer to grok.

It's your call ^_^

Cordially,

Kerry Thompson

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread Matt S.
Thanks. Do you know if the difference is dramatic?  Just curious,
especially since most experts eg Moock's books dont shy away from
node-heavy XML generally, but if there are serious performance
considerations you'd think they would.

.m

On Thu, Aug 28, 2008 at 10:27 AM, allandt bik-elliott
(thefieldcomic.com) [EMAIL PROTECTED] wrote:
 yes the second one is shorter :)

 i try to keep child nodes to a minimum - 1 per 'object' and only really use
 them when describing one of several same-level objects

 On Thu, Aug 28, 2008 at 2:58 PM, Matt S. [EMAIL PROTECTED] wrote:

 Speaking from recent experience, lots of little XML files is ok if
 you're accessing them one at a time, but if you need to pull up more
 than one at a time, it can get slow quick. I had a project where I had
 to load 5-10 small xmls (really small, just basic image galleries, 10
 items max each), and it seemed like the initial process of loading the
 XML files (load one, increment xml ID, load the next, etc) was the
 lions share of the load time, so that when it was 10 xmls at once it
 started to take annoyingly long (especially since that was then
 followed by the actual images needing to be loaded). In the end we
 compiled all the xmls into one big XML and loaded that up front. But
 on other projects, when I was just loading single small xml files one
 at a time, it wasnt a problem.

 I would be curious though, my impression from that experience was that
 alot of the load time on an XML file comes from that initial loading
 of the file, not so much the stepping through the XML, is that
 accurate? And is there any difference in load time between this:

 image
   pathimageurl/path
   nameimagename.jpg/name
   width800/width
   height600/height
 /image

 vs this:

 image path=imageurl name=imagename.jpg width=800 height=600 /

 .m

 On Thu, Aug 28, 2008 at 9:35 AM, Lehr, Theodore M (N-SGIS)
 [EMAIL PROTECTED] wrote:
  I have a project that involves xml... I am wondering how I should
  organize my xml... would it be best (from a flash perspective) for it to
  be on huge xml file with lots and lots of children - or would I be
  better off breaking it into multiple xml files where one xml tag
  references another xml file and so on...
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread allandt bik-elliott (thefieldcomic.com)
there might be - for loops are a pretty slow way of accessing an array for
instance (although they look lovely and keep things neat) - it's actually
faster to add each node of an array manually so in theory, the fewer times
the app has to loop through large nests of xml (similar process), the
better.

for really large xml files, i suppose the extra file weight of the extra
verbosity (is that a word?) of a heavy nest over one that makes more use of
attributes might make a difference in load times as well although i think
it'd have to be a seriously large file (or for a seriously slow connection)
to really be a consideration

that said, i would use a child node for large amounts of text / data - you
wouldn't put a whole paragraph into an attribute, for instance. Nor would
you want to put html formatted text into an attribute (i don't even think
you can?)

so:

?xml version=1.0 encoding=UTF-8?
trainupdate result=success currtime=1219755890344
targettime=122002920 distance=180 weather=rain winddir=45
windspeed=18
train position=26 speed=40 departing=Departing 1pm
stoptext=Leaves on line /
Here is a paragraph of copy describing the function and focus of the
train in question. I could go on like this for hours. Would you like me to?
/train
train position=65 speed=60 departing=Departing 3pm
stoptext=Signal failure /
Not as much but we're following a precedent
/train
/trainupdate


On Thu, Aug 28, 2008 at 6:05 PM, Matt S. [EMAIL PROTECTED] wrote:

 Thanks. Do you know if the difference is dramatic?  Just curious,
 especially since most experts eg Moock's books dont shy away from
 node-heavy XML generally, but if there are serious performance
 considerations you'd think they would.

 .m

 On Thu, Aug 28, 2008 at 10:27 AM, allandt bik-elliott
 (thefieldcomic.com) [EMAIL PROTECTED] wrote:
  yes the second one is shorter :)
 
  i try to keep child nodes to a minimum - 1 per 'object' and only really
 use
  them when describing one of several same-level objects
 
  On Thu, Aug 28, 2008 at 2:58 PM, Matt S. [EMAIL PROTECTED] wrote:
 
  Speaking from recent experience, lots of little XML files is ok if
  you're accessing them one at a time, but if you need to pull up more
  than one at a time, it can get slow quick. I had a project where I had
  to load 5-10 small xmls (really small, just basic image galleries, 10
  items max each), and it seemed like the initial process of loading the
  XML files (load one, increment xml ID, load the next, etc) was the
  lions share of the load time, so that when it was 10 xmls at once it
  started to take annoyingly long (especially since that was then
  followed by the actual images needing to be loaded). In the end we
  compiled all the xmls into one big XML and loaded that up front. But
  on other projects, when I was just loading single small xml files one
  at a time, it wasnt a problem.
 
  I would be curious though, my impression from that experience was that
  alot of the load time on an XML file comes from that initial loading
  of the file, not so much the stepping through the XML, is that
  accurate? And is there any difference in load time between this:
 
  image
pathimageurl/path
nameimagename.jpg/name
width800/width
height600/height
  /image
 
  vs this:
 
  image path=imageurl name=imagename.jpg width=800 height=600 /
 
  .m
 
  On Thu, Aug 28, 2008 at 9:35 AM, Lehr, Theodore M (N-SGIS)
  [EMAIL PROTECTED] wrote:
   I have a project that involves xml... I am wondering how I should
   organize my xml... would it be best (from a flash perspective) for it
 to
   be on huge xml file with lots and lots of children - or would I be
   better off breaking it into multiple xml files where one xml tag
   references another xml file and so on...
  
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread alpha
 Thanks. Do you know if the difference is dramatic?  Just curious,
 especially since most experts eg Moock's books dont shy away from
 node-heavy XML generally, but if there are serious performance
 considerations you'd think they would.

I don't think the difference is dramatic. It may be noticeable in a very
large XML file, but not dramatic.

The thing to remember is that, while the XML classes are in machine
language, and very efficient, you are parsing text, which is always
inefficient. If performance is an issue, you want as little text (XML) as
possible. The XML classes may be doing something under the hood to
optimize that, but there's no getting away from the fact that accessing
XML involves parsing text.

The books on Flash may not be the best references for XML. They are
oriented to teaching you ActionScript, and their XML structures are often
driven more by what they are teaching than by XML best practices.

If you really want to learn about preferred styles, and things like
advantages of attributes vs. child nodes, I'd pick up a book specifically
on XML. I'm afraid I can't recommend one--I've been doing XML so long I've
lost touch with the references--but I'm sure some people here or over on
Flash_Tiger can recommend good XML references.

Cordially,

Kerry Thompson

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] XML and best method

2008-08-28 Thread Matt S.
On Thu, Aug 28, 2008 at 1:25 PM, allandt bik-elliott
(thefieldcomic.com) [EMAIL PROTECTED] wrote:

 that said, i would use a child node for large amounts of text / data - you
 wouldn't put a whole paragraph into an attribute, for instance. Nor would
 you want to put html formatted text into an attribute (i don't even think
 you can?)

When we need to pass in html text via an xml attribute we use
urlencoded text, which works pretty well.

.m
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders