DOM/XPath Generator: Difference between revisions

Jump to navigation Jump to search
m
Line 48: Line 48:


<pre>
<pre>
#include "domstubs.idl"
#include "domstubs.idl"
#include "nsIDOMXPathNSResolver.idl"


[scriptable, uuid(ab50beb3-4049-4299-92ea-4dea4609a1e1)]
[scriptable, uuid(341d8cbe-bcb3-4d9a-a5a6-dd4ef72a402d)]
interface nsIXPathGenerator : nsISupports {
interface nsIXPathGenerator : nsISupports {
   /* A collection of bitwise flags which modify behavior.
   /* A collection of bitwise flags which modify behavior.
Line 59: Line 59:
   // Ignore ID-type attribute nodes on elements and continue to the document node.
   // Ignore ID-type attribute nodes on elements and continue to the document node.
   const unsigned long GO_TO_DOCUMENT_ROOT          = 0x00000001;
   const unsigned long GO_TO_DOCUMENT_ROOT          = 0x00000001;
  // Return expression containing a single step that uses the descendant axis.
  const unsigned long USE_DESCENDANT_AXIS          = 0x00000002;


   /**
   /**
   * Flags which modify the parameters used to generate the xpath string.
   * Flags which modify the parameters used to generate the xpath string.
   */
   */
   unsigned long attribute searchFlags;
   attribute unsigned long searchFlags;


   /**
   /**
Line 93: Line 96:
   * Namespace resolver corresponding to all generated xpaths.
   * Namespace resolver corresponding to all generated xpaths.
   */
   */
   readonly nsIDOMXPathNSResolver resolver;
   readonly attribute nsIDOMXPathNSResolver resolver;
 
  /**
  * Add a namespace URI and prefix to the namespace resolver.
  */
  void addNamespace(in DOMString namespaceURI,
                    in DOMString prefix);


   /**
   /**
   * Generate the xpath as a string.
   * Generate a xpath as a string.
   *
   *
   * @param targetNode  The node our xpath ends at.
   * @param targetNode  The node our xpath ends at.
   * @param contextNode The node our xpath starts from.  If null, use
   * @param contextNode The node our xpath starts from.  If null, use targetNode's owner document.
                        targetNode's owner document.
   *
   *
   * @return DOMString XPath from the context node to the target node.
   * @return DOMString XPath from the context node to the target node.
   */
   */
   DOMString generateXPath(in nsIDOMNode targetNode
   DOMString generateXPath(in nsIDOMNode targetNode,
                           in nsIDOMNode contextNode);
                           in nsIDOMNode contextNode);


Line 111: Line 119:
   *
   *
   * @param targetNode  The node our xpath ends at.
   * @param targetNode  The node our xpath ends at.
   * @param contextNode The node our xpath starts from.  If null, use
   * @param contextNode The node our xpath starts from.  If null, use targetNode's owner document.
                        targetNode's owner document.
   *
   *
   * @return DOMString XPointer from the context node to the target node.
   * @return DOMString XPointer from the context node to the target node.
   */
   */
   DOMString generateXPointer(in nsIDOMNode targetNode
   DOMString generateXPointer(in nsIDOMNode targetNode,
                             in nsIDOMNode contextNode);
                             in nsIDOMNode contextNode);
 
};
}
</pre>
</pre>


Confirmed users
146

edits

Navigation menu