File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML content for a Markup

 
Anoop Krishnan
Ranch Hand
Posts: 163
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a structured document in which the i have a mark up <DATA></DATA> which can contain html tags & any other charecters
eg
<DATA>
User Information
<tale>
<tr>
<td>ID</td>
<td>NAME</td>
</tr>
</table>
</DATA>
.So how can i specify this element in the DTD
[This message has been edited by Anoop Krishnan (edited July 02, 2001).]
 
Ajith Kallambella
Sheriff
Posts: 5782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should treat even the HTML tags like any other "normal" XML tags. They are no exceptions.
 
Anoop Krishnan
Ranch Hand
Posts: 163
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply
But i have seen something like this related to xml.What is this actually
<![CDATA[<greeting>Hello, world!</greeting>]]>
 
Ajith Kallambella
Sheriff
Posts: 5782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marking the entire section as CDATA instructs the parser not to process the elements enclosed as XML data, but to treat them as raw data. If the text contains any XML tags, they too are treated as plain text. Often times authors use this trick to prevent some parts of the documents from being processed.
HTH
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Glen Tippetts
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope this is still on topic and relevent to the question at hand:
How do I translate an XML tag to HTML where the tag is a valid XML tag that can be queried with XPATH, but the data within the tag may contain special characters that need to be passed through to the HTML so that the HREF functions properly.
For example:
<url>http://www.brainbench.com/xml/bb/common/testcenter/subcatresults.xml?cat1=9&cat2=31&cat3=22</url>

------------------
IBM Certified Developer - XML and Related Technologies, V1.
AcqURL : The next evolution in bookmark management.
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glen, you can construct your HTML output using {XPath expression}, which is shorthand from <xsl:value-of select="XPath expression">
xml:
<?xml version="1.0"?>
<url>http://www.brainbench.com/xml/bb/common/testcenter/subcatresults.xml?cat1=9&amp;cat2=31&amp;cat3=22
</url>
xslt:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<a href="{url}">this is a link</a>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
output:
<html>
<body>
<a href="http://www.brainbench.com/xml/bb/common/testcenter/subcatresults.xml?cat1=9&cat2=31&cat3=22%0A">this is a link</a>
</body>
</html>
 
Glen Tippetts
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URL inside the tags contains special "&" characters, so the parser chokes on them.
However, I found that if I put the <![CDATA[http://www.brainbench.com/xml/bb/common/testcenter/subcatresults.xml?cat1=9&cat2=31&cat3=22]]> tag inside of the <url> </url> tags everything works fine.
The first time I tried this it didn't work, so there must have been a typo in the code I was using to programatically insert the <![CDATA[var]]> in the XML document I was creating.
Everything is working fine now.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic