RE: [Flashcoders] xpath / xpath4as2 beginners question

2006-02-02 Thread Merrill, Jason
Try:

XPath.selectNodes(this,product/products/text());

Instead.  What does your XML look like?

For the above to work, it would have to be:

product
product
Hi there.
/product
/product

However, not a good idea to have a child node be the same name as the
parent node (though it's OK in the sense it that won't screw up Xpath).

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Kent Humphrey
Sent: Thursday, February 02, 2006 10:20 AM
To: Flashcoders mailing list
Subject: [Flashcoders] xpath / xpath4as2 beginners question

I'm trying to figure out how to use xfactorstudios xpath4as2 class,
but I can't seem to get over the first hurdle! Can anyone tell me why
this isn't working?

import com.xfactorstudio.xml.xpath.*;

myDoc = new XML();
myDoc.onLoad = function(){
  var products = XPath.selectNodes(this,/product/products);
  trace(Products: +products);
  trace(this);
}
myDoc.load(../xml/test.xml);

The above code is from the xfactostudios site (http://
www.xfactorstudio.com/ActionScript/AS2/XPath/) and the xml file I am
loading is also from that page. What I have added is the two trace()
statements to see if things are working.

The first trace doesn't give me anything, but the second shows the
whole xml file, so I know that at least the load is working.

I have the class files located in Mac HD/Users/Username/Library/
Application Support/Macromedia/Flash 8/en/Configuration/Classes/com/
xfactorstudio/xml/xpath/ - that's correct isn't it?

Any ideas? And does anyone know some good tutorials for this class?

Thanks.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] xpath / xpath4as2 beginners question

2006-02-02 Thread Kent Humphrey


On 2 Feb 2006, at 15:48, Merrill, Jason wrote:


However, not a good idea to have a child node be the same name as the
parent node (though it's OK in the sense it that won't screw up  
Xpath).


Would you believe my problem was I had product/products instead of  
product/products ?!


Sheesh...

Thanks for the help.

Can I have some general XML help too please? : Does this XML file  
make sense, is it well formed?


root
clients
client name=Borgo di Colleoli
sectorProperty/sector
disciplineDirect Mail/discipline
disciplineAdvertising/discipline
/client
client name=Royal Bank of Scotland
sectorFinance/sector
disciplineInteractive Design/discipline
disciplineStrategy/discipline
/client
/clients
sectors
sector name=Property
clientBorgo di Colleoli/client
disciplineDirect Mail/discipline
disciplineAdvertising/discipline
disciplineChannel and Sales/discipline
disciplineInteractive Design/discipline
/sector
/sectors
disciplines
discipline name=Direct Mail
sectorProperty/sector
clientBorgo di Colleoli/client
/discipline
/disciplines
/root

I know I'm in danger of repeating my first mistake by doing something  
like client/clients instead of clients/client - but I can't think of  
another way to organise it.


Observant readers may recognise this as an xml sample of my matrix/ 
relationships questions from a few days ago :

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


RE: [Flashcoders] xpath / xpath4as2 beginners question

2006-02-02 Thread Merrill, Jason
It's well formed, sure, but I would do it like this instead - make heavy
use of attributes - as much as possible for speed, relationships, and
readability, something like this:

root
clients
client name=Borgo di Colleoli sector=Property
discipline name=Direct Mail/
discipline name=Advertising/
/client
client name=Royal Bank of Scotland sector=Finance
discipline name=Interactive Design/
discipline name=Strategy/
/client
/clients
sectors
sector name=Property client=Borgo di Colleoli
discipline name=Direct Mail/
discipline name=Advertising/
discipline name=Channel and Sales/
discipline name=Interactive Design/
/sector
/sectors
disciplines
discipline name=Direct Mail sector=Property
client=Borgo di Colleoli/
/disciplines
/root

Preferrably if you could find a way to work this, you could also maybe
just do this to reduce redundancy:

root
clients
client name=Borgo di Colleoli sector=Property
discipline name=Direct Mail/
discipline name=Advertising/
/client
client name=Royal Bank of Scotland sector=Finance
discipline name=Interactive Design/
discipline name=Strategy/
/client
/clients
..add more here
/root

...and then make some use of XPath's search features to find the
opposite relationships - i.e. sector to client, discipline to sector,
etc. - though I haven't used it yet so wouldn't have an example to share



Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Kent Humphrey
Sent: Thursday, February 02, 2006 12:01 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] xpath / xpath4as2 beginners question


On 2 Feb 2006, at 15:48, Merrill, Jason wrote:

 However, not a good idea to have a child node be the same name as
the
 parent node (though it's OK in the sense it that won't screw up
 Xpath).

Would you believe my problem was I had product/products instead of
product/products ?!

Sheesh...

Thanks for the help.

Can I have some general XML help too please? : Does this XML file
make sense, is it well formed?

