2 // Mono.Xml.Schema.XsdIdentityPath.cs
5 // Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
7 // (C)2003 Atsushi Enomoto
10 // These classses represents XML Schema's fake XPath, which
11 // W3C specification calls "XPath", although it is very different
12 // language from XPath.
17 // Permission is hereby granted, free of charge, to any person obtaining
18 // a copy of this software and associated documentation files (the
19 // "Software"), to deal in the Software without restriction, including
20 // without limitation the rights to use, copy, modify, merge, publish,
21 // distribute, sublicense, and/or sell copies of the Software, and to
22 // permit persons to whom the Software is furnished to do so, subject to
23 // the following conditions:
25 // The above copyright notice and this permission notice shall be
26 // included in all copies or substantial portions of the Software.
28 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 using System
.Collections
;
39 using System
.Xml
.Schema
;
41 namespace Mono
.Xml
.Schema
43 internal class XsdIdentitySelector
45 XsdIdentityPath
[] selectorPaths
;
47 ArrayList fields
= new ArrayList ();
48 XsdIdentityField
[] cachedFields
;
50 public XsdIdentitySelector (XmlSchemaXPath selector
)
52 selectorPaths
= selector
.CompiledExpression
;
55 public XsdIdentityPath
[] Paths
{
56 get { return selectorPaths; }
59 public void AddField (XsdIdentityField field
)
65 public XsdIdentityField
[] Fields
{
67 if (cachedFields
== null)
68 cachedFields
= fields
.ToArray (typeof (XsdIdentityField
)) as XsdIdentityField
[];
74 internal class XsdIdentityField
76 XsdIdentityPath
[] fieldPaths
;
79 public XsdIdentityField (XmlSchemaXPath field
, int index
)
82 fieldPaths
= field
.CompiledExpression
;
85 public XsdIdentityPath
[] Paths
{
86 get { return fieldPaths; }
94 internal class XsdIdentityPath
96 public XsdIdentityStep
[] OrderedSteps
;
97 public bool Descendants
;
100 internal class XsdIdentityStep
102 public bool IsCurrent
;
103 public bool IsAttribute
;
104 public bool IsAnyName
;
105 public string NsName
;
107 public string Namespace
= "";