Jump to content

kgw

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by kgw

  1. kgw

    XPath parser in Java

    Hi,I post the question to other mailing list and they give me the following xpath/xquery parser. They are W3C recommendation.http://www.w3.org/2005/qt-applets/xpathApplet.htmlhttp://www.w3.org/2005/qt-applets/xqueryApplet.htmlRegards,kgw
  2. kgw

    XPath parser in Java

    Hi boen_robot,Thanks for the article, but actually it's not what I am looking for. I am not looking for XML parser (parser to parse XML document), but rather XPath parser (to parse XPath). But I do not want the XPath parser to evaluate the XPath expression and return me XML nodes (I don't want the XPath parser to query the XML document). Rather, I want the XPath parser to return me an array or a list or tree or anything where I can go step by step. I am looking for something like this:xpath = XPathParser.parse("/a/b[P and Q]/following::*");xpath.step(1) will return axis = child, NameTest = axpath.step(2) will return axis = child, NameTest = b, predicate = P and Qpredicate can further be divided into predicate.part(1) = P, predicate.part(2) = Q, predicate.boolean() = andxpath.step(3) will return axis = following, NameTest = *Thanks,kgw
  3. kgw

    XPath parser in Java

    Hi,Is there any XPath parser written in java?What I want is: given an XPath string, let say /a/b[pred01]/axes::*/... (pred01 can be anything)it would return the steps of the XPath, ex: a, b[pred01], axes, ...or something more detailThanks,kgw
  4. kgw

    sorting in xpath

    Actually if you want to sort, you can use XQuery - order by
  5. kgw

    Invalid Schema

    Hi,I've tried to fix some part of your codes but they still throw some errors. Below is the code that I've fixed. You can refer to the comments to see which part I've edited.For your question, you need to give a name to your complexType. <xsd:element name="myResume"><xsd:complexType>... <?xml version="1.0"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="myResume"> <!--added--> <xsd:complexType> <xsd:sequence> <!--added--> <xsd:element name="category" type="xsd:string"/> <xsd:element name="type" type="xsd:string"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="accomplishment" type="xsd:string"/> <xsd:element name="class" type="xsd:string"/> <xsd:element name="link" type="xsd:anyURI" /><!--xsd:urireference"/>--> <xsd:element name="role" type="xsd:string"/> <xsd:element name="Date" type="xsd:string"/> <xsd:element name="status"> <!-- type="statusType">--> <!--comment--> <xsd:simpleType> <!--added--> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Development"/> <xsd:enumeration value="In Progress"/> <xsd:enumeration value="Complete"/> <xsd:enumeration value="Ongoing"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="skill"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xsd:name"/> <xsd:element ref="xsd:category"/> <xsd:element ref="xsd:link"/> </xsd:sequence> <xsd:attribute ref="xsd:id"/> </xsd:complexType> </xsd:element> <xsd:element name="project"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xsd:name"/> <xsd:element ref="xsd:status"/> <xsd:element ref="xsd:description"/> <xsd:element ref="xsd:skill" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="coursework"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xsd:class"/> <xsd:element ref="xsd:description"/> <xsd:element ref="xsd:skill" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="job"> <xsd:complexType> <xsd:sequence> <xsd:element ref="name"/> <xsd:element ref="link" minOccurs="0"/> <xsd:element ref="role"/> <xsd:element ref="description"/> <xsd:element name="startDate"/> <!-- substitutionGroup="xsd:date"/>--> <!--commented--> <xsd:element name="endDate"/> <!-- substitutionGroup="xsd:date"/>--> <!--commented--> <xsd:element ref="project" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="school"> <xsd:complexType> <xsd:sequence> <xsd:element ref="name"/> <xsd:element ref="link"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> <!--added--> </xsd:complexType> </xsd:element> <!--added--></xsd:schema>
  6. Anybody can solve this problem? I've tried the following but it gives me error. It is said that "Element 'taxe' occurs more than once in the same content model but does not refer to a top-level type definition. Expected type definition 'xs:integer' but got '{no name}'" It seems that you can't have two elements with the same name but different type. <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="root"> <xs:complexType> <xs:choice> <xs:element name="taxe" type="xs:integer"/> <xs:element name="taxe"> <xs:complexType> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element></xs:schema>
  7. Hi,I tried the following and it seems that using type=string allows you to have empty attribute. (but if you change to integer, email can't be empty) <xs:element name="myemail"> <xs:complexType> <xs:attribute name="email" type="xs:string" use="required"/> </xs:complexType></xs:element>
  8. kgw

    How to test

    I use Altova XMLSpy. You can download the free version (Home Edition). -> http://www.altova.com/support_freexmlspyhome.asp
  9. Hi Aleksanteri, I've tried to run in Altova XMLSpy and Tryit Editor but it doesn't work. I changed the "&&" to "and" but it also doesnt work.
  10. Hi,Thanks, it's working :)I also tried other way which is working, but I prefer your way though /bookstore/book[position()>=2 and position()<=4]
  11. kgw

    selectnodes

    Hi Jojay,What are you trying to return? If you want to return the price and title you can use the following XPath:/bookstore/book[price>35]/(price | title)The result is something like this:<title lang="en">XQuery Kick Start</title><price>50.00</price><title lang="en">Learning XML</title><price>40.00</price>
  12. Hi, Is there any XPath operator to return a range of elements? For example, /bookstore/book[2] will return 2nd book element.How can I return 2nd to 4th book element? I tried /bookstore/book[2 to 4] in Altova XMLSpy 2006 to but instead it returns all book elements (/bookstore/book) :)Thanks :)Btw this is the sample xml: (I took from XPath tutorial) <bookstore><book category="COOKING"> <title lang="en">Everyday Italian</title> ...</book><book category="CHILDREN"> <title lang="en">Harry Potter</title> ...</book><book category="WEB"> <title lang="en">XQuery Kick Start</title> ...</book><book category="WEB"> <title lang="en">Learning XML</title> ...</book></bookstore>
  13. Hi,What is your dtd?I tried the following dtd in XML Spy and it is said that the dtd is valid:<!ELEMENT script (paragraph)+><!ELEMENT paragraph (bold,subparagraph+)+><!ELEMENT subparagraph (bold)><!ELEMENT bold (#PCDATA)>
  14. Hi,For each signature, does it only have one image file? Or a signature can have many images? If it only has one image, I think you can create just one table manager. Then id, sign_id, ... signature are the columns. In signature, just put in the image file name.(Btw I'm also new to XSchema)
  15. Hi,Thanks for your advice. For the result of the selection, I believe tree is good enough. Because XML document itself can be viewed as tree. And since it is GUI, I know the XQuery features it can support will be limited. And the more features I want to include, the more complicated it will be. So I will need to compromise between features and simplicity. (my target users are novice-XML users)Anyway, I haven't come out with the design yet, but I hope I can make a good one :)Regards,Klarinda
  16. Hi,You can use Altova or Stylus Studio. There are free trials or free home edition that you can download. Regards,Klarinda
  17. kgw

    DTD elements order

    Hi Paetje,As far as I know, elements declared in dtd must follow the order. You can refer to W3Schools DTD tutorialIf you want them to appear in any order, why not write XML Schema? You can use the <all> indicator because it specifies by default that the child elements can appear in any order and that each child element must occur once and only once. You can read W3School XSchema tutorial
  18. Hi,Actually I want to make a GUI which can be used to query XML data without writing any XQuery code, but by 'drawing' on the GUI. The program would translate the drawing to XQuery then using the XQuery code generated to query the database. My target users would be those who do not really understand about XML or XQuery.That's why I want to see if there is any existing XQuery visualization software and maybe I can reuse the idea or design. But so far, I only find Stylus Studio XQuery Mapper and Altova MapForce which are targeted for developer and XQBE (XQuery By Example) which I think too complicated for beginner.XQuery is not even a recommendation yet? But I thought it is already widely used. I'm new to XML / XQuery so I really appreciate your advice. Thanks,Klarinda
  19. Hi, I'm interested to know if there is any tool for XQuery visualization (GUI), especially for beginners? So that by using the tool, the user can formulate the XQuery by 'drawing' in the GUI (drag and drop, etc) without knowing / understanding XQuery syntax. The program then translate the drawing to XQuery then using the XQuery code to query database.It is something like this:User -> GUI (automatically translate to XQuery) -> query XML data I have tried Stylus Studio XQuery Mapper and Altova MapForce. But they are meant for advanced users / developers, not general / beginner users. I have also read about XQBE (XQuery by Example) http://dbgroup.elet.polimi.it/xquery/XQBE.html But I feel that the visualization is too complicated for beginners. Regards, Klarinda
×
×
  • Create New...