• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help parsing XML file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help parsing XML file


  • Subject: Re: Help parsing XML file
  • From: Rainer Standke <email@hidden>
  • Date: Fri, 7 Mar 2008 15:27:42 -0800

It seems to have to do with how the open tags are formed. This one asks for all tags that start with ROW and have children with names starting with ValueColor:

set x to XMLXPath the_root with "*[starts-with(name(),'ROW')]/*[starts- with(name(),'ValueColor')]"

--> {"Process", "Process", "Process", "Process", "150", "150", "150", "150", "Yellow", "Magenta", "Cyan", "Black"}

I guess you might want to look into finessing the XPath request so that it yields what you are looking for. It's a lot deeper and more powerful than I used to think for a long time. Probably still is...

Rainer

On Mar 7, 2008, at 14:39 , Jim Skibbie wrote:

My problem is that the XPath function doesn't seem to respond correctly with
an XMLReference. I don't get a reference, therefore I can't turn the
reference into text.


I can get my XML parser in TextMate to give me the correct result using the
XPath /FMPDSORESULT/ROW/ValueColor01 but I can't get the XMLLib to respond
in kind.


Jim

Try this:

set x to XMLGetText (the_root with "/FMPDSORESULT/ROW/ValueColor01")

In your code the x yielded an XMLReference which I understand to be a
pointer to a tag in an XML file. You need XMLGetText to retrieve the
'content' of the tags.

You could also just add this to your script:

set y to XMLGetText x

I have tried none of this myself, but it should work anyway ;-)

Rainer

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Help parsing XML file
      • From: Jim Skibbie <email@hidden>
References: 
 >Re: Help parsing XML file (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Re: Help parsing XML file
  • Next by Date: Re: Help parsing XML file
  • Previous by thread: Re: Help parsing XML file
  • Next by thread: Re: Help parsing XML file
  • Index(es):
    • Date
    • Thread