How can I add ?xml-stylesheet to an XML file?

Hi guys,
I have a java code that writes out an XML file. I want to specify the name of a stylesheet in the XML file. How can I do that?
This is the source code I have:
//---------- Create XML File ------------------
private void createXMLFile(Document doc) throws Exception
try
TransformerFactory tF = TransformerFactory.newInstance();
Transformer tr = tF.newTransformer();
FileOutputStream outXml = new FileOutputStream(xmlFile, false);
tr.transform(new DOMSource(doc), new StreamResult(outXml));
outXml.close();
catch (java.io.FileNotFoundException exc)
throw new Exception(exc.getMessage());
catch( TransformerConfigurationException exc )
throw new Exception(exc.getMessage());
catch( TransformerException exc )
throw new Exception(exc.getMessage());
Thank you
Murat

The solution from dvohra09 will output a file outXml that uses the format rules from stylesheet.
But how can I write out the following 2 lines to outXml? contextHandler.startDocument() will only write out the first line, but not the second line...
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="mytest.xsl"?>
Thanks for all pointers!
Philip

Similar Messages

  • How can I add a password to my PDF file ?

    I'd like to know How can I add a password to my PDF file ?
    Regards,

    Acrobat Help | Securing PDFs with passwords

  • How can we add new entry to a XML file?

    Hi All,
    I'm having problem to add new entry (elements &
    attributes) to an existing XML file. I have created an XML file.
    Few entries are there which I'm showing in a datagrid. Now, in run
    time I have provision for new entry. I'm gathering the whole
    entered information & preparing a string in the same format
    what I have in XML file. But when I'm trying to add that entry to
    my existing XML it won't work. How can I will be able to do
    so?

    Are you using appendChild()?
    Tracy
    BTW, this forum is for Flex Builder questions. Language
    questions should go in General Discussion.

  • How can i add a time stamp to tdms file?

    I want the data and the time for the tdms file generated?
    how can i do that?
    should i cinvert .tdms to .lvm and use the data storage option or excel add on option for .lvm file created?
    cant i directly have the time stamp for tdms file generated?

    How are you acquiring the data in the first place?  That will matter in how we want to approach this.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I add a line to my CSS file to have all TextArea fields show PRE

    Hi,
    I would like all my TextAreas to show the text as it was inserted into the database... with the new lines, tabs, etc...
    I would like to add a line to my CSS file to do this if possible.
    Thanks, Bill :>)

    Thanks for all the input!
    Fab. You have been talking about a report the whole time... I have been talking about one Database ITEM that is "Displayed as Text".
    In a report the replace() always works in all browsers I believe... and I had no problem.
    BUT, in a text ITEM I wasn't able to get anything to work..
    So, I created a report region and retieved this one column (item) and selected a borderless region and it is fine...
    select     replace(LAST_ACTION,chr(10),'<BR>') "LAST_ACTION"
    from     "HT_ISSUES" "HT_ISSUES"
    where issue_id = :P7_ISSUE_ID
    I still would like to know how to Display as Text - as it is in the DB.
    When have a Dispay as Text Item and I view Source when running the page.. it is correct in the source delivered to the browser but displays all one line.
    (I save a SQL statement to the field)
    [tr>[td  colspan="6" rowspan="6" align="left">[span class="t3NoLabel">Last Action Item[/span> [br>Maintenance Issue - SELECT *
    FROM (SELECT ROWNUM row_num, empno, ename, job, mgr,
    hiredate, sal, comm, deptno
    FROM emp)
    WHERE row_num BETWEEN NVL (:p7_row_from, 1)
    AND NVL (:p7_row_to, 1000000)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can I add form field value to the file name in save as dialog box

    I do not want the form to be saved automatically, just want the form to auto populate the "file name" only.
    A little background on the forms I want to use:  My company has 70 retail outlets, I'll use one of our pdf forms called an "Incident Report" as an example.  I would like for a store manager to be able to complete the form, then email the form to the main office (I already have javascript to add field values and form name to the email subject line), once the main office receives it, I want for them to be able to file the pdf electronically on our server.  We have mutliple forms that we use so I do not want any of the forms to automatically save anywhere, (at this time anyway) I just want the office personnel to be able to click "save as" (or whatever they will need to click) and the form automatically add certain field values from the pdf they have received, of which will be different each time the form is sent to the office (Date, store #, employee name etc.) in addition to the name of the form in the "File name" of the "Save As" dialog box.  The main office employees will decide into which server file the pdf should be saved.
    I'm using Acrobat 8 professional, the stores and office personnel use Adobe reader.
    One little note:  We currently print and file a lot of paper on a daily bases, as soon as I can get this to work, we are going green.
    Me and a lot of trees in this will really apprecitate any help you can give with this!  :-)

    You might want to take a look at the document "Developing Acrobat Applications Using JavaScript" (js_developer_guide.pdf) which is part of the Adobe Acrobat SDK, which can be downloaded here. Read the "Privileged versus non-privileged context" (p. 45ff.). You will find an example for "Executing privileged methods in a non-privileged context". Should be almost exactly what you are looking for.
    Small Outline: For security reasons ("the user always has to know what's going on") you are not allowed to use the "Doc.saveAs"-method without the user permission (--> in a non-privileged context). In order to reach the goal of a privileged context you can use a trusted function. You do this by creating a JavaScript file (*.js) in either the Application-JavaScript-Folder (default location on Windows systems: "%ProgramFiles%\Adobe\Acrobat 10.0\Acrobat\Javascripts") or the User-JavaScript-Folder (default location on Windows systems: "%AppData%\Adobe\Acrobat\10.0\JavaScripts"). Add the following content to the new file:
    myTrustedBrowseForDoc = app.trustedFunction( function ( oArgs ) {
         app.beginPriv();
              var myTrustedRetn = app.browseForDoc( oArgs );
         app.endPriv();
         return myTrustedRetn;
    myTrustedSaveAs = app.trustedFunction( function ( doc, oArgs ) {
         app.beginPriv();
              var myTrustedRetn = doc.saveAs( oArgs );
         app.endPriv();
         return myTrustedRetn;
    The developer guide actually wants you to add this content to the existing "config.js" file. I recommend creating a new file, since its easier to deploy in a network. Either way, every client/user who needs to be able to save documents this way, needs this JavaScript Code in his Application/User-JavaScript-Folder.
    Within the Acrobat Document, which you want to obtain a certain file name, you can now use the trusted functions "myTrustedBrowseForDoc" and "myTrustedSaveAs" to store the file. To call the trusted functions and deliver the file name you can either you use a form field (button) or you add a new menu item. Add the following JavaScript Action to the button/menu item and change "Roller Coaster" to the name of the field which contains the value which you want to become the new file name:
    var fileName = this.getField("Roller Coaster").valueAsString;
    try {
         var oRetn = myTrustedBrowseForDoc({bSave: true, cFilenameInit: fileName + ".pdf"});
         try {
              myTrustedSaveAs(this, { cPath: oRetn.cPath, cFS:oRetn.cFS });
         catch(e) {
              console.println("Save not allowed, perhaps readonly.");
    catch(e) {
    console.println("User cancelled Save As dialog box");
    Good Luck!

  • How can I add a header to a text file without mapping? [Using only ID]

    Hi Experts,
    I am doing a scenario in which I want to add a dynamic header to a text file, due to the complications related to the structure, I dont want to create a message type, data type etc so I cant use mapping.
    I want to do all the manipuations in Integration Directory itself.
    Can you all please help me out in this?
    Thanks in advance
    Thomas

    Hi  Experts,
    I am new to XI, so only elaborate answers would help me
    This is the specific requirement i want;
    There is a 'source text file' which is a collection of 1000+ records, I want to make a 'target file' which is a combination of 2 fields, one field will be the dynamically generated name [for the target file] and the other field will be the whole 'source file' content.
    From the last response for my question, I understand the dynamic file generation part can be done using java mapping.
    Is there anyway by which I can get in the whole content of the source file into a field in the target file?
    Thanks in Advance
    Thomas

  • How can i add a library on an ipa file ?

    the solution from www.mocana.com  allows for maximum user flexibility and native experience, while not risking corporate intellectual property.
    * Increase productivity by fully supporting bring your own device (BYOD)
    * Embrace Bring Your Own Device (BYOD) without additional IT burden or privacy issues
    * Use best-in-class, military-grade security methods by a company known for its security legacy
    * Highest level of security protecting corporate data
    * No programmatic effort to secure the apps -  MAP is automated and can take prior written apps and secure them in under 5 seconds
    can someone tell me how this works?

    it works ... but i don't know how ... example :
    the solution from www.mocana.com  allows for maximum user flexibility and native experience, while not risking corporate intellectual property.
    * Increase productivity by fully supporting bring your own device (BYOD)
    * Embrace Bring Your Own Device (BYOD) without additional IT burden or privacy issues
    * Use best-in-class, military-grade security methods by a company known for its security legacy
    * Highest level of security protecting corporate data
    * No programmatic effort to secure the apps -  MAP is automated and can take prior written apps and secure them in under 5 seconds
    i hope someone can tell me how....

  • How can I add document folders in iPad with File Sharing

    I am using Aji Annotater.
    Because I have large amount of PDF files, I use File Sharing.
    I want to add the entire folders and organize them as they are.
    But, I can only select file by file basis. Although I can make a multiple choice, I can organize them in folders.
    Does File Sharing support making folders?
    Thank you.

    As far as I know you can't create folder in file sharing. However, the app GoodReader (which reads PDFs and other files) allows creating folders on the iPad and those folders show in file sharing. However, you can't access items in the folder nor add items to a folder. Same applies to some other apps which allow folder creation.

  • How can I add a new vaiable to the file loaded by Property Loader without changing my script

    I have an input file to my script that I load via Property Loader. The number of parameters in the input file may change from test to test.. Is it possible in some way to add a new parameter without changing the sequence file?
    Is there for example a way to make the Property loader read parameters until end of file, and put the parameter into a temporary variable in my script?
    Hope there is a way to resolve this.
    Cheers
    Claus Christophersen

    Claus,
    The solution you have is a valid one.
    Basically you have a variable (global or local) and you import the expected parameter to this variable before you pass it to the hardware.
    You use that variable as the input parameter you pass to your hardware of course.
    You have to modify your source file depending on the test type you want to execute every time you want to change the test type though.
    Another solution would be to use Data Markers in your file to separate the variable values corresponding to each test type.
    Check the example I am attaching.
    At the beginning I prompt the user for the Test Type (Type I or Type II).
    Based on the type, I import the corresponding variables from the source file using Data Markers.
    If you have questions let me know.
    Attachments:
    SourceFile.zip ‏8 KB

  • How can I add the date to a PDF file that always displays today's date?

    I am trying to convert a word document into a PDF file. The word document has a field code for the date, but when I convert it to PDF format, the field code is not preserved.

    Convert using what?  Acrobat?  PDF Pack?  Microsoft Office?

  • How can I add advertisement code into flash game?

    hi mates,
    just want to ask about loading advertisement code!
    How do you add the advertisement code (adsense) into flash games??
    my site Funny Games have over 5k games but they are getting from others sites thus I have no original files. How can I add more code into the current files?

    Unless the games were pre-made to allow you to specify some variables in the page code or some external file, you won't be having any luck... you cannot add code to the games unless you have the source files, which you apparently don't have.

  • How can I add more items to an array?

    hi there
    I have a file chooser to select files. and store them in a File[] listfile. but if I need to add some more files to this listfile, how can I add them without deleting previous selected files? I know I can use List class to do this, can I just use listfile directly?
    thank you

    You can't change the size of an array once you have created it. You can use a List, as you say, or you can copy the array entries to a new array of a different size.

  • In FF4 the opensearch detection does not seem to work. how can I add a search engine , that has an opensearch xml but no plugin?

    if you go to a webpage with an opensearch link tag like "&lt;link rel="search" type="application/opensearchdescription+xml...." FF3.x highlighted the small arrow left of the search box and you could add the search engine. this does not seem to work in FF4.
    If a searchengine for example for the intranet, does not offer a plugin, just the opnesearch xml, how can one add it to the search engines in FF4?

    You do not get the blue glow on the search engine icon in Firefox 4, but you should still see the "Add ... site" entry in the menu if you click the search engines icon on the Navigation Toolbar.

  • How can I export a stylesheet (either CSS or XSLT) with XML from indesign?

    Hi,
    I am using indesign CS4. I want to export style sheet whether it is CSS or XSLT file with xml.
    I try to get it but can't.
    Also the XML i am exporting does not styles that has been applied by me while creating the file in Indesign.
    Please help me out by telling me the way how can i get a stylesheet and also how can I embed that style sheet with XML so that my XML file looks similiar to the indesign file.
    Thanks,
    Choudhary Nafees Ahmed

    I am using indesign CS4. I want to export style sheet whether it is CSS or XSLT file with xml.
    CSS is not an XML style sheet, it's an HTML style sheet. "Export to HTML" will export an empty stylesheet for the paragraph and character styles. ID cannot convert its (very advanced) typographic capabilities to the (very limited) CSS notation, and thus it defaults to exporting the names only.
    XSLT is not an XML style sheet either; it's a transformation format (http://www.w3.org/TR/xslt).
    I try to get it but can't.
    Also the XML i am exporting does not styles that has been applied by me while creating the file in Indesign.
    XML Export does not export anything except the items you tagged with the Auto-tag feature, or you tagged yourself. If you need your styles tagged, use Map Styles to Tags (http://www.adobe.com/accessibility/products/indesign/mapping.html).
    XML has almost nothing to do with styling -- ideally, XML describes document structure while styles describe formatting.

  • How can I add links to open xml and csv files stored in another location? Please advice how to place links in my frame maker document?

    Hi,
    I would like to know as to how can I add links to open xml and csv files stored in another location? Please advice how to place links in my frame maker document?
    Kindly advice.
    Thanks
    Priya

    Special > Hypertext > Command "open document" will do its best to open the target document inside FrameMaker, which may not be much help; Special > Hypertext > Command "message …" will use the application you specify. The user guide for 7.0 says this about absolute links, and I don't think anything has changed since:
    For example, to start PaintBrush and open the Ship.pcx file on drive C you would use the command message system pbrush.exe C:/Ship.pcx
    I've not often used a relative link, and not recently: the same source says
    folder levels are separated by a slash / even in Windows and Mac
    [relative links] FrameMaker searches for a relative pathname beginning in the folder that contains the current document
    [absolute links] FrameMaker searches for an absolute pathname beginning at the top of the file system. In Windows, the absolute pathname begins with the drive specifier, a colon and a slash.

Maybe you are looking for

  • Implicit and explicit?

    Hi: What is meant when a parameter or a cast etc. is referred as implicit? What is meant when a parameter or a cast etc. is referred as explicit? Thanks.

  • Snow Leopard 10.6.8 to Mavericks?  Not for everyone!

    I have one of the mid 2007 24" iMacs which actually does not show the year in the Apple information area and since I bought this iMac from someone else, I dont know the year.  The Apple Information area just says MAC OS X version 10.6.8 yet when I go

  • To use Home Sharing, do both my computers have to be on and running iTunes?

    I just got a Macbook and I'm trying to transfer all the items in my desktop computer to it. I had both computers on with Home Share on and everything was working fine. I left the computers to do their thing (transfering 30+ hrs of video takes a coupl

  • Imovie has disappeared~

    Well essentially, imovie no longer exists on my mac. When I search, it doesn't come up, when I download a update, it says there's no imovie to update from. I'm almost certain that I couldn't have accidentally deleted it that I seldom ever use it to r

  • Managing multiple IPAD's

    I run a small business and sync various IPAD's and IPHONES on the one AppleID.  I am not sure what to do when I sync with apps that people have purchased on their own accounts.  It seems to transfer it to my APPLEID but that creates problems later wi