Search code examples
cssxmldtd

Xml file cannot read external css or dtd


So Im using notepad++ and i have a really simple xml file for demonstrating the problem.

<?xml version="1.0" standalone="no"?>

<?xml-stylesheet type="text/css" href="stylesheetfamily.css"?>


<family>
    <parent>Judy</parent>
    <parent>Layard</parent>
    <child>Jennifer</child>
    <child>Brendan</child>
</family>

and the external css is this:


family ( color: #8B008B; )
    
parent (
    font-family: Arial Black;
    display: block;
    color: #ff0000;
    border: solid 5px green;
    width: 300px;
    text-align: center;
    )
    
child (
    font-family: verdana, helvetica;
    color: #cc0000;
    border: solid 5px;
    border-color: #cc0000;
    display: block;
    )

If i run the xml file on browser to check it, i wont get the awaiting result. It will show the xml but without reading css file just regular text. If i open the dev console on browser i'll get on styles tab no matching selector or style. Even if i use an external dtd (instead of css) the xml file will show me that DTD is Prohibited, even though the dtd is valid so propably it didnt read the dtd file in first place.


Solution

  • You used parenthesis () instead of curly braces {} in your stylesheet.