DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: Query XML data

  1. #1
    JJ Guest

    Query XML data


    I have created an XML file the contains basic application info, eg. App name,
    app class, primary contact, secondary, and app sponser. I would now like
    to create a way to query that file via a web interface.

    For example enter the app name, click query, and generate results based on
    the XML file. Anyone have any suggestions/examples on how to accomplish
    this. I have been trying to use XML Spy and man am I confused.

    I would also like to create a seperate web interface for adding records.

    Thanks!!

  2. #2
    Jason Guest

    Re: Query XML data


    "JJ" <jjshea@sysmatrix.net> wrote:
    >
    >I have created an XML file the contains basic application info, eg. App

    name,
    >app class, primary contact, secondary, and app sponser. I would now like
    >to create a way to query that file via a web interface.
    >
    >For example enter the app name, click query, and generate results based

    on
    >the XML file. Anyone have any suggestions/examples on how to accomplish
    >this. I have been trying to use XML Spy and man am I confused.
    >
    >I would also like to create a seperate web interface for adding records.
    >
    >Thanks!!


    The easiest way is to use "selectNodes" with an XPath query on the server
    side. This will give you back just the parts of the document that you are
    interested in.

    Now you have a choice - you can do all of this programmatically, writing
    code to parse the DOM nodes and formatting them into HTML, or you can use
    parameterized XSLT to get the nodes and produce the HTML.

    For adding records, you will do somewhat the opposite. Create your basic
    XML form (like a VB form), post the data back to the server, and load and
    process the XML document there.

    BE SURE TO TAKE INTO ACCOUNT THAT MULTIPLE PEOPLE MIGHT BE EDITING THE DOCUMENT
    AT THE SAME TIME. Some sort of Application level variable to indicate checkout
    would work, but you'll have to figure out how to determine that a user has
    cancelled the check-out.

    I'm not really sure how XML Spy would help though. :-)


  3. #3
    Omar Guest

    Re: Query XML data


    Hi,

    One easy way to achieve this is to write a simple server-side applet (servlet)
    and then access your xml file via JDBC driver. You will be able to query
    your XML file using standard SQL syntax. A type 4 JDBC driver for XML files
    will be able to do that for you. Only type 4 JDBC driver for XML files is
    the one of Sunopsis. You may have more information and download it here:
    http://www.sunopsis.com/corporate/us...ts/jdbcforxml/

    Hoping that will help.

    Omar

    "JJ" <jjshea@sysmatrix.net> wrote:
    >
    >I have created an XML file the contains basic application info, eg. App

    name,
    >app class, primary contact, secondary, and app sponser. I would now like
    >to create a way to query that file via a web interface.
    >
    >For example enter the app name, click query, and generate results based

    on
    >the XML file. Anyone have any suggestions/examples on how to accomplish
    >this. I have been trying to use XML Spy and man am I confused.
    >
    >I would also like to create a seperate web interface for adding records.
    >
    >Thanks!!



  4. #4
    JJ Guest

    Re: Query XML data


    "Jason" <jason@creative_nospam_corp.com> wrote:
    >
    >"JJ" <jjshea@sysmatrix.net> wrote:
    >>
    >>I have created an XML file the contains basic application info, eg. App

    >name,
    >>app class, primary contact, secondary, and app sponser. I would now like
    >>to create a way to query that file via a web interface.
    >>
    >>For example enter the app name, click query, and generate results based

    >on
    >>the XML file. Anyone have any suggestions/examples on how to accomplish
    >>this. I have been trying to use XML Spy and man am I confused.
    >>
    >>I would also like to create a seperate web interface for adding records.
    >>
    >>Thanks!!

    >
    >The easiest way is to use "selectNodes" with an XPath query on the server
    >side. This will give you back just the parts of the document that you are
    >interested in.
    >
    >Now you have a choice - you can do all of this programmatically, writing
    >code to parse the DOM nodes and formatting them into HTML, or you can use
    >parameterized XSLT to get the nodes and produce the HTML.
    >
    >For adding records, you will do somewhat the opposite. Create your basic
    >XML form (like a VB form), post the data back to the server, and load and
    >process the XML document there.
    >
    >BE SURE TO TAKE INTO ACCOUNT THAT MULTIPLE PEOPLE MIGHT BE EDITING THE DOCUMENT
    >AT THE SAME TIME. Some sort of Application level variable to indicate checkout
    >would work, but you'll have to figure out how to determine that a user has
    >cancelled the check-out.
    >
    >I'm not really sure how XML Spy would help though. :-)
    >

    Thanks...looks like I have a lot to learn to do this.... :-D

  5. #5
    Jason Guest

    Re: Query XML data


    Nah, just use MSXML and XPath queries. That is the easy part. The hard part
    is figuring out how to format your data so it's usable.

    "Omar" <lacabessa@eudoramail.com> wrote:
    >
    >Hi,
    >
    >One easy way to achieve this is to write a simple server-side applet (servlet)
    >and then access your xml file via JDBC driver. You will be able to query
    >your XML file using standard SQL syntax. A type 4 JDBC driver for XML files
    >will be able to do that for you. Only type 4 JDBC driver for XML files is
    >the one of Sunopsis. You may have more information and download it here:
    >http://www.sunopsis.com/corporate/us...ts/jdbcforxml/
    >
    >Hoping that will help.
    >
    >Omar
    >
    >"JJ" <jjshea@sysmatrix.net> wrote:
    >>
    >>I have created an XML file the contains basic application info, eg. App

    >name,
    >>app class, primary contact, secondary, and app sponser. I would now like
    >>to create a way to query that file via a web interface.
    >>
    >>For example enter the app name, click query, and generate results based

    >on
    >>the XML file. Anyone have any suggestions/examples on how to accomplish
    >>this. I have been trying to use XML Spy and man am I confused.
    >>
    >>I would also like to create a seperate web interface for adding records.
    >>
    >>Thanks!!

    >



  6. #6
    JJ Guest

    Re: Query XML data


    Do you have or know where I can get any examples to hack away at?

    Thanks, I really appreciate the response. It all seems so confusing...

  7. #7
    Jason Guest

    Re: Query XML data


    "JJ" <jjshea@sysmatrix.net> wrote:
    >
    >Do you have or know where I can get any examples to hack away at?
    >
    >Thanks, I really appreciate the response. It all seems so confusing...


    Let me preface this by saying I don't work for Wrox Press, nor do I own any
    stake in Wrox Press. I just happen to use and like their books.

    They have a book out called "Professional XSL." There is a whole section
    near the beginning of the book that explains XPath in great detail, with
    lots of examples. Once you figure it out, you will wonder how you ever got
    along without it.

    For those who are less inclined to spend $50, the microsoft web site has
    some good reference material on XSL. It's more geared toward those who are
    already familiar with how it works, but if you are one of those people who
    just figures things out easily, try there first.


  8. #8
    JJ Guest

    Re: Query XML data


    Thanks!! I really appreciate the advice...will try MS first and the book
    if all else fails. XML is really cool stuff!

  9. #9
    Paul Guest

    Re: Query XML data


    MSXML is a real Pain is the butt. The Java Interfaces for XML DOM are much
    more practical and far more useful. But if you are only developing on Windows
    and for Windows and not using Java use MSXML, otherwise, Xerces is a great
    tool. http://xml.apache.org


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center