How to add XML declaration to document using JDOM?

Hi, there:
I am trying to create a document. I want to add the following xml declaration to
the document:
<?xml version="1.0"?>
JDOM Document class can add elements and attributes or doctype, does it have ability to add xml declaration to the very start of a document?
regards,

that line should be added automatically to the document when you serilize your DOM.

Similar Messages

  • How to add a record in document library without upload file.

    Hi,
    how to add a record in document library without upload file?
    Is it possible? I want to create a folders in Document Library but inside folders i do not want to upload a file instead of just i want to create a record. I will map my local file path to the records.
    Can anyone help me on it?
    Thanks & Regards
    Poomani Sankaran

    Hello Sankaran,
    document library is to upload documents, without document you will not be able to add a record or Item to it.
    for your requirement you can use a list and enable folders within the list and maintain the local path of the file as an item in list.
    http://www.sharepointbriefing.com/spconfig/article.php/3834951/Enable-the-New-Folder-Creation-Option-in-SharePoint-Custom-Lists.htm
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • How to add an image over another using af:image

    How to add an image over another using af:image
    Thanks,
    Veera

    i have a image which is black strip. i have added that to af:image
    <af:image source="image1" id="image" />
    on the black strip, i need to add company logo.
    how to achieve it.
    Thanks,
    Veera.

  • How do I edit a scanned document using Adobe services?

    how do I edit a scanned document using Adobe services?

    To edit a document you will need Acrobat Pro.

  • How do I edit and sign documents using adobe?

    How do I edit and sign documents using adobe?

    To edit a document you will need Acrobat Pro.

  • How do I crop a Preview document using Mountain Lion

    How do I crop a Preview document using Mountain Lion

    Bring up the Edit toolbar and choose the crop tool. Choose the area to crop. Then comd-k or "Crop" from the "Tools" menu.
    EDIT: As baltwo says if it's a document crop won't work.

  • How do you write on the documents useing using work space

    how do you write on the documents using work space

    What type of documents are you trying to write on?

  • How to add target to jmsSystemResource MBean using JMX

    Does anybody know how to add target to jmsSystemResource MBean using JMX in WebLogic 9.0?(I am not using WSLT) I always get "NoSuchMethodException":
              [jmsServer] Caused by: java.lang.NoSuchMethodException: addTarget(weblogic.management.configuration.
              TargetMBean,) for com.bea:Name=admin01DefaultJMSServer,Type=JMSSystemResource

    go to the object which u want to compare
    go to->version management->select the TR request no->and select remote comparision there->and give the system where u need to compare this object
    and next press compare
    hope it will work
    cheer
    s.janagar

  • HT5654 how to add videos to the ipad using the latest version of itunes

    how to add videos to the ipad using the latest version of itunes ?

    Hello zaraa90,
    After reviewing your post, I have located an article that can help with syncing content. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
    Sync your iPhone, iPad and iPod with iTunes using USB
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • I forget how to add audio to a document I have made.

    I forget how to add audio to a document I have made.

    lola2610 wrote:
    I can duplicate but that is not what I am looking for.
    This is what it is for. Save As doesn't change the behaviour of Autosave. All changes always get saved at all times. If you want to save as a new document, then do that. If you want to do a save as, just don't make any changes beforehand.
    Second problem is the load of internet pages! It is sooooo slow...
    Try a new DNS server such as OpenDNS. The ones your ISP gives you can be very bad.

  • How to add discussions to Collaboration Room using Rooms API

    Hi All,
    How to add discussions to any room using the Rooms API?
    I looked at the NW04s javadocs, but could not find which would help?
    Any pointers will be appreciated.
    Regards,Sandip

    Hi All,
    Any help!
    Any help from SAP? Are the discussion APIs available?
    Any input is appreciated. Thanks
    Regards
    Sandip
    Message was edited by:
            Sandip Agarwal

  • How do I sign a Adobe document using Adobe Acrobat 9Pro?

    How do I sign a Adobe document using Adobe Acrobat 9Pro?

    Hi Calvin ,
    Please refer to the following links to sign a document using Acrobat 9
    http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/acrobat_digsig_userguide_90. pdf
    http://www.adobepress.com/articles/article.asp?p=1272495
    Stay well.
    Regards
    Sukrit Dhingra

  • Could not parse well-formed HTML 4.01/XHTML 1.0 document using JDOM

    Hi All,
    I am having difficulty reading two well-formed HTML document using JDOM when running offline (not on the Internet). The first few lines of these documents are listed below:
      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
      2 <!-- saved from url=(0044)http://www.mongabay.com/igapo/zipcodes/CA.htm -->
      3 <HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Cities and Towns in California starting with A - Zip codes United States of America</TITLE>
      4 <META http-equiv=Content-Type content="text/html; charset=UTF-8">
      5 <META
      6 content="california, cities, towns, villages, list, zipcodes, postal codes, us, ca"
      7 name=keywords>
      8 <META
      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      2 <html xmlns="http://www.w3.org/1999/xhtml">
      3 <head>
      4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      5 <meta name="keywords" content="8024, california, postcode, map, america, postal code, alabama Hills, Adelaide, Aberdeen, la, la, california" />
      6 <meta name="description" content="93545 zip code for Alabama Hills, Adelaide and Aberdeen (LA), California (CA) with map and local information." />
    The Java snippets that references these documents (local files) is as follows:
    1      public static void main(String[] argv) 
    2       {
    3            File zipcodefile = new File("C:\\TEMP\\Zipcodes Listing for California.txt");  // former
    4            //                                                     or
    5            File zipcodefile = new File("C:\\TEMP\\Zipcodes Listing for California  - 93545 - Los Angeles, CA.txt");  // later
    6            try
    7            {
    8                SAXBuilder saxBuilder=new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    9                // saxBuilder.setValidation(false);
    10              org.jdom.Document  doc = saxBuilder.build(zipcodefile);
    11              System.out.println(doc.getContent());
    12              System.out.println(doc.getDocType());
    13              ....( i ) This program would does not work even while it was running on-line (has Internet access). The execution process would exit on line 10 but not sure whether it completes it or not. Don't understand why though?
    ( ii ) What is the difference between the two files as far as the format goes? I thought HTML 4.01 is equivalent to XHTML 1.0? In other word, they are already well-formatted and so they can be parse directly by an XML parser such as Xerces. In other word, it is not necessary to use tool such as Tidy to convert to clean up missing tags?
    ( iii ) why are the tags in the former file in capital? Do parsers in general distinguish tags in capital compared to lower case?
    I am very new to XML parsing and would appreciate some guidances.
    Thanks a lot,
    Jack

    Hi,
    I am following a possible solution (http://devdiary.motime.com/post/471628/Why+implement+your+own+EntityResolver?) on how to redirect references to entities within an XML document to a local file but do not understand why it is not picking up the parsing file (former). Below is a complete change of ZipcodeTidy2JDomParser to include my own EntityResolver:
    1  public class ZipcodeTidy2JDomParser {
    2     public static void main(String[] argv) {
    3         try {
    4             File zipcodefile = new File("C:\\TEMP\\File zipcodefile = new File("C:\\TEMP\\Zipcodes Listing for California.txt"); // former
    5             SAXBuilder saxBuilder = new SAXBuilder(false);
    6             saxBuilder.setEntityResolver(new EntityResolver() {
    7             public InputSource resolveEntity(String publicId, String systemId) {
    8                 try {
    9                     if (systemId != null && systemId.endsWith(".dtd")) {
    10                         return new InputSource(getClass().getResource("E:\\Temp\\Software Development\\Download\\Forum\\html-loose.dtd").openStream());
    11                     }
    12                 }
    13                 catch (IOException e) {
    14                     e.printStackTrace();
    15                 }
    16                 return null;
    17               }
    18             });
    19             InputStream is = new FileInputStream(zipcodefile.getName());
    20      //     InputStream is = new FileInputStream(zipcodefile);
    21             Document document = null;
    22             try {
    23                 document = saxBuilder.build(is);
    24     //          document = saxBuilder.build(zipcodefile);
    25             }
    26             catch (JDOMException e) {
    27                 e.printStackTrace();
    28             } catch (IOException e) {
    29                 e.printStackTrace();
    30             }
    31             finally {
    32                 if (document == null) return;
    33             }
    34             System.out.println(document.getContent());
    35             System.out.println(document.getDocType());
    The output from running ZipcodeTidy2JDomParser is:
    java.io.FileNotFoundException: Zipcodes Listing for California.txt. (The system cannot find the file specified)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(FileInputStream.java:106)
            at java.io.FileInputStream.<init>(FileInputStream.java:66)
            at JDOMXPath.ZipcodeTidy2JDomParser.main(ZipcodeTidy2JDomParser.java:19){code}
    Could any see where this issue is coming from?
    The author of the same thread suggest that line 5 should add an extra parameter (SAXBuilder saxBuilder = new SAXBuilder(false, "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"). However, the SAXBuilder constructor does not accept the second paramter. Any ideas?
    Many thanks,
    Jack                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to change xml declaration using jaxb Marshaller

    please, my xml declaration, in the output file generated by jaxb: javax.xml.bind.Marshaller is:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    I need to change it in:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="style.xsl"?>
    I don't have idea about how to change.
    thanks a lot alessandro

    Hello.
    public void saveJaxbObjectToFile(String packageName, Object myJaxbObject, String fileName)
    throws JAXBException, ParserConfigurationException, TransformerConfigurationException,
    TransformerException, FileNotFoundException, IOException {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    org.w3c.dom.Document document = db.newDocument();
    JAXBContext jAXBContext = JAXBContext.newInstance(packageName);
    Marshaller m = jAXBContext.createMarshaller();
    m.marshal(myJaxbObject, document);
    ProcessingInstruction processingInstruction = document.createProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"style.xsl\"");
    Node rootElement = document.getDocumentElement();
    document.insertBefore(processingInstruction, rootElement);
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer = transformerFactory.newTransformer();
    transformer.setOutputProperty("indent", "yes");
    transformer.setOutputProperty("encoding", "UTF-8");
    transformer.setOutputProperty("version", "1.0");
    FileOutputStream fos = new FileOutputStream(fileName);
    transformer.transform(new DOMSource(document), new StreamResult(fos));
    fos.flush();
    fos.close();
    Good luck.

  • How to add 'profit center'  under documents of dynamic selections in FBL5N

    Dear Friends,
    In fbl1n (vendor line item display) if i choose dynamic selection ..left side of the window consists of fields....under document ...'profit center' is there....
    In fbl5n(customer line item display) for the same ,profit center is not there.....!!!
    How to add 'profit center' into the available list in FBL5N
    Regards,
    Madhu..!!!

    Hi,
    Do Ctrl + f8 (Change layout).  In it u have profit center for FBL5n
    Pls. assign points, if useful
    Regards,
    Sridevi

Maybe you are looking for

  • PSE 7 File Reconnect Problem

    I have a problem similar to other posts, but no solution found. I replaced my PC and now my PSE7 photos are disconnected. The photos used to be on drive C on the old computer. I moved them (outside of PSE7) to a new drive M. Reconnect will not correc

  • EOU(urgent)

    My scenario is EOU i,e my vendor declared his material as a export material but he selling his product to us(local sale). But he is giving invoice with custom duty and respectively education cess and sec .education cess also. But at the time making P

  • How do I turn off "restore previous session"?

    When I open FireFox-it gives me the option to "restore previous setting" How do I turn this feature off?

  • Creating Photoshop buttons for motion menus and photoshop menus

    Hi I need to create buttons in photoshop for both a photoshop menu and a motion menu on DVD studio pro program Can someone tell me how to do it on both different menus? I really need some DETAILS on how to do it. Thanks for your time and responses ah

  • Embedded iFrame breaking table cell

    At http://www.marquiseknox.com/schedule.htm, you'll see the right margin breaks near the top of the page, as the schedule appears. So I'd like to fix this. All help is welcome!