Hi Sanjaya, Yes, I would definitely recommend extending the existing XPath parser. The base scanner within the XPath class actually supports much more than what is used for XML Schema identity constraints, so you could plug in an alternate XPath.Scanner extension in your child class that allows more symbols. In parseExpression() you could factor out the call to the constructor into another method (e.g. createScanner()) which you could override in your child class to return your extension of XPath.Scanner.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [email protected] E-mail: [email protected] Sanjaya Liyanage <[email protected]> wrote on 03/24/2010 08:09:00 AM: > Hi Michael, > Thank you very much for the clarifications you made and I got a > decent understanding about the expectations.As it is needed to support > subset of XPath there is no need of implementing a completely new > class with new methods and it can simply be done by extending the > prevailing XPath class so that I can also add the new methods needed > in the child class.According to my point of view there is a need of a > separate constructor for the child class as new symbols can be > occurred while dealing with the project.(I mean in the Xpath) .On the > other hand the reimplementing the methods like getLocationPath() is > just increasing the work load.So by extending the prevailing XPath > class will make the things easier.Please give me your feed backs. > Thank you. > Sanjaya Liyanage > > On Wed, Mar 24, 2010 at 12:30 AM, Michael Glavassevich > <[email protected]> wrote: > > Hi Sanjaya, > > > > The ultimate goal is to improve the usefulness of XInclude in Xerces. What > > you can do with the existing XPointer support is very limited and would be > > greatly improved if it supported a subset of XPath. > > > > For example: > > > > Input: > > > > <?xml version="1.0"?> > > <root xmlns:xi="http://www.w3.org/2001/XInclude"> > > <xi:include href="groups.xml" > > xpointer="xpointer(groups/gro...@name='A2'])"/> > > </root> > > > > groups.xml: > > <?xml version="1.0"?> > > <groups> > > <group name="A1"> > > ... > > </group> > > <group name="A2"> > > ... > > </group> > > <group name="A3"> > > ... > > </group> > > ... > > </groups> > > > > Result: > > > > <?xml version="1.0"?> > > <root xmlns:xi="http://www.w3.org/2001/XInclude"> > > <group name="A2"> > > ... > > </group> > > </root> > > > > The first document could have to be written as: > > > > <?xml version="1.0" ?> > > <root xmlns:xi="http://www.w3.org/2001/XInclude"> > > <xi:include href="groups.xml" xpointer="element(/1/2)"/> > > </root> > > > > with the current version of Xerces though this requires that you always know > > the position of the elements that you want to select from the included > > document and would have to update the xpointer if it changes. > > > > Regarding the last() function, you can't compute it without looking ahead so > > wouldn't be one that we could support for XInclude since we need to make a > > decision on the startElement() event on whether it's included or not in the > > result. > > > > Thanks. > > > > Michael Glavassevich > > XML Parser Development > > IBM Toronto Lab > > E-mail: [email protected] > > E-mail: [email protected] > > > > Sanjaya Liyanage <[email protected]> wrote on 03/21/2010 06:31:34 AM: > > > >> Hai Michael, > >> What is the extend that xerces wants to reach through this > >> project?I mean if you can give me an idea about the ultimate goal of > >> this project bringing out an example it would be great for me to have > >> a proper approach to the project. > >> Thanks in advance. > >> Sanjaya Liyanage > >> > >> On Fri, Mar 19, 2010 at 12:45 AM, Sanjaya Liyanage > >> <[email protected]> wrote: > >> > Hi Michael, > >> > I went through the predicate functions like > >> > position(),last(),nodeName(number) and also had some hands on lab > >> > experience and it's amazing that the paths like SomeNode(position ()<3 > >> > and position()>(last()-1)]) are also supported by the current > >> > xpath.But it is not supported to statements like (last() /2).I feel > >> > that this may be due to the ability of last() to return an odd > >> > number.But it is not even support for last()%2.Do you know any other > >> > way I can access these divisions and modulous divisions?. > >> > Thank you. > >> > Sanjaya Liyanage > >> > > >> > On Thu, Mar 18, 2010 at 10:21 PM, Sanjaya Liyanage > >> <[email protected]> wrote: > >> >> Hi Michael, > >> >> Thank you very much for directing me the proper way to gain > >> >> some good back ground knowledge even though you are so busy these > >> >> days.I'll follow the points you mentioned. > >> >> Thank you > >> >> Sanjaya Liyanage > >> >> > >> >> On Thu, Mar 18, 2010 at 5:59 PM, Michael Glavassevich > >> >> <[email protected]> wrote: > >> >>> Hi Sanjaya, > >> >>> > >> >>> I didn't have any specific functions in mind. I was thinking of an > >> >>> XPath > >> >>> subset such as: > >> >>> > >> >>> * XPath axes: child, descendant, descendant-or-self, self and > >> >>> associated > >> >>> abbreviations. > >> >>> * node() test and associated abbreviation (*) > >> >>> * predicate functions: position() and associated abbreviation > >> ([number]) and > >> >>> abbreviated attribute specifier (@) > >> >>> * predicate operators: equality, inequality, "and" and "or". > >> >>> * predicate number and string literals. > >> >>> > >> >>> This is one that was proposed when we were initially working on > >> XInclude. I > >> >>> think it would be a good start and possibly enough to keep you > >> busy over the > >> >>> summer, though you're certainly free to propose something else (e.g. > >> >>> including some functions you're interested in). > >> >>> > >> >>> Thanks. > >> >>> > >> >>> Michael Glavassevich > >> >>> XML Parser Development > >> >>> IBM Toronto Lab > >> >>> E-mail: [email protected] > >> >>> E-mail: [email protected] > >> >>> > >> >>> Sanjaya Liyanage <[email protected]> wrote on 03/12/2010 05:41:14 > >> >>> AM: > >> >>> > >> >>>> Hi Michael, > >> >>>> I think now I have got some decent knowledge on xpath and now > >> >>>> I'm going through Xpointer and Xlink.But I skipped going through the > >> >>>> xpath functions as there are plenty of them.Can you tell me whether > >> >>>> should I go through all of the xpath functions or can you specify > >> >>>> some > >> >>>> vital functions which can be helpful me? > >> >>>> Thank you. > >> >>>> Sanjaya Liyanage > >> >>>> > >> >>>> On Tue, Mar 9, 2010 at 9:32 PM, Sanjaya Liyanage > >> >>>> <[email protected]> > >> >>>> wrote: > >> >>>> > Hi Michael, > >> >>>> > Thank you very much for your clarification and it gave me > >> >>>> > a > >> >>>> > decent > >> >>>> > idea about what i looking for. > >> >>>> > regards > >> >>>> > Sanjaya. > >> >>>> > > >> >>>> > On Tue, Mar 9, 2010 at 7:00 PM, Michael Glavassevich > >> >>>> > <[email protected]> > >> >>>> > wrote: > >> >>>> >> > >> >>>> >> Hi Sanjaya, > >> >>>> >> > >> >>>> >> "//" [1] is a short form for the descendant or self axis, meaning > >> >>>> >> it > >> >>>> >> selects any descendants which match the following part of the > >> >>>> expression not > >> >>>> >> just the immediate children. It doesn't make a difference for the > >> >>>> >> example > >> >>>> >> you posted because every "book" is an immediate child of > >> >>>> "bookstore", but if > >> >>>> >> the document had been: > >> >>>> >> > >> >>>> >> <bookstore> > >> >>>> >> <someotherelement> > >> >>>> >> > >> >>>> >> <book> > >> >>>> >> <title lang="eng">Harry Potter</title> > >> >>>> >> <price>29.99</price> > >> >>>> >> </book> > >> >>>> >> </someotherelement> > >> >>>> >> </bookstore> > >> >>>> >> > >> >>>> >> only the bookstore//book expression would select the "book" > >> >>>> >> element. > >> >>>> >> The > >> >>>> >> bookstore/book expression would not select anything in this > >> >>>> >> document > >> >>>> >> since > >> >>>> >> there is no "book" child immediately under "bookstore". > >> >>>> >> > >> >>>> >> Hope that makes sense. > >> >>>> >> > >> >>>> >> If you have more general questions about XPath the XSL > >> Mulberry mailing > >> >>>> >> list [2] is a very good resource and would encourage you to join > >> >>>> it and also > >> >>>> >> have a look in its archives. > >> >>>> >> > >> >>>> >> Thanks. > >> >>>> >> > >> >>>> >> [1] > >> >>>> >> > >> >>>> >> http://www.zvon.org/xxl/XSLTreference/Output/ > >> axis_descendant-or-self.html > >> >>>> >> [2] http://www.mulberrytech.com/xsl/xsl-list/ > >> >>>> >> > >> >>>> >> Michael Glavassevich > >> >>>> >> XML Parser Development > >> >>>> >> IBM Toronto Lab > >> >>>> >> E-mail: [email protected] > >> >>>> >> E-mail: [email protected] > >> >>>> >> > >> >>>> >> Sanjaya Liyanage <[email protected]> wrote on 03/09/2010 > >> 04:24:43 AM: > >> >>>> >> > >> >>>> >> > Hi Michael, > >> >>>> >> > First of all thank you very much for your reply and it > >> >>>> >> > really encouraged me.I already began to go through the Xpath as > >> >>>> >> > Xpointer is also built on xpath expressions.I refer w3school > >> >>>> >> > site( > >> >>>> >> > http://www.w3schools.com/xpath/default.asp) for gaining > >> >>>> >> > knowledge on > >> >>>> >> > xpath.But I came across a doubt about the expressions ' / ' > >> >>>> >> > and ' > >> >>>> >> > // ' .What is the difference between these two expressions. > >> >>>> >> > The example they use is, > >> >>>> >> > <?xml version="1.0" encoding="ISO-8859-1"?> > >> >>>> >> > > >> >>>> >> > <bookstore> > >> >>>> >> > > >> >>>> >> > <book> > >> >>>> >> > <title lang="eng">Harry Potter</title> > >> >>>> >> > <price>29.99</price> > >> >>>> >> > </book> > >> >>>> >> > > >> >>>> >> > <book> > >> >>>> >> > <title lang="eng">Learning XML</title> > >> >>>> >> > <price>39.95</price> > >> >>>> >> > </book> > >> >>>> >> > > >> >>>> >> > </bookstore> > >> >>>> >> > > >> >>>> >> > As they mention > >> >>>> >> > > >> >>>> >> > expression Result > >> >>>> >> > > >> >>>> >> > bookstore/book > >> >>>> >> > > >> >>>> >> > Selects all book elements that are children of bookstore > >> >>>> >> > > >> >>>> >> > bookstore//book > >> >>>> >> > > >> >>>> >> > Selects all book elements that are descendant of the bookstore > >> >>>> >> > element, no matter where they are under the bookstore element > >> >>>> >> > > >> >>>> >> > Can you please give me the idea? > >> >>>> >> > > >> >>>> >> > thank you > >> >>>> >> > sanjaya > >> >>>> >> > > >> >>>> >> > On Tue, Mar 9, 2010 at 10:20 AM, Michael Glavassevich > >> >>>> >> > <[email protected] > >> >>>> >> > > wrote: > >> >>>> >> > Hi Sanjaya, > >> >>>> >> > > >> >>>> >> > Welcome to the mailing list and thanks for your interest in > >> >>>> >> > Xerces. > >> >>>> >> > > >> >>>> >> > The XPointer project on the idea list from last year is still > >> >>>> >> > open > >> >>>> >> > if you'd like to work on it. Aside from becoming familiar with > >> >>>> >> > the > >> >>>> >> > relevant specifications I'd recommend taking a look at the > >> >>>> >> > existing > >> >>>> >> > XInclude / XPointer implementation in Xerces as well as the > >> >>>> >> > XPath > >> >>>> >> > support that is already in place. > >> >>>> >> > > >> >>>> >> > Feel free to ask questions here if you have any. > >> >>>> >> > > >> >>>> >> > Thanks. > >> >>>> >> > > >> >>>> >> > Michael Glavassevich > >> >>>> >> > XML Parser Development > >> >>>> >> > IBM Toronto Lab > >> >>>> >> > E-mail: [email protected] > >> >>>> >> > E-mail: [email protected] > >> >>>> >> > > >> >>>> >> > Sanjaya Liyanage <[email protected]> wrote on 03/03/2010 > >> >>>> >> > 11:33:38 > >> >>>> >> > PM: > >> >>>> >> > > >> >>>> >> > > >> >>>> >> > > Hi, > >> >>>> >> > > I am so much interested about the project "Implement a > >> >>>> >> > > streamable subset of the XPointer xpointer() scheme for > >> >>>> >> > > XInclude" > >> >>>> >> > > with subject id "xerces-xinclude-xpointer-enhancements" @ > >> >>>> >> > > Gsoc > >> >>>> >> > > 2009 idea list.I had a determination to develop a xml > >> parser by my > >> >>>> >> > > own when I use libxml for one of my projects(When I > >> tried to create > >> >>>> >> > > a plug-in to Anjuta) and I think this Gsoc project will be a > >> >>>> >> > > great > >> >>>> >> > > chance to gain a knowledge which may be helpful to achieve my > >> >>>> >> > > determination one day. > >> >>>> >> > > In these days I am paying > >> >>>> >> > > my > >> >>>> >> > > attention to XPointer Framework and XPointer element() to have > >> >>>> >> > > an > >> >>>> >> > > idea about how the Xinclude requirement are satisfied present > >> >>>> >> > > time.I hope this project idea will remain for Gsoc 2010 and > >> >>>> >> > > please > >> >>>> >> > > let me know if you know anything that can be helpful me > >> to create a > >> >>>> >> > > proper background knowledge before the projects are really > >> >>>> >> > > getting > >> >>>> >> > > started.Thank you all. > >> >>>> >> > > > >> >>>> >> > > regards > >> >>>> >> > > Sanjaya Liyanage. > >> >> > >> > > >
