Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

XML and DTD

Posted on 2013-12-10
1
Medium Priority
?
479 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
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

971 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