Creating XML data files

Discussion in 'XML' started by jmm-list-gn, Aug 21, 2004.

  1. jmm-list-gn

    jmm-list-gn Guest

    Hello,
    I am new to XML. One of the aspects in studying how XML documents are
    manipulated is the assumption that XML data files spring spontaneously
    into existence. Are all XML data files really handwritten?
    I am working on a program that queries a package carrier's web service
    about shipping rates. They have provided a number of XML schema (.xsd).
    Creating a XML query packet, however, seems to require having the element
    tags in the program as strings, and the wrapping them around the data as
    required. That is, an automated form of handwriting the XML file.
    Is this normally how it is done?
    Is there some way to use the schema files to get the appropriate tags
    rather than have them written into the program?

    --
    jmm dash list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
     
    jmm-list-gn, Aug 21, 2004
    #1
    1. Advertising

  2. jmm-list-gn

    Stefan Ram Guest

    jmm-list-gn <> writes:
    >Creating a XML query packet, however, seems to require having the element
    >tags in the program as strings, and the wrapping them around the data as
    >required. That is, an automated form of handwriting the XML file.
    > Is this normally how it is done?


    One can do so, or one might create a document model in memory
    (a "DOM") and use a library to write it, or one might use a
    library for writing XML.

    Writing XML is much simplier than reading XML, because the
    author of an XML document can chose what to write, while a
    parser must be able to cope at any time with everything that
    is possible in XML, actually even with everything that is
    not possible, because the parser should also emit nice
    error reports in such a case.

    What is needed most often, when writing XML, is a subroutine
    to replace special characters occuring in text (such as "<")
    by a representation (such as "<"). When it gets the job
    done, there is nothing wrong with just a "PRINT '<EXAMPLE>';"
    to start an element. When certain patterns of such PRINT-
    statements repeat in source code, one will start to catch them
    as subroutines.
     
    Stefan Ram, Aug 21, 2004
    #2
    1. Advertising

  3. jmm-list-gn

    Ed Day Guest

    jmm-list-gn <> wrote in message news:<>...
    > Hello,
    > I am new to XML. One of the aspects in studying how XML documents are
    > manipulated is the assumption that XML data files spring spontaneously
    > into existence. Are all XML data files really handwritten?
    > I am working on a program that queries a package carrier's web service
    > about shipping rates. They have provided a number of XML schema (.xsd).
    > Creating a XML query packet, however, seems to require having the element
    > tags in the program as strings, and the wrapping them around the data as
    > required. That is, an automated form of handwriting the XML file.
    > Is this normally how it is done?
    > Is there some way to use the schema files to get the appropriate tags
    > rather than have them written into the program?


    You might want to look into XML Data Binding applications. They can
    generate code from a given XSD specification to serialize/deserialize
    program data to and from XML. A Google search of "XML Data Binding"
    will provide more information on these tools.

    Regards,

    Ed Day
    Objective Systems, Inc.
     
    Ed Day, Aug 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page