Bugs item #1089245, was opened at 2004-12-21 13:29
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1089245&group_id=16035

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: staskevg (staskevg)
Assigned to: Nobody/Anonymous (nobody)
Summary: Invalid element names in document

Initial Comment:
I can build a new document with invalid element names.

Example: 
<root>
  <1_depth>Element at depth: 1
    <2>Element at depth: 2
       <depth_3>Element at depth: 3</depth_3>
    </2>
  </1_depth>
</root>

Elements '1_depth' and '2' are not valid names becouse
they start with a number.

Element Naming Convention:

XML elements must follow these naming rules:

    * Names can contain letters, numbers, and other
characters
    * Names must not start with a number or punctuation
character
    * Names must not start with the letters xml (or XML
or Xml ..)
    * Names cannot contain spaces


[Follow the URL for more info]
http://www.w3schools.com/xml/xml_elements.asp

Query1: document.selectNodes("//1_depth")
Throws the exception: org.dom4j.InvalidXPathException:
Invalid XPath expression: //1_depth Unexpected '1'
        at
org.dom4j.xpath.DefaultXPath.parse(DefaultXPath.java:315)
        at
org.dom4j.xpath.DefaultXPath.<init>(DefaultXPath.java:51)
        at
org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:196)
        at
org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:205)
        at
org.dom4j.tree.AbstractNode.selectNodes(AbstractNode.java:161)


Query2: document.selectNodes("//depth_3") works well
being a child of an invalid parent element names.

Thanks,
Gennady R. Staskevich

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1089245&group_id=16035


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to