Thursday, January 12, 2012

The content of element type "properties" must match "(comment?,entry*)".

I'm trying to make my Java XML properties file a little more human-readable by breaking the entries into blocks. Evidently my assumptions on how to do this were wrong. Here are the error, cause, and solution:

Error:

java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException: The content of element type "properties" must match "(comment?,entry*)".

Cause:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>

<comment>---SQL settings---</comment>
<entry key="SQLJNDIName">SQLDataSource</entry>
<entry key="SQLServerName">server01</entry>
<entry key="SQLPortNumber">12345</entry>
<entry key="SQLDatabaseName">db01</entry>
<entry key="SQLUser">user01</entry>
<entry key="SQLPassword">changeme</entry>
<entry key="SQLTableOwner">dbo</entry>

<comment>---TEST settings---</comment>
<entry key="TEST">TEST</entry>

</properties>


Solution: I changed the comment elements into XML comments, and it worked.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>

<!--SQL settings-->
<entry key="SQLJNDIName">SQLDataSource</entry>
<entry key="SQLServerName">server01</entry>
<entry key="SQLPortNumber">12345</entry>
<entry key="SQLDatabaseName">db01</entry>
<entry key="SQLUser">user01</entry>
<entry key="SQLPassword">changeme</entry>
<entry key="SQLTableOwner">dbo</entry>

<!--TEST settings-->
<entry key="TEST">TEST</entry>

</properties>

14 comments:

  1. Cool stuff you have and you keep overhaul every one of us
    You have done a amazing job with you website
    real estate in Stone Oak

    ReplyDelete
  2. The content writing training institute online in India provides the interested candidates with alluring course module, everything you would like to jump for.
    spin rewriter

    ReplyDelete
  3. Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks. psd to responsive html

    ReplyDelete
  4. For several years now, people have been trying to call me to ask if it is still a good idea to invest in property in the United States? I have been buying properties in the United States for more than 20 years already.
    Read More Here

    ReplyDelete
  5. Superb examining .Thanks for sharing. It's late finding this show up. Juniper Hill Allgreen

    ReplyDelete
  6. They are less likely to lend you money to grow your business and they definitely will not lend you money to buy stocks and shares. They understand that property is still a safe secure asset despite what the media says.deyaar projects

    ReplyDelete
  7. You would want search engines to reward you and expect the traffic to pour in. If you know about SEO, you would also eagerly wait for the monthly website traffic to cross seven figures fast. website content writer

    ReplyDelete
  8. With the ever evolving technology space,freelance content writer the need for the website content writing has become essential for all the businesses and individuals alike.

    ReplyDelete
  9. I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading. I had to go show it to my friend and he ejoyed it as well! Content creation

    ReplyDelete
  10. I am all that much satisfied with the substance you have specified. I needed to thank you for this extraordinary article.home buyers

    ReplyDelete
  11. Wow cool who does not know this site safeonline casino ratings that half of life does not know on this site you can really earn money without blessing.human rights assignments

    ReplyDelete
  12. This is really wonderful and I think that I can get several ideas in remodeling my house. I have been reading about different designs but these is the first time I have heard about the link you have given. Thank you for sharing.Phoenix AZ Real Estate

    ReplyDelete
  13. An interesting dialogue is price comment. I feel that it is best to write more on this matter, it may not be a taboo topic however usually individuals are not enough to talk on such topics. To the next.Glendale

    ReplyDelete