Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. question about libxml

question about libxml

Scheduled Pinned Locked Moved XML / XSL
questionxmljsonhelp
11 Posts 3 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    storein
    wrote on last edited by
    #1

    hi,everybody Did you use "libxml" to parse your xml file ? I need your help .:confused::confused: how do I parse dtd file by libxml ? after I parse dtd file ,how do I take use of result for parsing xml file ? such as ,my dtd file is Goodxml2.dtd ----------- --------------------------------- my xml fils is Goodxml2.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- how do I parse dtd file by libxml ? then take use of parsing result to parse xml file for get element content ? thank you very much :confused:

    S M 2 Replies Last reply
    0
    • S storein

      hi,everybody Did you use "libxml" to parse your xml file ? I need your help .:confused::confused: how do I parse dtd file by libxml ? after I parse dtd file ,how do I take use of result for parsing xml file ? such as ,my dtd file is Goodxml2.dtd ----------- --------------------------------- my xml fils is Goodxml2.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- how do I parse dtd file by libxml ? then take use of parsing result to parse xml file for get element content ? thank you very much :confused:

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      Regardless of what libxml is, I see an error in what you show : a DTD doesn't have headers like <?xml...

      S 1 Reply Last reply
      0
      • S Stephane Rodriguez

        Regardless of what libxml is, I see an error in what you show : a DTD doesn't have headers like <?xml...

        S Offline
        S Offline
        storein
        wrote on last edited by
        #3

        I use the "xml spy ide " tool to generate my dtd file there has the headers ant no error reported . :-D

        S 1 Reply Last reply
        0
        • S storein

          I use the "xml spy ide " tool to generate my dtd file there has the headers ant no error reported . :-D

          S Offline
          S Offline
          Stephane Rodriguez
          wrote on last edited by
          #4

          storein wrote: ant no error reported No error reported in what tool ? xml spy ? Again, a DTD is not written with Xml syntax, so not only the <?xml header is useless, it may do bad things depending on the parser you use (libxml, msxml, expat, .NET xml, ...)

          S 1 Reply Last reply
          0
          • S Stephane Rodriguez

            storein wrote: ant no error reported No error reported in what tool ? xml spy ? Again, a DTD is not written with Xml syntax, so not only the <?xml header is useless, it may do bad things depending on the parser you use (libxml, msxml, expat, .NET xml, ...)

            S Offline
            S Offline
            storein
            wrote on last edited by
            #5

            Yes. of course ,you are right , there is no this header . when you write your program ,how do you use your DTD file that corresponds your xml file ? only validate the xml file ? DTD file is GoodXml.dtd ----------- --------------------------------- XML file is GoodXml.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- do you use DTD file to validate only xml file ? whether I can parse DTD file first ,get element "bookshell ,book,author,title ",then use the element to parse xml file ? in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content . thank you in advance .

            S 1 Reply Last reply
            0
            • S storein

              Yes. of course ,you are right , there is no this header . when you write your program ,how do you use your DTD file that corresponds your xml file ? only validate the xml file ? DTD file is GoodXml.dtd ----------- --------------------------------- XML file is GoodXml.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- do you use DTD file to validate only xml file ? whether I can parse DTD file first ,get element "bookshell ,book,author,title ",then use the element to parse xml file ? in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content . thank you in advance .

              S Offline
              S Offline
              Stephane Rodriguez
              wrote on last edited by
              #6

              I don't understand what you want to do, and as I don't know libxml either, I guess the discussion is in no way of getting a way out. The only thing I can tell you is that you should never parse a DTD yourself. You should rely on an existing xml parser for this purpose.

              S 1 Reply Last reply
              0
              • S Stephane Rodriguez

                I don't understand what you want to do, and as I don't know libxml either, I guess the discussion is in no way of getting a way out. The only thing I can tell you is that you should never parse a DTD yourself. You should rely on an existing xml parser for this purpose.

                S Offline
                S Offline
                storein
                wrote on last edited by
                #7

                OK ,thank your reply

                1 Reply Last reply
                0
                • S storein

                  hi,everybody Did you use "libxml" to parse your xml file ? I need your help .:confused::confused: how do I parse dtd file by libxml ? after I parse dtd file ,how do I take use of result for parsing xml file ? such as ,my dtd file is Goodxml2.dtd ----------- --------------------------------- my xml fils is Goodxml2.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- how do I parse dtd file by libxml ? then take use of parsing result to parse xml file for get element content ? thank you very much :confused:

                  M Offline
                  M Offline
                  Michael A Barnhart
                  wrote on last edited by
                  #8

                  Just my 2 cents here but why a old DTD format? For my area we only use XSD for new work. Second what goal are you wanting? If it is to validate the file then use the existing tools. If it is to make a data entry form then I can see some use. "I will find a new sig someday."

                  S 1 Reply Last reply
                  0
                  • M Michael A Barnhart

                    Just my 2 cents here but why a old DTD format? For my area we only use XSD for new work. Second what goal are you wanting? If it is to validate the file then use the existing tools. If it is to make a data entry form then I can see some use. "I will find a new sig someday."

                    S Offline
                    S Offline
                    storein
                    wrote on last edited by
                    #9

                    Thank you reply . I want to write c program that parse dynamicly dtd file , get the element ,and take use of these element to parse xml file for getting the element't content such as : DTD file is GoodXml.dtd ----------- --------------------------------- XML file is GoodXml.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- firstly , the program parse GoodXml.dtd file ,get element "bookshell ,book,author,title ", secondly, use the element to parse xml file , get the content "Du Peng Chao" and "Today Story" of course ,I use libxml ,not write parser myself. in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content . thank you in advance .

                    M 1 Reply Last reply
                    0
                    • S storein

                      Thank you reply . I want to write c program that parse dynamicly dtd file , get the element ,and take use of these element to parse xml file for getting the element't content such as : DTD file is GoodXml.dtd ----------- --------------------------------- XML file is GoodXml.xml ----------------- Du Peng Chao Today Story ---------------------------------------------- firstly , the program parse GoodXml.dtd file ,get element "bookshell ,book,author,title ", secondly, use the element to parse xml file , get the content "Du Peng Chao" and "Today Story" of course ,I use libxml ,not write parser myself. in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content . thank you in advance .

                      M Offline
                      M Offline
                      Michael A Barnhart
                      wrote on last edited by
                      #10

                      From what you describe I can just parse the XML file and get the tags and data from it. I do not get anything from reading the DTD. "I will find a new sig someday."

                      S 1 Reply Last reply
                      0
                      • M Michael A Barnhart

                        From what you describe I can just parse the XML file and get the tags and data from it. I do not get anything from reading the DTD. "I will find a new sig someday."

                        S Offline
                        S Offline
                        storein
                        wrote on last edited by
                        #11

                        Now I think I am wrong . because as you say , I can parse the xml file and get tags and data from it ,I need't parse dtd file , Yes ,it is a comprehension error . OK ,thank you reply , I know how to do it

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups