I am creating an example XML file based on the UBL xsd:TransportationStatus-2. In Eclipse while validating this XML, I get an error,
No grammar constraints (DTD or XML Schema) referenced in the document
I figured out using StackOverflow that putting <!DOCTYPE foo>
, where foo could be anything (xml, xsd, project or even foo for that matter) resolves the error. Like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo>
<ts:TransportationStatus xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ts="urn:oasis:names:specification:ubl:schema:xsd:TransportationStatus-2">
<cbc:UBLVersionID schemeID="UBL">2.1</cbc:UBLVersionID>
<cbc:ID>666</cbc:ID>
<cbc:IssueDate>1947-08-15</cbc:IssueDate>
<cac:Consignment>
<cac:CarrierParty>
<cbc:ID>Ajax</cbc:ID>
</cac:CarrierParty>
</cac:Consignment>
</ts:TransportationStatus>
- Why is this working, because I am using a XSD schema not a DTD?
- Why putting any random keyword manages to solve the warning (foo etc.)?