• 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: Jim Skibbie <email@hidden>
  • Date: Wed, 30 Apr 2008 22:43:29 -0500
  • Thread-topic: XMLNextSibling is there an easier way

Title: Re: XMLNextSibling is there an easier way
What I failed to mention in my original post was that there is a namespace assigned to this XML. That is what was tripping me up. I’m bad with XPath, even worse with the whole namespace thing.

The XML opens like this:

<?xml version="1.0" encoding="UTF-8"?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">

So as someone has pointed out earlier in my training here on the list, I’ve assigned the namespace prefix of fred to the namespace like so:

    XMLSetContext theDoc namespace {nsprefix:"fred", nsurl:"http://www.filemaker.com/fmpdsoresult"}

Then either of the two suggestions I received work (as long as I make reference to the namespace prefix in the below examples):

        set theThingYouReLookingFor to XMLGetText (XMLXPath the_root with "//fred:ROW/fred:Value[../fred:IDNoSetItemParent='6353368']")
  --  {"VARnumber"}

or
  
      set theThingYouReLookingFor to XMLGetText (XMLXPath the_root with "fred:ROW/fred:IDNoSetItemParent[. = \"6353368\"]/following-sibling::fred:Value[position()=1]")
  --  {"VARnumber"}
        
There’s a lot of ‘fred’ to go around.

Thanks for everyone’s help.

Jim


Title: Re: XMLNextSibling is there an easier way

That's very bizarre. I just copied your sample XML into a new Unicode window in Smile, then I copied the line above into an AS Terminal and I hit the Enter key (alt-Return), and it looks like it works:

set the_root to XMLRoot (XMLOpen (get text of window 2))
set CustomFieldPath to XMLXPath the_root with "ROW/IDNoSetItemParent[. = \"6353368\"]/following-sibling::Value[position()=1]"

XMLGetText CustomFieldPath
  --  {"VARnumber"}
Emmanuel
 _______________________________________________
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

  • Prev by Date: Re: Entourage and scripting exchange account public folders
  • Previous by thread: Re: XMLNextSibling is there an easier way
  • Next by thread: Entourage and scripting exchange account public folders
  • Index(es):
    • Date
    • Thread