当前位置:编程学习 > C#/ASP.NET >>

怎么才能将XML使用的dtd的定义转换成HTML标签

syndication_xml.dtd用来对3-d_72281.xml格式做验证

现在有个需求是要将xml中的部分DTD定义转换为HTML输出,不太理解这个转换过程是在哪里实现的?

DTD仅仅是提供了对XML数据验证,还是说通过某种方法直接可以将DTD定义直接转换为标准HTML标签?


如:
3-d_72281.xml
<?xml version="1.0" ?>
<!DOCTYPE article SYSTEM "syndication_xml.dtd">
<article artclid="72281" capturedate="2009-12-02" version="2.0" distribution="1115"><title><titltxt>3-D</titltxt></title><vargroup>also called <e ty="b">stereoscopic,</e></vargroup><firstpar>motion-picture process that gives a three-dimensional quality to film images. It is based on the fact that humans perceive depth by viewing with both eyes. In the 3-D process, two cameras or a twin-lensed camera are used for filming, one representing the left eye and the other the right. The two lenses are spaced about 2 <frac><num>1</num><den>2</den></frac> inches (6.3 cm) apart, the same as the separation between a&elipsis;</firstpar><p>For more information on <link url="http://www.britannica.com/EBchecked/topic/593703/3-D">3-D</link>, visit Britannica.com.</p><copyright>Copyright © 1994-2010 Encyclopædia Britannica, Inc.</copyright></article>


syndication_xml.dtd
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML DTD for syndication of Core articles. Copyright (c) 2001-2003 Encyclopaedia Britannica,
    Inc. Typically invoked by
      <!DOCTYPE article SYSTEM "syndication_xml.dtd">
-->
<!ENTITY % ebentity SYSTEM "syndication.ent">
%ebentity;
<!ENTITY % incl "e | xref | refpt | assembly | inline | tbl | sup | sub | formula | frac | int | sqroot | link">
<!ENTITY % contenttags "e | sup | sub | formula | frac | int | sqroot">
<!ENTITY % text "list | qt | poetry | table">

<!ELEMENT core        ((article | titlref)+)>

<!ELEMENT titlref     (title, tpar, copyright)>
<!ATTLIST titlref
artclid CDATA #REQUIRED
capturedate CDATA #REQUIRED
version CDATA #REQUIRED
distribution CDATA #REQUIRED
>
<!ELEMENT tpar        (#PCDATA | %incl;)*>

<!ELEMENT article     (title, category?, vargroup*, countrystat?, firstpar?, authcr*, (p, authcr*)*, h1*, elmtbl?, copyright)>
<!ELEMENT link (#PCDATA | %contenttags;)*>
<!ATTLIST link url           CDATA     #REQUIRED>
<!ELEMENT inline      (asset)>
<!ELEMENT arttext (#PCDATA | %incl;)*>
<!ELEMENT tbl (#PCDATA | %contenttags;)*>
<!ATTLIST tbl
artclid CDATA #REQUIRED
filename CDATA #REQUIRED
>
...
<!--Equivalent to HTML <table border="1">.-->
<!ELEMENT tablehd (row)>
<!--Equivalent to HTML <caption> within <table>-->
<!ELEMENT tablefoot (row)>
<!--Equivalent to HTML <tr>, always at bottom of table.-->
<!ELEMENT tablebody (row+)>
<!--No real HTML equivalent.-->
<!ELEMENT row (cell+)>
<!--HTML <tr>-->
<!ELEMENT cell (#PCDATA | %incl;)*>
<!--HTML <td>-->
<!ELEMENT elmtbl (datatype, datavalue)+>
<!--For XSL, should be HTML <table border="0">. For each pair of datatype, datavalue elements,
create a <tr>, with datatype as the first <td> and datavalue as the second <td>.-->
<!ELEMENT datatype (#PCDATA | %contenttags;)*>
<!ELEMENT datavalue (#PCDATA | %contenttags;)*>
<!ELEMENT countrystat ((info, datavalue)+) >
<!--For page display, create as a borderless table, with info in first column and data in the second column.-->
<!ELEMENT info       (#PCDATA | %contenttags;)* >
<!ELEMENT copyright (#PCDATA | link)*>


需要将xml中的 
<frac><num>1</num><den>2</den></frac>


转换为HTML格式的
<span class="bps-article-fraction"><sup>1</sup>/<sub>2</sub></span>
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,