Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post

    Why is my browser not displaying properly xml

    Hi there. I am new to xml

    Why is it that my browser doesn't display the style i mentioned in the css and just displays it as a plain text like this.

    Code:
    Joe Marini 232322 2321111232 42-232322 abcd@gmail.com
    Here are my codes

    The document is in the same folder and the files are test.xml and testcss.css
    Code:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/css" herf="testcss.css"?>
    <BusinessCard>
    	<name>Joe Marini</name>
    	<phone type="mobile">232322</phone>
    	<phone type="work">2321111232</phone>
    	<phone type="fax">42-232322</phone>
    	<email>abcd@gmail.com</email>
    </BusinessCard>
    and my css

    Code:
    BusinessCard {
    	font-family:Arial, Helvetica, sans-serif;
    	background-color:#DACFE5;
    	width: 300px;
    	display:block;
    	padding:1px solid #0D3427;
    	margin:5px;
    	text-align: left;
    }
    
    Name {
    	color:#0D3427;
    	font-weight: bold;
    	font-size:140%;
    	display:block;
    	margin-bottom: 3%;
    }
    
    phone {
    	font-size: 90%;
    	color: #523819;
    	font-size:90%;
    	display:block;
    }
    email {
    	color: #0D3427;
    	font-size: 90%;
    	font-weight: bold;
    	display:block;
    	margin-bottom: 3%;
    }
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,342
    Thanks
    13
    Thanked 349 Times in 345 Posts
    Code:
    <?xml-stylesheet type="text/css" herf="testcss.css"?>
    because the attribute is named href.

    PS. you don’t have a Name element in your XML.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #3
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Also worth noting that 1px solid #0D3427 is not a valid value for the padding property.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •