all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Saner behavior for xml-get-attribute
@ 2004-03-01 15:26 Mark A. Hershberger
  2004-03-02 21:47 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Mark A. Hershberger @ 2004-03-01 15:26 UTC (permalink / raw)



Some months ago, this patch was submitted.  It didn't get applied
because, I suspect, Savannah was having trouble at the time.

This patch creates a saner alternative to the current
xml-get-attribute.  Currently, if an attribute doesn't exist,
xml-get-attribute returns "" -- making it impossible to tell the
difference between a non-existent attribute and an empty attribute.

*** xml.el	14 Jul 2003 20:41:12 -0000	1.23
--- xml.el	1 Mar 2004 15:19:02 -0000
***************
*** 104,118 ****
  	      (push child match))))
      (nreverse match)))
  
! (defun xml-get-attribute (node attribute)
!   "Get from NODE the value of ATTRIBUTE.
! An empty string is returned if the attribute was not found."
!   (if (xml-node-attributes node)
        (let ((value (assoc attribute (xml-node-attributes node))))
! 	(if value
! 	    (cdr value)
! 	  ""))
!     ""))
  
  ;;*******************************************************************
  ;;**
--- 109,130 ----
  	      (push child match))))
      (nreverse match)))
  
! (defun xml-get-attribute-or-nil (node attribute)
!   "Get the value of ATTRIBUTE from NODE.
! Returns nil if the attribute is not found.
! 
! See also `xml-get-attribute'"
!   (when (xml-node-attributes node)
        (let ((value (assoc attribute (xml-node-attributes node))))
! 	(when value
! 	    (cdr value)))))
! 
! (defsubst xml-get-attribute (node attribute)
!   "Get the the value of ATTRIBUTE from NODE.
! Returns an empty string if the attribute is not found.
! 
! See also `xml-get-attribute-or-nil'"
!   (or (xml-get-attribute-or-nil node attribute) ""))
  
  ;;*******************************************************************
  ;;**


-- 
Peace is only better than war if peace isn't hell, too.
    -- Walker Percy, "The Second Coming"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Saner behavior for xml-get-attribute
  2004-03-01 15:26 Saner behavior for xml-get-attribute Mark A. Hershberger
@ 2004-03-02 21:47 ` Stefan Monnier
  2004-03-03  6:10   ` Mark A. Hershberger
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2004-03-02 21:47 UTC (permalink / raw)
  Cc: emacs-pretest-bug, emacs-devel

> Some months ago, this patch was submitted.  It didn't get applied
> because, I suspect, Savannah was having trouble at the time.

Huh?  the ChangeLog says it was applied 2003-12-29.


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Saner behavior for xml-get-attribute
  2004-03-02 21:47 ` Stefan Monnier
@ 2004-03-03  6:10   ` Mark A. Hershberger
  0 siblings, 0 replies; 3+ messages in thread
From: Mark A. Hershberger @ 2004-03-03  6:10 UTC (permalink / raw)
  Cc: emacs-pretest-bug, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Huh?  the ChangeLog says it was applied 2003-12-29.

Duh.

Somehow my copy of CVS got stuck on a non-HEAD tag. Sorry.

Mark.

-- 
A choice between one man and a shovel, or a dozen men with teaspoons
is clear to me, and I'm sure it is clear to you also.
    -- Zimran Ahmed <http://www.winterspeak.com/>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-03  6:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-01 15:26 Saner behavior for xml-get-attribute Mark A. Hershberger
2004-03-02 21:47 ` Stefan Monnier
2004-03-03  6:10   ` Mark A. Hershberger

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.