How to output new /new other than new/

I use dom to parse a document to xml String.if a xml node doesn't have node value ,it will output <new/> but not <new></new>.we use this format (<new></new>) to transfer with remote mechine,so how to output this format.
following is my sample code:
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          Document document = builder.newDocument();
          Element root = document.createElement("root"); 
          document.appendChild(root); 
          Element child = document.createElement("new");
          root.appendChild(child);
          Transformer transformer = TransformerFactory.newInstance().newTransformer();
          Properties properties = transformer.getOutputProperties();
          properties.setProperty(OutputKeys.ENCODING, "utf-8");
          properties.setProperty(OutputKeys.METHOD, "xml");
          properties.setProperty(OutputKeys.VERSION, "1.0");
          properties.setProperty(OutputKeys.INDENT, "yes");
          properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "4");
          transformer.setOutputProperties(properties);
          StringWriter sw = new StringWriter();
          transformer.transform(new DOMSource(document), new StreamResult(sw));
          System.out.println(sw.toString());I think that maybe to set some property to the transformer outputproperties.
but I don't know what property will done.
any suggestion is appreciated

Thanks for your respons.My manager has accentuated this format before .maybe I will ask why.
However I don't think it will done after adding child.appendChild(document.createTextNode(""));
it still output <new/>.
I have writed a function to format this xml String like this:
      * format <new/> String to <new></new>
      * @param xmlString
      * @return String
     public static String formatXml(String xmlString){
          int idx = xmlString.indexOf("/>");
          while(idx != -1){
               String temp = xmlString.substring(0,idx);
               int idx1 = temp.lastIndexOf("<");
               String key = temp.substring(idx1+1,idx);
               xmlString = xmlString.replaceAll("<" + key + "/>", "<" + key + "></" + key + ">");
               idx = xmlString.indexOf("/>");
          return xmlString;
     }but i still won't to use it less than the end.

Similar Messages

  • My hard disk crashed and I cannot find out how to "contact customer service" other than this forum.  The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive.  Please help.

    My hard disk crashed and I cannot find out how to "contact customer service" other than this forum.  The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive.  Please help.

    Hi Anthony ,
    Here is the link to connect with Adobe Chat Support.
    https://helpx.adobe.com/adobe-connect/kb/connect-chat-support.html
    Hope your query gets resolved .
    Regards
    Sukrit Dhingra

  • When I open a photo with Preview, it opens all the photos I have viewed previously.  How can I prevent that, other than manually clearing the list after each time?

    When I open a photo with Preview, it opens all the photos I have viewed previously.  How can I prevent that, other than manually clearing the list after each time?

    Close the pictures before you quit Preview. Cmd-opt-q will close all windows and quit. cmd-opt-w will close all windows and not quit.
    Or, Disable automatically opening files that were left open in General System Preferences

  • How to create FDM locations other than manually creatiion?

    In FDQM how will you create the locations? Other than manually how will you create locations?

    Why?
    The point of the API is to give you a 'black box' hook into the application without you having to really understand how it does it's work. Assuming you make the proper API calls, they will create everything properly.
    Nothing wrong with using the API, that's why it is there.
    Edited by: beyerch2 on May 3, 2012 9:28 AM

  • How to jump to tab other than 1st on TLN on portal login?

    Dear Colleagues,
    I have an issue where in the portal Link is sent to customer through email link to execute some specific functions which can be anyother tab on TLN other than 1st tab. How can we make sure that when user calls this link the portal pop-ups with this tab as opened window?
    Thanks & Best Regards,
    Manish

    You can click the dropdown list on the pagebar and select the Add to Browser Favorites. This created a browser favorite link, whose properties will give you the link to the current page.
    Or you can select details, which will give you the pcd address of the page. Take this, starting with "portal_content" and append it to "http://server:port/irj/portal?NavigationTarget=ROLES://. This gives a direct link.
    There must be a simpler way, but these seem to work.

  • ACS 4.2 RDBMS Action 105/108 - How to set to something other than default "RADIUS Token Server"

    I'm trying to create an import script for RDBMS to import users, but cannot figure out how to set the "PASS_TYPE_RADIUS_TOKEN" to something other than the default of "RADIUS Token Server".  We have multiple RADIUS Token Server definitions.
    I can create a user with what I need, except external db password is set to "RADIUS Token Server".  How do I set it to (for example) something like "RADIUS Token Server - xxxx"
    We have more than 1 RADIUS Token Server definition called "RADIUS Token Server - xxxx", "RADIUS Token Server - yyyy". 
    Thanks!

    As per my knowledge you have to update 4.2 ACS to
    5.1, because when you go for RDBMS synchronization it wont allow you, I have faced problem in past while primary ACS was 4.1 and secondary I have 4.2, I have updated primary ACS to 4.2 and everything is working fine.

  • How to upgrade to something other than the most recent OS

    I am currently running Os 10.6.8. I would like to update, but I have a critical application that is only qualified for 10.8.2 and the current operating system is 10.8.4. Is there a way to buy something other than the current OS?

    Apple updates the OS X installer at the Mac App Store with the latest version, and older OS X versions disappear. If you want to upgrade to Mountain Lion and you purchase Mountain Lion at the App Store, you will get the OS X Mountain Lion installer with 10.8.4 installed, so it will install 10.8.4, without any possibility to install 10.8.2.
    You can try changing system files to look like you are using 10.8.1 and try applying the 10.8.2 update, but doing this you may damage OS X Mountain Lion

  • HT3576 How do I see anything other than my calendar in the Notification pull-down screen with the new iOS7?

    Just updated to iOS7.  Pulled-down new Notification screen and all it contains is a summary of my calendar for today and tomorrow.and stocks  I want to be able to see the weather but it is not visible on this screen.  Can't I do this anymore?

    Check settings >> notification center >> today view

  • How to blacklist any IP other than the ones (or range) I specify

    Hi,
    I am new to NAP and have just installed the role on our main server.
    What I would like to achieve is that only device IPs I specify can use the network and access resources including the internet.
    The result would be that any new device that comes into the building, be it a phone or laptop, can not join the network or use the internet without me assigning it a manual IP address and white listing said address.
    How can I achieve this with NAP (or do I need something else)?
    Thanks!

    Hi,
    Im not sure if you are referring to NAP (network access protection) or NPS (network policy server).
    None of which will easily do what you want out the box though.
    NAP performs health checks against client computers and depending on the health of the computer either grants or rejects access to the network. It can be enforced through various methods including DHCP restrictions, IPSec, VPN etc. Some are more secure than
    others. Health checks include items such as the state of the AV, if the firewall is on, if Windows updates is on etc. 
    NPS is basically a RADIUS server. This works in hand with NPS, but can also help you restrict access to networks following certain requirements. Generally this would be used to lock down WiFi networks, and works in tandem with your access points. 
    If you just want to block access to non allowed IP addresses you have a few ways to do this. And it really depends on how full proof you want it, and your current network equipment. You could for example rely upon DHCP filters, and only allow IP's addresses
    you have added to the allow filter in DHCP, any other IP you need to manually add. An other option would be to use the windows firewall, and an proxy / web filter device. The disadvantage of these is someone could give them selves a static IP address matching
    one that you have allowed and that would work. Another option would be to use MAC and IP ACL's on your routers, switches and firewalls if they support it. 
    There are other options too, it really depends on your setup, your budget, and how restricted you really need it. 
    Thanks
    Denis
    Regards,
    Denis Cooper
    MCITP EA - MCT
    Help keep the forums tidy, if this has helped please mark it as an answer
    Blog: http://www.windows-support.co.uk 
    Twitter:   LinkedIn:

  • How to use a warehouse other than the default one?

    i need to create a sale order in different warehouse, 
    thanks

    Hi
    U can create a more than one whse. Make sure before creating the New whse whether the Tick mark is there r not in General settings in Admin-GS-Inventory-Auto add all whse to new items.
    Then in sales order go to the whse column and change the whse which u want....
    Giri

  • How to create used vehicle other than in velo tcode

    Hello All,
    I am new to VMS and i want to know how do we create a used vehicle for action (CRUV).  in a report and then i want to create a purchase order for the vehicle created using trade in action ( POEU ).
    Please let me know if any one has worked on it .
    Thanks,
    Ravi Aswani

    Hi Sagarika,
    use scc4 for creating a new client
    and login to the new client that u created using sap* and pass as password
    use sccl over there to do a local client copy
    sccl for copying local client
    scc9 for remote client copy
    Merlin

  • How to create a client other than 800 in sap 4.7E version?

    helo can any body tell how to create another client in 4.7 version?points r assured.

    Hi Sagarika,
    use scc4 for creating a new client
    and login to the new client that u created using sap* and pass as password
    use sccl over there to do a local client copy
    sccl for copying local client
    scc9 for remote client copy
    Merlin

  • How can I get iOS other than 5.1.1 on an original iPad?

    I can't open some apps because they require newer than iOS 5.1.1. My original iPad will not let me update any further. Help...

    You can't. It's incapable of running iOS versions newer than 5.1.1 and will not activate if an iOS version older than 5.1.1 is force-installed on it.
    (98332)

  • How to skip all files other than .txt file in Mail Sender Attachemnt ?

    Hi Friends ,
                      I am reading  an Mail attachement and sending to R3  using PaloadSwapBean and MessageTransformBean  .
                         I used to get attachement as .txt file , name like Ex10185.txt  in one mail . In another mail Ex10186.txt like that.
                        If only thoses file comes then no problem .
    <b>                   IF some times  along with .txt file some .html files are coming by that time my Mail Adapter incorretly reading the .html file.</b>
                <b>      Please tell me how to skip those kind of attachements and read only .txt file</b>
                          Expecting your answers  asap.
    Best Regards.,
    V.Rangarajan

    Hi Michal,
                   Thanks for your reply , Sorry! I am aware of how to write adapter module. Can you please tell me how to write adapter module ?
                      Is there any links available or Blogs ?
                     I am expecting your reply asap .
    Best Regards.,
    V.Rangarajan

  • How to show different value, other than whatever from database in a Field

    I have a repeatating frame (corresponding to one query).
    there are 6 fields (columns) in th RF.
    Now say in one of the column the database values are like 1,2,3,4 etc..
    I want to show 'ASSIGNED' corresponding to value 1, INPROGRESS corresponding to value 2 etc..
    Could you please tell me how can I do that?
    Regards

    Hi,
    You can create a formula column in your query and try below code. The formula column should have char as return data type
    IF :column = 1 then
       return 'ASSIGNED';
    ELSIF :column = 2 then  
       return 'IN PROGRESS';
    ELSIF :column = 3 then  
       return 'VALUE3';
    ELSIF :column = 4 then  
       return 'VALUE4';
    ELSE
       return 'VALUE5';
    END IF;Regards
    Manoj
    Edited by: ManojP on Jul 19, 2010 7:26 AM

Maybe you are looking for

  • A strange problem when uploading a file in Struts

    When i upload a file, the other elements in the form of the jsp cannot be got by the ActionForm, instead, the getters show that they are "null"s. But when i upload no file, everthing is ok. Moreover, the problem happens when i update an article which

  • DVD-R vs DVD+R and Macs

    Hey there, Can someone tell me what's better to use with a Mac (an older G4 and a new G5) - DVD-4 or DVD+R? Thanks, Kristin.

  • Number Ranges consideration while Data Load

    Hello team we are upgrading from 4.6 to ecc 6.0. abaper is gonna try test load..I already configured number ranges in new system with respect to what is in 4.6. should the number ranges be deleted before the data load tesing? How will the system reac

  • Process Flows Transforms

    Hi, I'm trying to include a PL/SQL function into a process flow from the public transformations. Whenever I validate the process flow it reports the error "VLD-10019 ... Function needs a valid deployment location". But I can't find anywhere to define

  • BEFW11s4 no ADMIN tab @ 192.168 screen

    Have firmware 1.45.3 current. Want to update to most current 1.52.3. All pages on site say if your screen does not look like "this" click HERE. That just takes me in a circle back again. Have file downloaded and no way to update it. My router is the