root
  clients
  client name=Borgo di Colleoli
  sectorProperty/sector
  disciplineDirect Mail/discipline
  disciplineAdvertising/discipline
  /client
  client name=Royal Bank of Scotland
  sectorFinance/sector
  disciplineInteractive Design/discipline
  disciplineStrategy/discipline
  /client
  /clients
  sectors
  sector name=Property
  clientBorgo di Colleoli/client
  disciplineDirect Mail/discipline
  disciplineAdvertising/discipline
  disciplineChannel and Sales/discipline
  disciplineInteractive Design/discipline
  /sector
  /sectors
  disciplines
  discipline name=Direct Mail
  sectorProperty/sector
  clientBorgo di Colleoli/client
  /discipline
  /disciplines
/root

I know I'm in danger of repeating my first mistake by doing something
like client/clients instead of clients/client - but I can't think of
another way to organise it.

Observant readers may recognise this as an xml sample of my matrix/
relationships questions from a few days ago :
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] xpath / xpath4as2 beginners question

2006-02-02 Thread Chris Kennon

Hi,

After reading this article, I'm confused why client name does not  
merit an element?

(http://www-128.ibm.com/developerworks/xml/library/x-eleatt.html)


On Feb 2, 2006, at 10:00 AM, Merrill, Jason wrote:

It's well formed, sure, but I would do it like this instead - make  
heavy

use of attributes - as much as possible for speed, relationships, and
readability, something like this:

root
clients
client name=Borgo di Colleoli sector=Property
discipline name=Direct Mail/
discipline name=Advertising/
/client
client name=Royal Bank of Scotland sector=Finance
discipline name=Interactive Design/
discipline name=Strategy/
/client
/clients
sectors
sector name=Property client=Borgo di Colleoli
discipline name=Direct Mail/
discipline name=Advertising/
discipline name=Channel and Sales/
discipline name=Interactive Design/
/sector
/sectors
disciplines
discipline name=Direct Mail sector=Property
client=Borgo di Colleoli/
/disciplines
/root

Preferrably if you could find a way to work this, you could also maybe
just do this to reduce redundancy:

root
clients
client name=Borgo di Colleoli sector=Property
discipline name=Direct Mail/
discipline name=Advertising/
/client
client name=Royal Bank of Scotland sector=Finance
discipline name=Interactive Design/
discipline name=Strategy/
/client
/clients
..add more here
/root

...and then make some use of XPath's search features to find the
opposite relationships - i.e. sector to client, discipline to sector,
etc. - though I haven't used it yet so wouldn't have an example to  
share




Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com











-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Kent Humphrey
Sent: Thursday, February 02, 2006 12:01 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] xpath / xpath4as2 beginners question


On 2 Feb 2006, at 15:48, Merrill, Jason wrote:


However, not a good idea to have a child node be the same name as

the

parent node (though it's OK in the sense it that won't screw up
Xpath).


Would you believe my problem was I had product/products instead of
product/products ?!

Sheesh...

Thanks for the help.

Can I have some general XML help too please? : Does this XML file
make sense, is it well formed?

root
clients
client name=Borgo di Colleoli
sectorProperty/sector
disciplineDirect Mail/discipline
disciplineAdvertising/discipline
/client
client name=Royal Bank of Scotland
sectorFinance/sector
disciplineInteractive Design/discipline
disciplineStrategy/discipline
/client
/clients
sectors
sector name=Property
clientBorgo di Colleoli/client
disciplineDirect Mail/discipline
disciplineAdvertising/discipline
disciplineChannel and Sales/discipline
disciplineInteractive Design/discipline
/sector
/sectors
disciplines
discipline name=Direct Mail
sectorProperty/sector
clientBorgo di Colleoli/client
/discipline
/disciplines
/root

I know I'm in danger of repeating my first mistake by doing  
something

like client/clients instead of clients/client - but I can't think of
another way to organise it.

Observant readers may recognise this as an xml sample of my matrix/
relationships questions from a few days ago :
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

NOTICE:
This message is for the designated recipient only and may contain  
privileged or confidential information. If you have received it in  
error, please notify the sender immediately and delete the  
original. Any other use of this e-mail by you is prohibited.

___
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] xpath / xpath4as2 beginners question

2006-02-02 Thread Merrill, Jason
Ha  - screw that article, M$ ain't the gods you know.  IMO it's
preference - I like elements for speed and what I think is readability.
You'll see in mxml, coldFusion, etc. even Micosoft's new xaml, that
attribute driven XML is the preferred method.  

However, if bloating an XML file with a bunch of nodes is your preferred
method, there's not a whole lot wrong with that either... in  a way.
Whatever works.  If you are working with a Huge app and other peeps,
then yeah, you'll need to standardize.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Chris Kennon
Sent: Thursday, February 02, 2006 2:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] xpath / xpath4as2 beginners question

Hi,

