Solved

XML and DTD

Posted on 2013-12-10
1
434 Views
Last Modified: 2013-12-17
I need to work on a proj that uses XSD's.  I am ok with xslt and xsd's but never used an XSD.

I am trying to use http://validator.w3.org/ to validate.  I am guessing I need to open the XML file in the validator.  I receive the below error.

The following notes and warnings highlight missing or conflicting information which caused the validator to perform some guesswork prior to validation, or other things affecting the output below. If the guess or fallback is incorrect, it could make validation results entirely incoherent. It is highly recommended to check these potential issues, and, if necessary, fix them and re-validate the document.

    Warning Missing "charset" attribute for "text/xml" document.

    The HTTP Content-Type header (text/xml) sent by your web browser (Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0) did not contain a "charset" parameter, but the Content-Type was one of the XML text/* sub-types.

    The relevant specification (RFC 3023) specifies a strong default of "us-ascii" for such documents so we will use this value regardless of any encoding you may have indicated elsewhere.

    If you would like to use a different encoding, you should arrange to have your browser send this new encoding information.


Below is dummy data.

<!ELEMENT employee (name, address, region)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT region (#PCDATA)>
<!ATTLIST region language CDATA #REQUIRED>

Open in new window


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE employee SYSTEM "emp.dtd"> 
<employee>
  <name>Mr. Bill</name>
  <address>123 Main Street</address>
  <region language="English">Yes</region>
  <region language="Spanish">Si</region>
</employee>

Open in new window


Thanks
0
Comment
Question by:CipherIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 39710203
Some comments

- there is an error in your XML that makes the validation fail. You have two region elements. So you would better add a "+" for region in your DTD, like
<!ELEMENT employee (name, address, region+)>

- I would not use an online validator for DTD development, they are slow, and use old validators. I would definitely work from an XML IDE, such as www.oxygenxml.com

- http://validator.w3.org/ has a hard time finding your SYSTEM declaration for the DTD in a local place. In order for it to work you could put the DTD on a server and reference through its URL, like
<!DOCTYPE employee SYSTEM "http://mydomain.be/emp.dtd">
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question