[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Simple XPath question
> (did you mean to take this off list) No, I didn't. I should have pushed 'Reply to all'. Thanks for your patient explanations. I just found some good introductory text online which explains everything I need to know about XPath, but I haven't actually opened up the tools, because I don't have a concrete application which involves DOM. I may need XPath for XSLT. I'm a native Lisp programmer. I suppose, if there were a Lisp binding for DOM, we'd be talking 'cons' cells. 1) DOM builds a list of nodes from a source document (note that "list" is defined recursively, so it means "tree") 2) There must be a way to iterate through the list (I'm still not familiar with the programming languages supporting DOM, like Javascript and Java, but I have programmed alot in C/C++. I see there is a very thorough API for C. It looks like a bear. Maybe Java is easier!) 3) The result of evaluating an XPath expression would be a subtree, a "sub DOM" (I hope), a "sub-document", another list, which could, in turn, be traversed. [Or perhaps the root of the DOM object is all that distinguishes a list from a sublist.] 4) The tree structure of a XML/DOM document is similar to, but much more flexible than the Unix file system, where names must be unique within a directory, so you're going to get multi-valued results (lists) for an XPath expression evaluation (which can be iterated through using the same DOM interfaces, whatever they are). 5) DOM would have a way to insert and delete nodes, compare trees, just like Lisp. 6) The DOM object which results from an XSL transform would be serialized in a suitable text format, like XML, but could be anything, maybe even an mp3 playlist. 7) Of course, there would be DOM parsers to scan the XML document. It's starting to make sense, thanks. Joe PS I'm still not sure how all this technology fits together, but XLink looks like a general purpose linking language. XPointer must refer to XML document names. XPath refers to DOM document names. Am I confusing the notion of an XML document, which generally refers to the file that holds the markup, with a DOM object, which refers to a named structure which permits an XML "document" to be automatically processed by a computer program? XML documents have the more intuitive meaning, the one used by HTML documents: things referrred to by a URL. I imagine the definition of a URL has been extended to allow references to pieces of an XML document (not a DOM object).... [Sorry, I'm just thinking out loud] Bye. Joe On 8/8/05, David Carlisle <davidc@n...> wrote: > > (did you mean to take this off list) > > > 1) space is not significant so [] must group the terms > > No. [] isn't grouping terms (xpath uses () for that) square brackets apply > a filter. A selects all A elements A[foo] selects all A such that foo is > true. > > > 2) '.' looks like a wildcard > > No. It selects the current node. > > > 3) '//, /@' It looks like / and @ would be enough > > // means something different than / so changing // to / would be legal > but select very different nodes. > > > > For each '.' i.e. child in A > . does not mean child it means self (that is, A here) > > > I was just wondering where you would use an expression like this, > It is just a typical xpath expression, so you can use it wherever you > use xpath. Originally in xslt but many other languages and dom > implementations have xpath api these days. > > David > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ >
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|