After reading this article, I'm confused why client name does not
merit an element?
(http://www-128.ibm.com/developerworks/xml/library/x-eleatt.html)


On Feb 2, 2006, at 10:00 AM, Merrill, Jason wrote:

 It's well formed, sure, but I would do it like this instead - make
 heavy
 use of attributes - as much as possible for speed, relationships,
and
 readability, something like this:

 root
 clients
 client name=Borgo di Colleoli sector=Property
 discipline name=Direct Mail/
 discipline name=Advertising/
 /client
 client name=Royal Bank of Scotland sector=Finance
 discipline name=Interactive Design/
 discipline name=Strategy/
 /client
 /clients
 sectors
 sector name=Property client=Borgo di Colleoli
 discipline name=Direct Mail/
 discipline name=Advertising/
 discipline name=Channel and Sales/
 discipline name=Interactive Design/
 /sector
 /sectors
 disciplines
 discipline name=Direct Mail sector=Property
 client=Borgo di Colleoli/
 /disciplines
 /root

 Preferrably if you could find a way to work this, you could also
maybe
 just do this to reduce redundancy:

 root
 clients
 client name=Borgo di Colleoli sector=Property
 discipline name=Direct Mail/
 discipline name=Advertising/
 /client
 client name=Royal Bank of Scotland sector=Finance
 discipline name=Interactive Design/
 discipline name=Strategy/
 /client
 /clients
 ..add more here
 /root

 ...and then make some use of XPath's search features to find the
 opposite relationships - i.e. sector to client, discipline to
sector,
 etc. - though I haven't used it yet so wouldn't have an example to
 share



 Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of Kent Humphrey
 Sent: Thursday, February 02, 2006 12:01 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] xpath / xpath4as2 beginners question


 On 2 Feb 2006, at 15:48, Merrill, Jason wrote:

 However, not a good idea to have a child node be the same name as
 the
 parent node (though it's OK in the sense it that won't screw up
 Xpath).

 Would you believe my problem was I had product/products instead of
 product/products ?!

 Sheesh...

 Thanks for the help.

 Can I have some general XML help too please? : Does this XML file
 make sense, is it well formed?

 root
   clients
   client name=Borgo di Colleoli
   sectorProperty/sector
   disciplineDirect Mail/discipline
   disciplineAdvertising/discipline
   /client
   client name=Royal Bank of Scotland
   sectorFinance/sector
   disciplineInteractive Design/discipline
   disciplineStrategy/discipline
   /client
   /clients
   sectors
   sector name=Property
   clientBorgo di Colleoli/client
   disciplineDirect Mail/discipline
   disciplineAdvertising/discipline
   disciplineChannel and Sales/discipline
   disciplineInteractive Design/discipline
   /sector
   /sectors
   disciplines
   discipline name=Direct Mail
   sectorProperty/sector
   clientBorgo di Colleoli/client
   /discipline
   /disciplines
 /root

 I know I'm in danger of repeating my first mistake by doing
 something
 like client/clients instead of clients/client - but I can't think
of
 another way to organise it.

 Observant readers may recognise this as an xml sample of my
matrix/
 relationships questions from a few days ago :
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com

RE: [Flashcoders] xpath / xpath4as2 beginners question

2006-02-02 Thread Merrill, Jason
Xpath is quick enough to read it directly each time.  It's what I like
about it. 

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Kent Humphrey
Sent: Thursday, February 02, 2006 5:36 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] xpath / xpath4as2 beginners question

Merrill, Jason wrote:
 It's well formed, sure, but I would do it like this instead - make
heavy
 use of attributes - as much as possible for speed, relationships,
and
 readability, something like this:

 Preferrably if you could find a way to work this, you could also
maybe
 just do this to reduce redundancy:

 root
 clients
 client name=Borgo di Colleoli sector=Property
 discipline name=Direct Mail/
 discipline name=Advertising/
 /client
 client name=Royal Bank of Scotland sector=Finance
 discipline name=Interactive Design/
 discipline name=Strategy/
 /client
 /clients
 ..add more here
 /root

 ...and then make some use of XPath's search features to find the
 opposite relationships - i.e. sector to client, discipline to
sector,
 etc. - though I haven't used it yet so wouldn't have an example to
share

Thanks for that. Unfortunately I don't think I'm going to be able to
use
attributes for anything more than names, because a client may exist
inside
multiple sectors I believe.

I was hoping I could cut down on the redundancy, so I'll certainly
look into
traversing the tree in both directions with XPath.

I did wonder if using attributes more than text inside nodes made more
sense

 After reading this article, I'm confused why client name does not
merit an
element?

I don't know the rules - or even if there ARE rules - but my reasoning
was that
the name attribute was part of the client, but the others were
separate but
belonged to the client. Just my logic.

Another question, would I be better off parsing all my relationships
into
associative arrays (like they are hardcoded now) on start up, or is
XPath quick
enough that I could read it directly each time?
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders