You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by da...@apache.org on 2004/10/05 21:23:14 UTC

cvs commit: xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans XmlCursor.java XmlObject.java

daveremy    2004/10/05 12:23:14

  Modified:    v2/src/xmlpublic/org/apache/xmlbeans XmlCursor.java
                        XmlObject.java
  Log:
  Updating Javadoc so that it's easier to discover how to use XmlCursor.getName() to get an element's name. XmlCursor.getName() comments now include a small example for getting an element's local name. XmlObject comments now include a mention that you can get an element name, along with a link to getName()
  
  Contributed by Steve Traut
  
  Revision  Changes    Path
  1.7       +12 -1     xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/XmlCursor.java
  
  Index: XmlCursor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/XmlCursor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlCursor.java	5 Oct 2004 16:57:26 -0000	1.6
  +++ XmlCursor.java	5 Oct 2004 19:23:13 -0000	1.7
  @@ -414,7 +414,18 @@
        * For NAMESPACE, the local part of the name is the prefix, while 
        * the URI is the namespace defined. For PROCINST, the local part 
        * is the target and the uri is "".
  -     * 
  +     * <p>
  +     * In the following example, <code>xmlObject</code> represents
  +     * an XML instance whose root element is not preceded by any other XML.
  +     * This code prints the root element name (here, the local name, or 
  +     * name without URI).
  +     * <pre>
  +     * XmlCursor cursor = xmlObject.newCursor();
  +     * cursor.toFirstContentToken();
  +     * String elementName = cursor.getName().getLocalPart();
  +     * System.out.println(elementName);
  +     * </pre>
  +     *
        * @return  The name of the XML at this cursor's location; null if there
        * is no name.
        */
  
  
  
  1.7       +3 -1      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/XmlObject.java
  
  Index: XmlObject.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/XmlObject.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlObject.java	14 Sep 2004 02:01:28 -0000	1.6
  +++ XmlObject.java	5 Oct 2004 19:23:13 -0000	1.7
  @@ -68,7 +68,9 @@
    *     and use {@link #validate(XmlOptions)}.
    * <li>Use {@link #newCursor} to access the full XML infoset, for example,
    *     if you need to determine interleaved element order or manipulate
  - *     annotations, comments, or mixed content.  See {@link XmlCursor}.
  + *     annotations, comments, or mixed content.  You can get an element name with
  + *     a cursor by calling {@link XmlCursor#getName() cursor.getName()} when the 
  + *     cursor is positioned at an element's START token. See {@link XmlCursor}.
    * <li>Use {@link #selectPath} to find other XmlObjects in the subtree underneath
    *     this XmlObject using relative XPaths.  (In selectPath, "." indicates
    *     the current element or attribute.)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org