Create XML file based on .XSD or .DTD in C#.net 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hiren Mistry
    New Member
    • Jun 2007
    • 17

    Create XML file based on .XSD or .DTD in C#.net 2005

    hi all,

    Does any one help me ....? is there any possible way to create xml file using .xsd file or .dtd?

    same quetionf was fired by Mr. Mitesh ........ Does he got solution for that ?

    Please help me..
    thanks in advance
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Welcome to TheScripts TSDN....

    Please give more details about what you want to implement.
    Regularly the XSD file is used to define the type and behavior of the XML elements and attributes, but the element/attribute values come from user input.

    Thanks,
    Dorin.

    Comment

    • Hiren Mistry
      New Member
      • Jun 2007
      • 17

      #3
      I need to generate an XML file .............. for that i have only .DTD

      which let me know.... basic structure of xml node without leaf

      here i m copying that file [DTD] Now need to generate basic structure from this DTD :-)


      i have following DTD file, i need to generate basic structure of XML.......... which contains only Element node....... not leaf node........... ..

      so if possible then please help me............. ....
      this all thing i need to do via C#.net........ in sort programatically ........
      manually i can generate the xml based on given DTD


      So please help me...........

      <?xml version="1.0" encoding="UTF-8"?>
      <!ENTITY % att " ID ID #IMPLIED
      xml:lang CDATA #IMPLIED">
      <!-- =============== =============== =============== =============== = -->
      <!-- Top-level element -->
      <!-- =============== =============== =============== =============== = -->
      <!ELEMENT ectd:ectd (m1-administrative-information-and-prescribing-information?, m2-common-technical-document-summaries?, m3-quality?, m4-nonclinical-study-reports?, m5-clinical-study-reports?)>
      <!ATTLIST ectd:ectd
      xmlns:ectd CDATA #FIXED "http://estri.ich.org/ectd"
      xmlns:xlink CDATA #FIXED "http://www.w3.org/TR/xlink"
      xml:lang CDATA #IMPLIED
      dtd-version CDATA #FIXED "3.3.3"
      vv-version CDATA #IMPLIED
      >
      <!-- =============== =============== =============== =============== = -->
      <!-- Leaf content -->
      <!-- =============== =============== =============== =============== = -->
      <!ELEMENT leaf (title, link-text?)>
      <!ATTLIST leaf
      ID ID #REQUIRED
      application-version CDATA #IMPLIED
      version CDATA #IMPLIED
      font-library CDATA #IMPLIED
      operation (new | append | replace | delete) #REQUIRED
      modified-leaf CDATA #IMPLIED
      checksum CDATA #REQUIRED
      checksum-type CDATA #REQUIRED
      keywords CDATA #IMPLIED
      xmlns:xlink CDATA #FIXED "http://www.w3.org/TR/xlink"
      xlink:type CDATA #FIXED "simple"
      xlink:role CDATA #IMPLIED
      xlink:href CDATA #IMPLIED
      xlink:show (new | replace | embed | other | none) #IMPLIED
      xlink:actuate (onLoad | onRequest | other | none) #IMPLIED
      xml:lang CDATA #IMPLIED
      >
      <!ELEMENT study-leaf (title, property*, leaf-tag?, link-text?)>
      <!ATTLIST study-leaf
      ID ID #REQUIRED
      application-version CDATA #IMPLIED
      version CDATA #IMPLIED
      font-library CDATA #IMPLIED
      operation (new | append | replace | delete) #REQUIRED
      modified-leaf CDATA #IMPLIED
      checksum CDATA #REQUIRED
      checksum-type CDATA #REQUIRED
      keywords CDATA #IMPLIED
      xmlns:xlink CDATA #FIXED "http://www.w3.org/TR/xlink"
      xlink:type CDATA #FIXED "simple"
      xlink:role CDATA #IMPLIED
      xlink:href CDATA #IMPLIED
      xlink:show (new | replace | embed | other | none) #IMPLIED
      xlink:actuate (onLoad | onRequest | other | none) #IMPLIED
      xml:lang CDATA #IMPLIED
      >
      <!ELEMENT title (#PCDATA)>
      <!ATTLIST title
      ID ID #IMPLIED
      >
      <!ELEMENT property (#PCDATA)>
      <!ATTLIST property
      name CDATA #REQUIRED
      info-type CDATA #REQUIRED
      >
      <!ELEMENT link-text (#PCDATA | xref)*>
      <!ATTLIST link-text
      ID ID #IMPLIED
      >
      <!ELEMENT xref EMPTY>
      <!ATTLIST xref
      ID ID #REQUIRED
      xmlns:xlink CDATA #FIXED "http://www.w3.org/TR/xlink"
      xlink:type CDATA #FIXED "simple"
      xlink:role CDATA #IMPLIED
      xlink:title CDATA #REQUIRED
      xlink:href CDATA #REQUIRED
      xlink:show (new | replace | embed | other | none) #IMPLIED
      xlink:actuate (onLoad | onRequest | other | none) #IMPLIED
      >
      <!ELEMENT node-extension (title, (leaf | node-extension)+)>
      <!ATTLIST node-extension
      ID ID #IMPLIED
      xml:lang CDATA #IMPLIED
      >

      <!-- =============== =============== =============== =============== = -->
      <!-- Study structure -->
      <!-- =============== =============== =============== =============== = -->
      <!ELEMENT study (title, study-id, related-study*, category*, study-leaf*)>
      <!ATTLIST study
      %att;
      >

      <!ELEMENT study-id (#PCDATA)>
      <!ELEMENT related-study (#PCDATA)>
      <!ELEMENT category (#PCDATA)>
      <!ATTLIST category
      name CDATA #REQUIRED
      info-type CDATA #REQUIRED
      >

      <!-- name CDATA #REQUIRED -->
      <!ELEMENT leaf-tag (#PCDATA)>
      <!ATTLIST leaf-tag
      name CDATA #REQUIRED
      info-type CDATA #REQUIRED
      >

      <!-- =============== =============== =============== =============== = -->
      <!-- CTD Backbone structures -->
      <!-- =============== =============== =============== =============== = -->
      <!ELEMENT m1-administrative-information-and-prescribing-information (leaf*)>
      <!ATTLIST m1-administrative-information-and-prescribing-information
      %att;
      >
      <!ELEMENT m2-common-technical-document-summaries (leaf*, m2-2-introduction?, m2-3-quality-overall-summary?, m2-4-nonclinical-overview?, m2-5-clinical-overview?, m2-6-nonclinical-written-and-tabulated-summaries?, m2-7-clinical-summary?)>
      <!ATTLIST m2-common-technical-document-summaries
      %att;
      >
      <!ELEMENT m2-2-introduction ((leaf | node-extension)*)>
      <!ATTLIST m2-2-introduction
      %att;
      >
      <!ELEMENT m2-3-quality-overall-summary (leaf*, m2-3-introduction?, m2-3-s-drug-substance*, m2-3-p-drug-product*, m2-3-a-appendices?, m2-3-r-regional-information?)>
      <!ATTLIST m2-3-quality-overall-summary
      %att;
      >
      <!ELEMENT m2-3-introduction ((leaf | node-extension)*)>
      <!ATTLIST m2-3-introduction
      %att;
      >
      <!ELEMENT m2-3-s-drug-substance ((leaf | node-extension)*)>
      <!ATTLIST m2-3-s-drug-substance
      %att;
      substance CDATA #REQUIRED
      manufacturer CDATA #REQUIRED
      >
      <!ELEMENT m2-3-p-drug-product ((leaf | node-extension)*)>
      <!ATTLIST m2-3-p-drug-product
      %att;
      product-name CDATA #IMPLIED
      dosageform CDATA #IMPLIED
      manufacturer CDATA #IMPLIED
      >
      <!ELEMENT m2-3-a-appendices ((leaf | node-extension)*)>
      <!ATTLIST m2-3-a-appendices
      %att;
      >
      <!ELEMENT m2-3-r-regional-information ((leaf | node-extension)*)>
      <!ATTLIST m2-3-r-regional-information
      %att;
      >
      <!ELEMENT m2-4-nonclinical-overview ((leaf | node-extension)*)>
      <!ATTLIST m2-4-nonclinical-overview
      %att;
      >
      <!ELEMENT m2-5-clinical-overview ((leaf | node-extension)*)>
      <!ATTLIST m2-5-clinical-overview
      %att;
      >
      <!ELEMENT m2-6-nonclinical-written-and-tabulated-summaries (leaf*, m2-6-1-introduction?, m2-6-2-pharmacology-written-summary?, m2-6-3-pharmacology-tabulated-summary?, m2-6-4-pharmacokinetic s-written-summary?, m2-6-5-pharmacokinetic s-tabulated-summary?, m2-6-6-toxicology-written-summary?, m2-6-7-toxicology-tabulated-summary?)>
      <!ATTLIST m2-6-nonclinical-written-and-tabulated-summaries
      %att;
      >
      <!ELEMENT m2-6-1-introduction ((leaf | node-extension)*)>
      <!ATTLIST m2-6-1-introduction
      %att;
      >
      <!ELEMENT m2-6-2-pharmacology-written-summary ((leaf | node-extension)*)>
      <!ATTLIST m2-6-2-pharmacology-written-summary
      %att;
      >
      <!ELEMENT m2-6-3-pharmacology-tabulated-summary ((leaf | node-extension)*)>
      <!ATTLIST m2-6-3-pharmacology-tabulated-summary
      %att;
      >
      <!ELEMENT m2-6-4-pharmacokinetic s-written-summary ((leaf | node-extension)*)>
      <!ATTLIST m2-6-4-pharmacokinetic s-written-summary
      %att;
      >
      <!ELEMENT m2-6-5-pharmacokinetic s-tabulated-summary ((leaf | node-extension)*)>
      <!ATTLIST m2-6-5-pharmacokinetic s-tabulated-summary
      %att;
      >
      <!ELEMENT m2-6-6-toxicology-written-summary ((leaf | node-extension)*)>
      <!ATTLIST m2-6-6-toxicology-written-summary
      %att;
      >
      <!ELEMENT m2-6-7-toxicology-tabulated-summary ((leaf | node-extension)*)>
      <!ATTLIST m2-6-7-toxicology-tabulated-summary
      %att;
      >
      <!ELEMENT m2-7-clinical-summary (leaf*, m2-7-1-summary-of-biopharmaceutic-studies-and-associated-analytical-methods?, m2-7-2-summary-of-clinical-pharmacology-studies?, m2-7-3-summary-of-clinical-efficacy*, m2-7-4-summary-of-clinical-safety?, m2-7-5-literature-references?, m2-7-6-synopses-of-individual-studies?)>
      <!ATTLIST m2-7-clinical-summary
      %att;
      >
      <!ELEMENT m2-7-1-summary-of-biopharmaceutic-studies-and-associated-analytical-methods ((leaf | node-extension)*)>
      <!ATTLIST m2-7-1-summary-of-biopharmaceutic-studies-and-associated-analytical-methods
      %att;
      >
      <!ELEMENT m2-7-2-summary-of-clinical-pharmacology-studies ((leaf | node-extension)*)>
      <!ATTLIST m2-7-2-summary-of-clinical-pharmacology-studies
      %att;
      >
      <!ELEMENT m2-7-3-summary-of-clinical-efficacy ((leaf | node-extension)*)>
      <!ATTLIST m2-7-3-summary-of-clinical-efficacy
      %att;
      indication CDATA #REQUIRED
      >
      <!ELEMENT m2-7-4-summary-of-clinical-safety ((leaf | node-extension)*)>
      <!ATTLIST m2-7-4-summary-of-clinical-safety
      %att;
      >
      <!ELEMENT m2-7-5-literature-references ((leaf | node-extension)*)>
      <!ATTLIST m2-7-5-literature-references
      %att;
      >
      <!ELEMENT m2-7-6-synopses-of-individual-studies ((leaf | node-extension)*)>
      <!ATTLIST m2-7-6-synopses-of-individual-studies
      %att;
      >
      ......
      ......
      ........
      <!ELEMENT m5-clinical-study-reports (leaf*, m5-2-tabular-listing-of-all-clinical-studies?, m5-3-clinical-study-reports?, m5-4-literature-references?)>
      <!ATTLIST m5-clinical-study-reports
      %att;
      >
      <!ELEMENT m5-2-tabular-listing-of-all-clinical-studies ((leaf | node-extension | study)*)>
      <!ATTLIST m5-2-tabular-listing-of-all-clinical-studies
      %att;
      >
      <!ELEMENT m5-3-clinical-study-reports (leaf*, m5-3-1-reports-of-biopharmaceutic-studies?, m5-3-2-reports-of-studies-pertinent-to-pharmacokinetic s-using-human-biomaterials?, m5-3-3-reports-of-human-pharmacokinetic s-pk-studies?, m5-3-4-reports-of-human-pharmacodynamic s-pd-studies?, m5-3-5-reports-of-efficacy-and-safety-studies*, m5-3-6-reports-of-postmarketing-experience?, m5-3-7-case-report-forms-and-individual-patient-listings?)>
      <!ATTLIST m5-3-clinical-study-reports
      %att;
      >
      <!ELEMENT m5-3-1-reports-of-biopharmaceutic-studies (leaf*, m5-3-1-1-bioavailability-study-reports?, m5-3-1-2-comparative-ba-and-bioequivalence-study-reports?, m5-3-1-3-in-vitro-in-vivo-correlation-study-reports?, m5-3-1-4-reports-of-bioanalytical-and-analytical-methods-for-human-studies?)>
      <!ATTLIST m5-3-1-reports-of-biopharmaceutic-studies
      %att;
      >
      <!ELEMENT m5-3-1-1-bioavailability-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-1-1-bioavailability-study-reports
      %att;
      >
      <!ELEMENT m5-3-1-2-comparative-ba-and-bioequivalence-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-1-2-comparative-ba-and-bioequivalence-study-reports
      %att;
      >
      <!ELEMENT m5-3-1-3-in-vitro-in-vivo-correlation-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-1-3-in-vitro-in-vivo-correlation-study-reports
      %att;
      >
      <!ELEMENT m5-3-1-4-reports-of-bioanalytical-and-analytical-methods-for-human-studies ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-1-4-reports-of-bioanalytical-and-analytical-methods-for-human-studies
      %att;
      >
      <!ELEMENT m5-3-2-reports-of-studies-pertinent-to-pharmacokinetic s-using-human-biomaterials (leaf*, m5-3-2-1-plasma-protein-binding-study-reports?, m5-3-2-2-reports-of-hepatic-metabolism-and-drug-interaction-studies?, m5-3-2-3-reports-of-studies-using-other-human-biomaterials?)>
      <!ATTLIST m5-3-2-reports-of-studies-pertinent-to-pharmacokinetic s-using-human-biomaterials
      %att;
      >
      <!ELEMENT m5-3-2-1-plasma-protein-binding-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-2-1-plasma-protein-binding-study-reports
      %att;
      >
      <!ELEMENT m5-3-2-2-reports-of-hepatic-metabolism-and-drug-interaction-studies ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-2-2-reports-of-hepatic-metabolism-and-drug-interaction-studies
      %att;
      >
      <!ELEMENT m5-3-2-3-reports-of-studies-using-other-human-biomaterials ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-2-3-reports-of-studies-using-other-human-biomaterials
      %att;
      >
      <!ELEMENT m5-3-3-reports-of-human-pharmacokinetic s-pk-studies (leaf*, m5-3-3-1-healthy-subject-pk-and-initial-tolerability-study-reports?, m5-3-3-2-patient-pk-and-initial-tolerability-study-reports?, m5-3-3-3-intrinsic-factor-pk-study-reports?, m5-3-3-4-extrinsic-factor-pk-study-reports?, m5-3-3-5-population-pk-study-reports?)>
      <!ATTLIST m5-3-3-reports-of-human-pharmacokinetic s-pk-studies
      %att;
      >
      <!ELEMENT m5-3-3-1-healthy-subject-pk-and-initial-tolerability-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-3-1-healthy-subject-pk-and-initial-tolerability-study-reports
      %att;
      >
      <!ELEMENT m5-3-3-2-patient-pk-and-initial-tolerability-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-3-2-patient-pk-and-initial-tolerability-study-reports
      %att;
      >
      <!ELEMENT m5-3-3-3-intrinsic-factor-pk-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-3-3-intrinsic-factor-pk-study-reports
      %att;
      >
      <!ELEMENT m5-3-3-4-extrinsic-factor-pk-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-3-4-extrinsic-factor-pk-study-reports
      %att;
      >
      <!ELEMENT m5-3-3-5-population-pk-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-3-5-population-pk-study-reports
      %att;
      >
      <!ELEMENT m5-3-4-reports-of-human-pharmacodynamic s-pd-studies (leaf*, m5-3-4-1-healthy-subject-pd-and-pk-pd-study-reports?, m5-3-4-2-patient-pd-and-pk-pd-study-reports?)>
      <!ATTLIST m5-3-4-reports-of-human-pharmacodynamic s-pd-studies
      %att;
      >
      <!ELEMENT m5-3-4-1-healthy-subject-pd-and-pk-pd-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-4-1-healthy-subject-pd-and-pk-pd-study-reports
      %att;
      >
      <!ELEMENT m5-3-4-2-patient-pd-and-pk-pd-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-4-2-patient-pd-and-pk-pd-study-reports
      %att;
      >
      <!ELEMENT m5-3-5-reports-of-efficacy-and-safety-studies (leaf*, m5-3-5-1-study-reports-of-controlled-clinical-studies-pertinent-to-the-claimed-indication?, m5-3-5-2-study-reports-of-uncontrolled-clinical-studies?, m5-3-5-3-reports-of-analyses-of-data-from-more-than-one-study?, m5-3-5-4-other-study-reports?)>
      <!ATTLIST m5-3-5-reports-of-efficacy-and-safety-studies
      %att;
      indication CDATA #REQUIRED
      >
      <!ELEMENT m5-3-5-1-study-reports-of-controlled-clinical-studies-pertinent-to-the-claimed-indication ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-5-1-study-reports-of-controlled-clinical-studies-pertinent-to-the-claimed-indication
      %att;
      >
      <!ELEMENT m5-3-5-2-study-reports-of-uncontrolled-clinical-studies ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-5-2-study-reports-of-uncontrolled-clinical-studies
      %att;
      >
      <!ELEMENT m5-3-5-3-reports-of-analyses-of-data-from-more-than-one-study ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-5-3-reports-of-analyses-of-data-from-more-than-one-study
      %att;
      >
      <!ELEMENT m5-3-5-4-other-study-reports ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-5-4-other-study-reports

      %att;
      >
      <!ELEMENT m5-3-6-reports-of-postmarketing-experience ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-6-reports-of-postmarketing-experience
      %att;
      >
      <!ELEMENT m5-3-7-case-report-forms-and-individual-patient-listings ((leaf | node-extension | study)*)>
      <!ATTLIST m5-3-7-case-report-forms-and-individual-patient-listings
      %att;
      >
      <!ELEMENT m5-4-literature-references ((leaf | node-extension)*)>
      <!ATTLIST m5-4-literature-references
      %att;
      >

      Comment

      • dorinbogdan
        Recognized Expert Contributor
        • Feb 2007
        • 839

        #4
        It is possible that using a DataSet to generate an XML file based on a DTD schema.
        However I'm not sure how to do that.

        For now, I will make a link to this thread in the .Net forum too.

        Dorin.

        Comment

        • blackjack2150
          New Member
          • Feb 2007
          • 79

          #5
          The DataSet class has these methods:
          ReadXmlSchema()
          WriteXml()

          Have you tried them?

          Comment

          • Hiren Mistry
            New Member
            • Jun 2007
            • 17

            #6
            yeah i tried that....... but xmlschema will not read .dtd file :-(

            so i m bit confused with this situation

            Comment

            • Hiren Mistry
              New Member
              • Jun 2007
              • 17

              #7
              Originally posted by dorinbogdan
              It is possible that using a DataSet to generate an XML file based on a DTD schema.
              However I'm not sure how to do that.

              For now, I will make a link to this thread in the .Net forum too.

              Dorin.
              Thanks god it is possible....... .....

              Sir may i know the way how to it.?
              please i required such thing on urgent basis.......... .

              please help me out sir

              Thanks for taking interest in this topic

              Comment

              • shweta123
                Recognized Expert Contributor
                • Nov 2006
                • 692

                #8
                Hi ,

                Please refer this Link


                Originally posted by Hiren Mistry
                hi all,

                Does any one help me ....? is there any possible way to create xml file using .xsd file or .dtd?

                same quetionf was fired by Mr. Mitesh ........ Does he got solution for that ?

                Please help me..
                thanks in advance

                Comment

                • Hiren Mistry
                  New Member
                  • Jun 2007
                  • 17

                  #9
                  Originally posted by dorinbogdan
                  It is possible that using a DataSet to generate an XML file based on a DTD schema.
                  However I'm not sure how to do that.

                  For now, I will make a link to this thread in the .Net forum too.

                  Dorin.

                  Dear Mr.Dorin,

                  Can u help in this situation?
                  i m just waiting for solution :(

                  may be my boss will kick me out

                  thanks for taking interest in such difficult problem

                  Comment

                  • blackjack2150
                    New Member
                    • Feb 2007
                    • 79

                    #10
                    Originally posted by Hiren Mistry
                    Dear Mr.Dorin,

                    Can u help in this situation?
                    i m just waiting for solution :(

                    may be my boss will kick me out

                    thanks for taking interest in such difficult problem
                    Here's an open-source tool which they say is able to convert dtd to xsd:

                    You can call it from your program in command-line style.
                    After you have the xsd you can use the methods of the DataSet class.

                    I hope this helps.

                    Comment

                    • Hiren Mistry
                      New Member
                      • Jun 2007
                      • 17

                      #11
                      Originally posted by blackjack2150
                      Here's an open-source tool which they say is able to convert dtd to xsd:

                      You can call it from your program in command-line style.
                      After you have the xsd you can use the methods of the DataSet class.

                      I hope this helps.
                      I gone throgh this.... but i m not getting idea.....

                      i have used %att as subset paramenter in Xml2Sxd()

                      it gives an exception as follow......... .

                      e = {"Reference to undefined parameter entity ''\nReferenced on line 1, position 3 of internal entity ''"}

                      there is function
                      public static Dtd Parse(Uri baseUri, TextWriter errorLog, string name, string pubid, string url, string subset, string proxy, XmlNameTable nt, bool sgml, bool preserveGroups) ;

                      Now i need to know what would b the value in subset

                      Just trying that.....

                      Comment

                      • Hiren Mistry
                        New Member
                        • Jun 2007
                        • 17

                        #12
                        So far i dont get any sucess in this :(

                        Experts pls help me.........
                        i cant read .dtd file even..........

                        I need to create DTD parser now...... for that i need to read DTD

                        please help me experts.......

                        Hiren Mistry

                        Comment

                        • Hiren Mistry
                          New Member
                          • Jun 2007
                          • 17

                          #13
                          Required ur help regarding this situation :(

                          Comment

                          • blackjack2150
                            New Member
                            • Feb 2007
                            • 79

                            #14
                            Originally posted by Hiren Mistry
                            Required ur help regarding this situation :(
                            Read the section "Because acronyms are fun" from this blog:

                            He's had the same problem as you and apparently solved it.

                            Comment

                            Working...