on 05-26-2008 2:52 PM
Hi All,
I want to store the output XML in file
but file isn't create
what's the reason?
and if you have a solution
regards
Yossi
String xmlFile = "yossi.xml";
File file = new File(xmlFile);
/////////////////////////////
//Creating an empty XML Document
//We need a Document
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
//create string from xml tree
StreamResult result = new StreamResult(file);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
Can you add a statement that prints the absolute file name of the output file? Is the file created at this path?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To Sumit
Because I need the file to apply Network UI Element
and for Network I nedd XML File
unless you know method that i can read the XML from the memory
to the NetWork
Regards
Yossi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yossi why not u create a blank XML file and then put XML String in it....
i applied this approach and its working fine...
regards,
Sumit Malhotra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ayyapparaj
Thonk you for answer
but it's not working
Do you have anoter solution?
Regards
Yossi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It seems that you dont have rights.
Try with the following code
String fileName = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"yossi.xml");
File file = new File(fileName);
/////////////////////////////
//Creating an empty XML Document
//We need a Document
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
//create string from xml tree
StreamResult result = new StreamResult(file);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.