Converting XML document to HTMl using xsl
Hi,
I'm trying to convert an xml document into html page using xsl. But when I try to open the page in the browser nothing comes up.
I'm not sure if I am using the PrintWriter correctly.
StreamResult result = new StreamResult(new PrintWriter(new (File"text.html")));
Please help.
Oops! I wrote the parenthesis wrong in the previous mail
This is the correct one I use in my program.
StreamResult result = new StreamResult(new PrintWriter(new File("text.html")));
Please help. Its urgent
Similar Messages
-
How to convert word documents to html page in sharepoint online 2013
Hi,
I am new SharePoint and still learning it.
I have been tasked to do the following on office 365 E3 SharePoint 2013 Online edition.
1) I have to create a Web page in asp.net
2) This page needs to show document from a given SharePoint folder and bind them in a grid or dropdown on the asp .net web page
3) On selecting the document from the drop down or gird (on asp .net webpage), I need to show the SharePoint word document as HTML on the webpage (something like word to html) Note: These SharePoint word document may contain Images, bullets, tables etc.
What I have been able to do till now
1) I have been able to connect to SharePoint from ASP .net application.
2) I have been able to retrieve document from a specific SharePoint folder.
3) Read the document from SharePoint folder and bind them to a drop down on the asp .net page.
What is missing?
I am not aware about any API that SharePoint Online provides to convert Word document to HTML. Any code sample or reference on how to will be much appreciated.
I am not also not sure what is the best way of achieving the functionality this?
Thanks
KrishnaIf this was SharePoint server then it would be easy however in O365 You need to create a app which will use the word automation service and below is powershell which you can use for the conversion:-
# This script will convert Docx to PDF using word automation and similarly it can be used to convert to HTML
$wordFile="http://contoso/kick.docx"
$pdfFile="http://contoso/kick.pdf"
$wasp = Get-SPServiceApplicationProxy | where { $_.TypeName -eq "Word Automation Services Proxy" }
$site = Get-SPSite "http://contoso"
$ConvertJob = New-Object Microsoft.Office.Word.Server.Conversions.SyncConverter($wasp)
$ConvertJob.UserToken = $site.UserToken
$ConvertJob.Settings.UpdateFields = $false
$ConvertJob.Settings.OutputFormat = "PDF"
$ConvertJob.Convert($wordFile, $pdfFile) -
Code to translate xml data into html using jaxp ?
Hi all !!
Could you please send me code to translate xml data into html using jaxp
i am sending my xml file and xsl file
its urgent
my xml file is :
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="scenario.xsl"?>
<scenarioReport>
<node name="node1">
<netObjId>124 </netObjId>
<result>undefined</result>
<report>The cell is 124.</report>
<action>qsdsqdqsd </action>
</node>
<node name="node 3">
<netObjId>124 </netObjId>
<result>undefined</result>
<report>Result is unresolved because ...</report>
<action>No action</action>
</node>
<node name="node 2">
<netObjId>124 </netObjId>
<result>undefined</result>
<report>qsdqsdqs </report>
<action>qsdsqd</action>
</node>
<node name="node 5">
<netObjId>124 </netObjId>
<result></result>
<report> </report>
<action> </action>
</node>
<node name="node 4">
<netObjId>124 </netObjId>
<result></result>
<report> </report>
<action></action>
</node>
</scenarioReport>
my xsl file is::
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<h2> Scenario Report</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Nodename</th>
<th align="left">netObjId</th>
<th align="left">Result</th>
<th align="left">Report</th>
<th align="left">Action</th>
</tr>
<xsl:for-each select="scenarioReport/node">
<tr>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="netObjId"/></td>
<td bgcolor="#ffffff "><xsl:value-of select="result"/></td>
<td><xsl:value-of select="report"/></td>
<td><xsl:value-of select="action"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>Must be something wrong with your XSL.
However apparently it was so urgent that you didn't have the time to look at what you posted. They just "fixed" the forum software and apparently it doesn't escape HTML that you type in any more. Or stuff that looks like HTML, either. So your post was unreadable.
If your deadline hasn't passed, try reposting that code surrounded by [pre] and [/pre]. -
Help in creating XML documents in ABAP using XI in new version ECC6.0
Hello All:
I am pretty comfortable with XML and XSLT but new to XI. Is there a way of creating XML documents in ABAP using XI in new version ECC6.0? Please provide me with any links or any information you may have. All the answers will be rewarded.
Thanks.
Mithunhi,
U cant create XML data in ABAP.
to send the data to the XI, u have to use the IDOC or RFC FM, from there IDOC or RFC adapters will read the data in the same format and these adapters will convert the data in to XML .Bcoz XI understand only XML data.
from there XI will process and route them to Destination, by using anthor adapter.
here u can use file adapter if u want data in file foramat from the IDOC or RFC .
So XI is the integration tool only.
reward points if helpful
ragards
sreeni -
How to convert XML document to xml variable?
Hi,
I have taken an xml variable in my process and reading a xml document file. Can anyone tell me how can i convert this xml document to xml variable so that i can parse the xml variable.
I am able to convert xml variable to xml document variable by using set value activity. But how do I perform reverse process.
I want to perform this conversion because i want to keep xml data in document format on storage drive and then parse this xml data so that i can read the nodes.
Any help will be appreciated..
Regards
Sunilwe can use set value activity to reach these xml docs and assign it to xml variable.
Then parsing of this xml can be browsed to find the nodes.
Regards
Sunil -
Want help in converting XML Document to a postscript file
I want to convert XML Document to a postscript file in Java, not from command line. Any help is appreciated.
well, you first need an XML parser, which is easy to implement
then you need to either write the postscript out bit by bit or use a Java API that writes PostScript for you.
It's really simple, the trick is HOW you decide to write out the PS -
How to Create Test Sequence Document in HTML using command line
How to Create Test Sequence Document in HTML using command line
I have lot of sequences and I want to create Test Sequence Documentation in HTML format using Command Line automatically, is there a way to automate this task using .bat file or using C# .NetIf you aren't able to figure out how to call a C++ DLL in .net then there may be another option. Unfortunately I don't know how to do this off the top of my head and I don't have an example.
The other option would be to change docgen.seq a little bit to the dialog doesn't display and you just hardcode the options. Then you can use a command line to call testexec.exe: http://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/startup_opt/
Hope this helps,
jigg
CTA, CLA
teststandhelp.com
~Will work for kudos and/or BBQ~ -
Idea about convert word document to pdf using java api
idea about convert word document to pdf using java api if any one find it mail me at [email protected]
api if any one find it mail me at
[email protected]
What happend to your other mailID :
[email protected] ????
http://forum.java.sun.com/thread.jspa?threadID=639851&
messageID=3756910It received the Spam Of Death. RIP -
Is it allowed to convert pdf documents into rtf using Adobe SDK
Hello
Can I convert pdf document into rtf using Adobe SDK?
Is available this functionality on c# code? Which assemblies i can use for it?which is why it has to be on the desktop and not a server.
I didn't quite understand your statement. Could you, please, explain, why I can't use it only on the desktop and not a server? And, could you provide documentation, where I can find information about converting documents using c#? -
Problem in transforming xml to html using xsl
Hi everybody ,
I am creating a xml in memory and i want to transform using xsl into an html.
I want to embed some html code also in the data node.But when I get the html it simply writes as it is. I tried to make it cdata section but it did not worked. Pls help.
crypticashu
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class mytemp {
public static void main(String args[])
DocumentBuilder builder = null;
Document document = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try
builder = factory.newDocumentBuilder();
document = builder.newDocument();
catch (ParserConfigurationException e)
e.printStackTrace();
Element root = (Element) document.createElement("REPORT");
document.appendChild(root);
Node child = document.createElement("DATA");
CDATASection data = document.createCDATASection("<b>Hello World </b>");
child.appendChild(data);
root.appendChild(child);
document.getDocumentElement().normalize();
DOMSource domsource = new DOMSource(document);
TransformerFactory tfactory = TransformerFactory.newInstance();
File f = new File("c:/mytemp/report.xsl");
StreamSource xsl = new StreamSource(f);
File html = new File("c:/myhtml.html");
try
Templates templates = tfactory.newTemplates(xsl);
Transformer transformer = templates.newTransformer();
transformer.transform(domsource, new StreamResult(html));
catch(Exception e)
e.printStackTrace();
}want to embed some html code also in the data node.But when I get the html it simply writes as it is.That statement contradicts:
In real application i will be getting data containg html tags.I want the parser to read that data as simple text. Both cannot be true. You either want the HTML to not be parsed or you want the transformer to deal with it. Which one?
- Saish -
How to convert from xml file to html using java code
How to convert from xml file to html file using java code
Get yourself Apache Xalan or Saxon or some XSLT processor
String styleSheet = "/YourXSLTStylesheet.xsl";
String dataSource = "/YourXMLDocument.xml";
InputStream stylesheetSource = TransformMe.class.getResourceAsStream(styleSheet);
InputStream dataSourceStream = TransformMe.class.getResourceAsStream(dataSource);
OutputStream transformedOut = new FileOutputStream("filename.html");
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(stylesheetSource));
transformer.transform(new StreamSource(dataSourceStream), new StreamResult(transformedOut));You'll also need to learn XSLT if you don't already know that. Here's a good place to start
http://www.w3schools.com/xsl/ -
ENTITIES and transforming XML to XML/HTML using XSL
I am going absolutely nuts. When using XSL to transform an XML
file to HTML or another XML schema, critical entities dissappear.
For example:
<oldtag>press "any" key</oldtag>
will get rendered to
<newtag>press "any" key</newtag>
by the XML/XSL parser, which is not valid HTML or XML.
How do I preserve these entities through the transformation
process. Escaping the text (in the XML source) with <![CDATA[]]
is not possible in this case.--Michael
nullAssuming you can't use a CDATA in the DTD to prevent parsing,
then my suggestion would be to use the XSL stylesheet to restore
the entities as there is no way that I am aware of that will set
conditional expansion.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
Michael Van Auken (guest) wrote:
: I am going absolutely nuts. When using XSL to transform an
XML
: file to HTML or another XML schema, critical entities
dissappear.
: For example:
: <oldtag>press "any" key</oldtag>
: will get rendered to
: <newtag>press "any" key</newtag>
: by the XML/XSL parser, which is not valid HTML or XML.
: How do I preserve these entities through the transformation
: process. Escaping the text (in the XML source) with <![CDATA
: > is not possible in this case.
: --Michael
null -
How to display xml to html using xsl?
hi all...may i know how to display xml to html page?
i ve included <xsl:output method="html" indent="yes" /> inside my xsl file. i clicked on output.xml file and everything is displayed correctly but the format is xml instead of html. is there anyway to transform it to html?
below are my xsl and xml codes:
// xsl file
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<h2>Document Contents</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="center">Document Name</th>
<th align="center">Document ID</th>
<th align="center">Owner</th>
</tr>
<xsl:for-each select="Document/Contents">
<tr>
<td><xsl:value-of select="DocumentName"/></td>
<td><xsl:value-of select="DocumentID"/></td>
<td><xsl:value-of select="Originator"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
// xml file
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xsltStyleSheet.xsl"?>
<Document>
<Contents>
<DocumentName>register</DocumentName>
<DocumentID>1</DocumentID>
<Originator>hhh</Originator>
</Contents>
</Document>
</xsl:template></xsl:stylesheet>your XSL transforms to HTML (in fact XHTML): what more do you expect? did you expected anything different from the following output? if yes: what and why?
<html>
<body>
<h2>Document Contents</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="center">Document Name</th>
<th align="center">Document ID</th>
<th align="center">Owner</th>
</tr>
<tr>
<td>register</td>
<td>1</td>
<td>hhh</td>
</tr>
</table>
</body>
</html> -
Create an XML Document with HTML Entities?
I'm writing a program that uses SAX to parse an XML document and generate XHTML from it, but I would like the XML document to allow HTML entities, of course, in the XML markup.
Each time my parser gets to any entity at all it dies reporting an undefined entity.
Is there any way I can refer to the HTML entity DTD or perhaps, in my own DTD, copy and paste the HTML entities? How would I make a reference like this in my XML document?
ThanksSeems to me you would just put something like<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">before your root element. Or whichever DTD you actually want. I found out about them here:
http://www.utoronto.ca/webdocs/HTMLdocs/HTML_Spec/html.html -
How to convert Xml Document into orcale tempary table
i am creating xml document into java and passing this xml into oracle database and i need to fetch this xml into result set | rowset.
Xml Structure
<Department deptno="100">
<DeptName>Sports</DeptName>
<EmployeeList>
<Employee empno="200"><Ename>John</Ename><Salary>33333</Salary>
</Employee>
<Employee empno="300"><Ename>Jack</Ename><Salary>333444</Salary>
</Employee>
</EmployeeList>
</Department>
i need like this format
Deptno DeptName empno Ename Salary
100 Sports 200 Jhon 2500
100 Sports 300 Jack 3000It does depend on your version as odie suggests.
Here's a way that will work in 10g...
SQL> ed
Wrote file afiedt.buf
1 with t as (select xmltype('<Department deptno="100">
2 <DeptName>Sports</DeptName>
3 <EmployeeList>
4 <Employee empno="200"><Ename>John</Ename><Salary>33333</Salary>
5 </Employee>
6 <Employee empno="300"><Ename>Jack</Ename><Salary>333444</Salary>
7 </Employee>
8 </EmployeeList>
9 </Department>
10 ') as xml from dual)
11 --
12 -- End of test data, Use query below
13 --
14 select x.deptno, x.deptname
15 ,y.empno, y.ename, y.salary
16 from t
17 ,xmltable('/'
18 passing t.xml
19 columns deptno number path '/Department/@deptno'
20 ,deptname varchar2(10) path '/Department/DeptName'
21 ,emps xmltype path '/Department/EmployeeList'
22 ) x
23 ,xmltable('/EmployeeList/Employee'
24 passing x.emps
25 columns empno number path '/Employee/@empno'
26 ,ename varchar2(10) path '/Employee/Ename'
27 ,salary number path '/Employee/Salary'
28* ) y
SQL> /
DEPTNO DEPTNAME EMPNO ENAME SALARY
100 Sports 200 John 33333
100 Sports 300 Jack 333444
SQL>If the XML is a string e.g. a CLOB then it can easily be converted to XMLTYPE using the XMLTYPE function.
Maybe you are looking for
-
"can not start a job" issue in AWM
Hi ALL, I am maintaining my cube from PLSQL with following options 1. buildtype = "BACKGROUND" 2. trackstatus = "true" 3. maxjobqueues = 3 i get following error when i see the "olapsys.xml_load_log" table ***Error Occured: Failed to Build(Refresh) DB
-
MC74 : how transfer SOP to PIR for a specific mrp area
Dear guru , i want to transfer Planning Data of a SOP Version for a single material to Demand Management. The copy to Demand is run directly into the plant of the SOP Version. I manage MRP Area. How can I transfer directly SOP to PIR for a specific m
-
Hi, I've been trying to work this out and can't seem to find a solution. I have a treemap of object and I want to sort them by their names, such as lastname. These object hold all these datas. I wrote myself a comparator class like this: import java.
-
Saving Photoshop files as PDFs and later combining them into a single PDF using the Acrobat Combine Files Into a Single PDF causes a loss of image sharpness. Contrary, opening the Photoshop PDF file in Acrobat and using the Add Pages menu option pr
-
Where is the "Clown" sound?
It went missing after I upgraded to iOS 4. How can I get it back?