今天写了一个简单的XML,丢到浏览器中时有这样的提示:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
这是“XML样式”的问题。
可以有两种方式定义XML的样式:CSS和XSLT。
CSS的例子如下:
test.xml
<?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/css" href="test.css"?> <test> <name>OldWang</name> <sex>male</sex> <birthday>8.22</birthday> <skill>AI</skill> </test>
test.css
resume{ display: block;} name{ display: block; font-size:120%;} sex{ display:block; text-indent:2em} birthday{ display:block; text-indent:2em} skill{ display:block; text-indent:2em}