Loading ...
Sorry, an error occurred while loading the content.
 

ClassGenerator code provided with DTD Parser throws java.io.EOFException

Expand Messages
  • Devang Kamdar
    Hi, I am trying to create class files for the attached DTD. I am getting following exception and trace: java.io.EOFException: End of file reached while
    Message 1 of 4 , Feb 26, 2005
      Hi,
      I am trying to create class files for the attached DTD.
      I am getting following exception and trace:

      java.io.EOFException: End of file reached while parsing.
      at org.xmlmiddleware.schemas.dtds.DTDParser.popReader(DTDParser.java:2667)
      at org.xmlmiddleware.schemas.dtds.DTDParser.getChar(DTDParser.java:2765)
      at org.xmlmiddleware.schemas.dtds.DTDParser.nextChar(DTDParser.java:2355)
      at org.xmlmiddleware.schemas.dtds.DTDParser.discardUntil(DTDParser.java:1460)
      at org.xmlmiddleware.schemas.dtds.DTDParser.parseComment(DTDParser.java:189)
      at org.xmlmiddleware.schemas.dtds.DTDParser.parseMarkupDecl(DTDParser.java:588)
      at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubsetDecl(DTDParser.java:465)
      at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubset(DTDParser.java:437)
      at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubset(DTDParser.java:154)
      at samples.ClassGenerator.generateClasses(ClassGenerator.java:103)
      at samples.ClassGenerator.main(ClassGenerator.java:85)

      Does anyone know what the problem could be.
      Any help would be highly appreciated.

      Thanks
      Devang.



      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

      [Non-text portions of this message have been removed]
    • Ronald Bourret
      Hello, I tried parsing the DTD and could not reproduce this error. Instead, parsing failed on the second line:
      Message 2 of 4 , Feb 28, 2005
        Hello,

        I tried parsing the DTD and could not reproduce this error. Instead,
        parsing failed on the second line:

        <!-- 1. NCBI_Entity.mod>
        <!-- Entities used to give specificity to #PCDATA -->
        ^ parsing fails here -- '>' is required

        Note that the comment on the first line is not closed. XML does not
        allow "--" inside comments, so the start of the comment on the second
        line causes an error because it is not immediately followed by a '>'. In
        other words, once a comment is started, the only legal use of "--" is to
        close the comment ("-->").

        I then closed the comment on the first line (and numerous other comments
        like it, which I assume are used for modularity) and got an error
        stating that the Feat-id element was declared more than once. At this
        point, I stopped trying to reproduce the error.

        Are you sure you sent me the DTD that cause this error? My best guess is
        that you sent me the original DTD, but that you are trying to parse a
        DTD you modified -- probably to use some of the modularity features.

        However, I suspect all this is beside the point. If you really want to
        generate classes from a DTD, you shouldn't be using the ClassGenerator
        sample. This is a toy application to show how to use the DTDParser.
        However, the resulting classes are almost worthless. In particular, they
        do not contain code to populate themselves from an XML document or to
        serialize themselves as XML.

        If this is what you really want to do, you will need a real XML data
        binding product. For a list of such products, see:

        http://www.rpbourret.com/xml/XMLDataBinding.htm

        -- Ron

        Devang Kamdar wrote:

        > Hi,
        > I am trying to create class files for the attached DTD.
        > I am getting following exception and trace:
        >
        > java.io.EOFException: End of file reached while parsing.
        > at org.xmlmiddleware.schemas.dtds.DTDParser.popReader(DTDParser.java:2667)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.getChar(DTDParser.java:2765)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.nextChar(DTDParser.java:2355)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.discardUntil(DTDParser.java:1460)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.parseComment(DTDParser.java:189)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.parseMarkupDecl(DTDParser.java:588)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubsetDecl(DTDParser.java:465)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubset(DTDParser.java:437)
        > at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubset(DTDParser.java:154)
        > at samples.ClassGenerator.generateClasses(ClassGenerator.java:103)
        > at samples.ClassGenerator.main(ClassGenerator.java:85)
        >
        > Does anyone know what the problem could be.
        > Any help would be highly appreciated.
      • Devang Kamdar
        Hi Ron, Thanks a bunch for the quick reply. That was exactly the problem. However I found that out when I tried to validate that DTD using Altova s XML SPY.
        Message 3 of 4 , Feb 28, 2005
          Hi Ron,
          Thanks a bunch for the quick reply.
          That was exactly the problem. However I found that out when I tried to validate that DTD using Altova's XML SPY.
          Since I had formed this master DTD from many small modules there were couple of spelling mistakes too.
          However, it has successfully parsed and crated all the classes for that huge and complex DTD.
          I am using this as part of my master's project.
          Actually I am wrtiing a tool that converts DTD to Relational Schema. (ER Diagram) So currently I do not need to worry about parsing the xml Data.
          However that is a valid point that you suggested.
          Also I wanted to ask for the permission if I can use the code as a part of another Open Source Product developed at my university to enhance it.

          Thanks again for your time.
          Devang.

          Ronald Bourret <rpbourret@...> wrote:
          Hello,

          I tried parsing the DTD and could not reproduce this error. Instead,
          parsing failed on the second line:



          ^ parsing fails here -- '>' is required

          Note that the comment on the first line is not closed. XML does not
          allow "--" inside comments, so the start of the comment on the second
          line causes an error because it is not immediately followed by a '>'. In
          other words, once a comment is started, the only legal use of "--" is to
          close the comment ("-->").

          I then closed the comment on the first line (and numerous other comments
          like it, which I assume are used for modularity) and got an error
          stating that the Feat-id element was declared more than once. At this
          point, I stopped trying to reproduce the error.

          Are you sure you sent me the DTD that cause this error? My best guess is
          that you sent me the original DTD, but that you are trying to parse a
          DTD you modified -- probably to use some of the modularity features.

          However, I suspect all this is beside the point. If you really want to
          generate classes from a DTD, you shouldn't be using the ClassGenerator
          sample. This is a toy application to show how to use the DTDParser.
          However, the resulting classes are almost worthless. In particular, they
          do not contain code to populate themselves from an XML document or to
          serialize themselves as XML.

          If this is what you really want to do, you will need a real XML data
          binding product. For a list of such products, see:

          http://www.rpbourret.com/xml/XMLDataBinding.htm

          -- Ron

          Devang Kamdar wrote:

          > Hi,
          > I am trying to create class files for the attached DTD.
          > I am getting following exception and trace:
          >
          > java.io.EOFException: End of file reached while parsing.
          > at org.xmlmiddleware.schemas.dtds.DTDParser.popReader(DTDParser.java:2667)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.getChar(DTDParser.java:2765)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.nextChar(DTDParser.java:2355)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.discardUntil(DTDParser.java:1460)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.parseComment(DTDParser.java:189)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.parseMarkupDecl(DTDParser.java:588)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubsetDecl(DTDParser.java:465)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubset(DTDParser.java:437)
          > at org.xmlmiddleware.schemas.dtds.DTDParser.parseExternalSubset(DTDParser.java:154)
          > at samples.ClassGenerator.generateClasses(ClassGenerator.java:103)
          > at samples.ClassGenerator.main(ClassGenerator.java:85)
          >
          > Does anyone know what the problem could be.
          > Any help would be highly appreciated.




          ---------------------------------
          Do you Yahoo!?
          Yahoo! Mail - Helps protect you from nasty viruses.

          [Non-text portions of this message have been removed]
        • Ronald Bourret
          Two comments: 1) You are welcome to use the DTD Parser in your project. It s Open Source and you can do what you want with it. I ll send you fixes to a few
          Message 4 of 4 , Feb 28, 2005
            Two comments:

            1) You are welcome to use the DTD Parser in your project. It's Open
            Source and you can do what you want with it. I'll send you fixes to a
            few bugs that were found recently.

            2) You may want to consider XML Schemas => relational schemas instead of
            DTDs => relational schemas. This is a more interesting topic because XML
            Schemas are richer than DTDs. In particular, they contain data type
            information, inheritance (extensions), and possible key information
            (unique, key, and keyref constraints). I thought Apache had an XML
            Schema parser you could use to create XML Schema objects from an XML
            Schema document, but the closest I could find were a set of XML Schema
            interfaces in XMLBeans (http://xmlbeans.apache.org/).

            -- Ron

            Devang Kamdar wrote:

            > Hi Ron,
            > Thanks a bunch for the quick reply.
            > That was exactly the problem. However I found that out when I tried to validate that DTD using Altova's XML SPY.
            > Since I had formed this master DTD from many small modules there were couple of spelling mistakes too.
            > However, it has successfully parsed and crated all the classes for that huge and complex DTD.
            > I am using this as part of my master's project.
            > Actually I am wrtiing a tool that converts DTD to Relational Schema. (ER Diagram) So currently I do not need to worry about parsing the xml Data.
            > However that is a valid point that you suggested.
            > Also I wanted to ask for the permission if I can use the code as a part of another Open Source Product developed at my university to enhance it.
            >
            > Thanks again for your time.
            > Devang.
          Your message has been successfully submitted and would be delivered to recipients shortly.