• 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: XMLNextSibling is there an easier way
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XMLNextSibling is there an easier way


  • Subject: Re: XMLNextSibling is there an easier way
  • From: Axel Luttgens <email@hidden>
  • Date: Fri, 2 May 2008 13:24:05 +0200

Le 1 mai 08 à 18:21, Jim Skibbie a écrit :

Thanks for the advice. I wasn’t aware of the bypassing namespace option. It makes it a lot cleaner.


Hello Jim,

Your question made me remember that I never paid very much attention to the XML Suite of System Events; this was thus the opportunity to experiment with it and to check whether it could be somewhat relevant.

As it was to be expected, XML Suite appears much more verbose than a specialized XML tool.
On the other hand, it doesn't seem to care of namespaces and, surprisingly, allows to make queries such as the one you were interested in without looping too:


tell application "System Events" to set theThingYouReLookingFor to value of XML element "Value" of first item of (XML elements of XML element "FMPDSORESULT" of XML file "~/Desktop/test.xml" whose (name is "ROW") and ((XML elements whose name is "IDNoSetItemParent" and value is "6353368") is not {})) -- [1]

Of course, the above assumes that IDNoSetItemParent uniquely identifies a ROW, otherwise the "first item of..." part doesn't make very much sense.
Moreover, should the ROW be non existing, the variable theThingYouReLookingFor just seems to be unset, no error being raised...


Axel,
Slightly digressing.


[1] According to your various posts, file test.xml contains:

<?xml version="1.0" encoding="UTF-8"?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult";>
    <ROW MODID="0" RECORDID="13381415"/>
    <ROW MODID="1" RECORDID="13381416"/>
    <ROW MODID="1" RECORDID="13381417">
        <FieldLabel>VAR Program #</FieldLabel>
        <IDNoCustomField>6353376</IDNoCustomField>
        <IDNoCustomFieldLabel/>
        <IDNoJob>021521</IDNoJob>
        <IDNoLocation>3007</IDNoLocation>
        <IDNoSet/>
        <IDNoSetItemParent>6353368</IDNoSetItemParent>
        <ItemLetter>A</ItemLetter>
        <SortOrder>6.5</SortOrder>
        <Value>VARnumber</Value>
    </ROW>
</FMPDSORESULT>

_______________________________________________
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
References: 
 >Re: XMLNextSibling is there an easier way (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Re: Parsing Large Text Files
  • Next by Date: Re: Parsing Large Text Files
  • Previous by thread: Re: XMLNextSibling is there an easier way
  • Next by thread: Quick AppleScript to open an SSH session to a client
  • Index(es):
    • Date
    • Thread