Search code examples
xmldtd

Can you define entities in external dtd file, linked to xml file?


My xml:

<Car no="10" CarID="id_111-110">
      <ProductionD>07.12.2010</ProductionD>
      <MarketValue currency="$">12499.99</MarketValue>
      <VisitedCountries>
        <Country no="1">
        &MCountry;
        </Country>
        <Country no="2">
        Andora
        </Country>
      </VisitedCountries>
    </Car>

The entity, placed in another file:

<!ENTITY MCountry "Poland">

In this way, it doesn't work and in Country there is just a blank field, while if i declare the entity directly in the xml file it works just fine.


Solution

  • It depends on your web browser, but most of them doesn't fully support XML. They have restrictions like no external DTD entities.