X-Application Version: 184.108.40.206
Tamino Version : 220.127.116.11
Platform : Win2k
WebContainer : Tomcat 3.3a
JDK Version : 1.4.0
I’d like you to help me clarify some concepts of SPath.
SPath enables programs to access business nodes described by those unnamed elements, such as sequences, occurrences and choices. Normally this is not possible by simply writing XPath statements.
In the previous posts between me and Mr. Freytag, some SPath usage has been briefly mentioned, and I can follow them without problem. Unfortunately, however, the xapplication manual (version 3.1.3) seems to provide a slightly different view regarding how to use SPath.
Since I’m not sure if you have access to the manual version 3.1.3, I will paste some manual content here. Below is a portion of schema definition for “Property”.
The SPath expression that the manual uses to access the FIRST address of the SECOND contact person is:
In my opinion, this statement is wrong in that it doesn’t include the sequence node for the root sequence of Property. And what I think is correct should be:
Please enlighten me on this.
Another thing is that in some places in the manual, from page 214 to page 215, the manual uses things like xapp::seq() in place of xapp:seq(). I don’t understand that double colons nor does the manual define it. Is this a printing error?
Thank you in advance!
[This message was edited by Christian Freytag on 21 Mar 2003 at 12:29.]
X-Application Version: 18.104.22.168
For you first question about the Structure Path:
The part Property/ContactPersons is ‘normal’ XPath (for XApplication 3.1.3 we support only the descendant child axis). For the element ContactPersons you append the Structure Path
Therefore, the schema based navigation starts with the first path fragment ‘xapp:…’. The schema based navigation stops when an element is reached (e.g. Address). Also for the node ‘Address’ you can decide to start a normal XPath fragment, e.g.
/Property/ContactPersons/xapp:...../Address/Street </pre><BR><BR>or a schema based path fragment (Structure Path) e.g.<BR><BR><pre class="ip-ubbcode-code-pre"> /Property/ContactPersons/xapp:...../Address/xapp:seq(1)/xapp:child(1). </pre><BR><BR>For the next version we will prohibit the mixture of XPath and SPath and support more XPath.<BR><BR><BR><BR><B>For your second question:</B><BR><BR>On page 214/215 there is a documentation bug. The path expression must be<BR><BR><pre class="ip-ubbcode-code-pre"> xapp:seq() </pre><BR><BR>instead of<BR><BR><pre class="ip-ubbcode-code-pre"> xapp::seq()
Thanks for this hint; we will correct this for next version.
So is it valid to say that for the time being we can use SPath and XPath interchangably for arbitrary fraction of the path expression?
For example, is it valid to use both “Property/ContactPersons/…” and “Property/xapp:seq(1)/ContactPersons/…” to achieve the same thing?
yes this is correct. However, I would avoid SPath expressions as long as they became not necessary. The reasons are:
- Structure Path expressions create structure nodes based on the schema of the document (memory resources).
- They require more evaluation steps (/Property/xapp:seq(1)/ContactPersons is longer than /Property/ContactPersons
- They are X-Application specific.
When should you use them?
- To iterate/address anonymous schema structures, e.g.
... <xs:element name='X'> <xs:complexType> <xs:sequence maxOccurs='unbounded'> <xs:element name='A' type="xs:string" /> ... <xs:element name='F' type="xs:string" /> </xs:seqeunce> </xs:complexType> </xs:element> ...
Within this case, using SPath you can very easily iterate the sequence “A B … F” .
My tip for you: Use the SPath only when another way without them is not possible or to complex.
Stupidly, the generator creates a lot of SPath expressions. For the next version of X-Application we will optimize its output for it uses SPath expression only if they are required.
the documentation bug mentioned above does not longer appear within the new documentation of X-Application 4.1.1.
Furthermore, the handling of structure paths for X-Application 4.1.1 has changed. A mixture of Structure Paths (which is an X-Application specific feature to navigate within the content model) and XPath expression is not longer allowed. The attribute ‘extselect’ of JSP tags has to be used for Structure Paths and the ‘select’ attribute for XPaths. This separation of these two path categories should ease the use of X-Application.