I have seen numerous ways to display an XML file in a web page (HTML) but haven't come across one that uses a CSS style sheet.
I have an XML file that already has a CSS style sheet. When the .xml is viewed in a web browser, it displays fine with CSS.
I want to display the same XML file in a webpage (HTML), whats the best way to do that?
Thanks.
If you have a separate styled XML document and you want to display it in an HTML page, you could probably use the <object> tag:
<object height="100%" width="100%" border="0" type="text/xml" data="yourfile.xml">
<!-- alternative content used when the inclusion fails -->
</object>
(Tested in FireFox only). Alternatively, an <iframe> could do a similar job.
Related
I made some kind of internal manual for a webapp that i am developing. I am using Spring Boot and Vaadin 14. How to implement a button that shows that document? The html doc is in my resources folder. I wonder if i am stupid. Or should i write my own controller for this?
A Vaadin application itself is a single dynamic HTML page.
The easiest way to include HTML formatted content (not an HTML document) is to use the Html component.
Html html = new Html("<div><h3>Title</h3><p><b>Bold summary text</b></p><p>Other text</p></div>");
layout.add(html);
Note, when you use the Html component, you need to strip the <head> and <body> tags, as Html's purpose is not to show full HTML documents. The Html component's content should be included inside a single root element - usually a <div> is used for this purpose.
However, based on your use case, I think the Html component will serve you well.
I am trying to export a html div tag(which has svg as well) to PDF using batik. I can achieve to transform just teh svg to PDF. But with div I am facing errors. Any suggestions on how to use html content to PDF using batik.
I referred to this, https://xmlgraphics.apache.org/batik/using/transcoder.html
SAMPLE HTML which I am trying to use, <div id="toexport"><svg>MY CHART</svg> <div>OTHER CONTENTS like LEGENDS</div></div>
My assignment is to create a class in java and add tags through comments to make it look just like this http://docs.oracle.com/javase/7/docs/api/. My problem is though that the CSS doesn't stay with the html file. It comes out without the CSS. I've tried doing
<style>href="http://docs.oracle.com/javase/7/docs/api/stylesheet.css"</style>
but I can't get the CSS to stick. What am I doing wrong?
This is the way you link css files in html
<link href="http://docs.oracle.com/javase/7/docs/api/stylesheet.css" rel="stylesheet" type="text/css">
Did you add the lines as ususer2812693 mentioned. Just check whether, the css is file loaded into the browser using firebug. And also the css classes and ID s are correct with html elements' classes and ID s. Or else, first try to download the css file which you refer and, try to call it locally from your html page.
I currently have a relatively simple Java applet which I am trying to embed into an html page. I've looked around, and haven't found a suitable answer. Many answers refer to using the deprecated <applet> tag, and the rest do not seem to work for me.
This is the body of my page. I initially tried using the <applet> tag and it worked, however I was unable to get it to use the full height of the page, and then I found it is deprecated anyways.
I've tried this on Firefox, Chrome, and IE, and it won't work on any of them. It only shows the alternative text.
I did read that the <object> tag only works for IE, but even so it isn't working for me. Likewise, most of the information I found is outdated.
<body>
<object width="500" height="500" data="project">Your browser does not support the <code>object</code> tag.
</object>
</body>
Ive had no problems using the applet tag to get applets to display to a desired width and height. All the Java resources point to using the same tags. I'm no html guru though, so I'm not sure if there's another solution.
<applet code= "myJavaApplet.class" width="600" height="700">textgoeshere</applet>
How does one apply custom CSS to a HTML report generated using Jasper. I need to include this report as an iFrame into a GWT window.
You can simply include a link tag in your GWT html file like so:
<link type="text/css" rel="stylesheet" href="myJasperStyles.css">
The CSS file should explicitly refer to Jasper-related HTML tags to ensure the CSS won't affect your GWT elements.