• 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: XML question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML question


  • Subject: Re: XML question
  • From: "Christian Roth" <email@hidden>
  • Date: Tue, 5 Dec 2006 13:54:08 +0100

Ruth Bygrave wrote:

>Trying to get the 'book name' attribute from the book element (the
>only thing in the XML file), I have tried:
>XMLGetText ((XMLXPath with "book name@book"))
>XMLGetText ((XMLXPath with "book@book name"))
>and various other perms & combs of the above, and the syntax seems to
>be choking the parser however I try.

that's actually an XPath problem. To access the name attribute on the
book element in something like:

<book name="The Name of the book">...</book>

, you do that in XPath with

book/@name

that is "when on the book element, give me the 'name' item on the
attribute axis".

Note that an element can not have an attribute named "book name" because
that is not a NMTOKEN, i.e. not a valid name for an attribute. Attribute
names must not contain spaces.

The specification details can be found here:

<http://www.w3.org/TR/xpath>

HTH,
Christian

 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: XML question
      • From: Ruth Bygrave <email@hidden>
References: 
 >XML question (From: Ruth Bygrave <email@hidden>)

  • Prev by Date: XML question
  • Next by Date: Re: XML question
  • Previous by thread: XML question
  • Next by thread: Re: XML question
  • Index(es):
    • Date
    • Thread