[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: An approach to let XML 2.n resources hold multiple entitie


child nodes xml
In a message dated 19/03/2003 09:46:17 GMT Standard Time, bill.dehora@p... writes:


> At the moment,  count(/*) always is 1.  I am suggesting redefining /
> away from being the "document" to being the "resource", and then
> using indexing to get other entities.

I believe it can be > 1. In the XPath model, the root node declares
the prolog as one of its children as well as the document element
and any other processing instructions. So there might not be as much
impact there as you expect.


Bill,

I think you may be conflating a couple of ideas here.

Yes it is possible to have processing instructions or comments in the prolog before the start tag of the document element. However XPath 1.0 treats each such processing instruction or comment as a node, rather than treating the prolog as a child of the root node.

The location path count(/*) will return all child nodes of the principal node type for the default (child) axis. The element node is the principal node type, so the location path count(/*) returns 1 since there is only ever one child element node of the root node in a well-formed XML document.

However, count(/node()) returns all child nodes of the root node (not just those of the principal node type). If, as in the following example document, there are non-element child nodes of the root node then count(/node()) will return a value greater than 1. In this case 3.
<?xml version="1.0"?>
<?arbitrary processing instruction  ?>
<!-- Some comment which is a child of the root node -->
<document>
<child>
</child>
</document>

Andrew Watt

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.