Indent-amount -  has no affect

Hi,
i am trying to create an xml-file looks nice and readable.
The code:
tf.setOutputProperty(OutputKeys.INDENT, "yes");works fine, and the file is no longer on one long line, but the code
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");doesn�t work on the computer that has no internet access. Is that how it should work? Is there another way to force the indent in a good way.
package xml;
import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class AnotherCreateXml {
     public static void main (String args [])
          try {
               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
               DocumentBuilder db = dbf.newDocumentBuilder ();
               Document doc = db.newDocument ();
               Element root = doc.createElement ("root");
               Element row = doc.createElement("row");
               Element ele = doc.createElement("item");
               ele.setAttribute("name", "girl");
               ele.appendChild (doc.createTextNode ("12345"));
               row.appendChild(ele);
               root.appendChild(row);
               doc.appendChild(root);
               TransformerFactory tmf = TransformerFactory.newInstance();
               Transformer tf = tmf.newTransformer();
               tf.setOutputProperty(OutputKeys.INDENT, "yes");
               tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
               DOMSource source = new DOMSource(doc);
               StreamResult result = new StreamResult (new StringWriter());
               tf.transform(source, result);
               System.out.println(result.getWriter().toString());
          } catch (TransformerConfigurationException e) {
               e.printStackTrace();
          } catch (TransformerException e) {
               e.printStackTrace();
          } catch (ParserConfigurationException e) {
               e.printStackTrace();
     }

Insert this line into your code before the one that creates the Transformer object ("tf"):tmf.setAttribute("indent-number", "2");

Similar Messages

  • On OSX 10.6.8 Mac Mail sent items do not show the Bcc field. Adjusting settings in mail/prefs/viewing/custom/bcc has no affect on Mail, ie Bcc still does not appear on sent items. Anyone got a fix?

    On OSX 10.6.8 Mac Mail sent items do not show the Bcc field. Adjusting settings in mail/prefs/viewing/custom/bcc has no affect on Mail, ie Bcc still does not appear on sent items. Yet another example of Mac caring not a jot about the performance of versions of OS and software running on on older hardware. Anyone got a fix by any chance? Oh and fyi I need to see the Bcc in sent items to confirm sent email is attaching to Salesforece - when I see the Bcc I know I can delete it as a copy will be in SForce. Big thanks W.

    On OSX 10.6.8 Mac Mail sent items do not show the Bcc field. Adjusting settings in mail/prefs/viewing/custom/bcc has no affect on Mail, ie Bcc still does not appear on sent items. Yet another example of Mac caring not a jot about the performance of versions of OS and software running on on older hardware. Anyone got a fix by any chance? Oh and fyi I need to see the Bcc in sent items to confirm sent email is attaching to Salesforece - when I see the Bcc I know I can delete it as a copy will be in SForce. Big thanks W.

  • F110-Minimum amount has not been reached

    Guys,
    I try to run F110 for a check amount of 0.05US$. And sysetm issues me error message "Minimum amount has not been reached". But I already made mininmum amount in FBZP as 0.01. What else I need to do?
    Regards
    Iqtidar

    did you check payment company and payment method?

  • Generic way to set indent-amount on Transformer?

    Does anyone know if there is a generic way to set the indent-amount on a transformer? I'm guessing the property below is specific to apache transformers. I believe we're using an apache transformer by default, but what if the default changes in the future? Is there a way to identify which transformer you're using and set an appropriate custom property?
    TransformerFactory tf = TransformerFactory.newInstance();
    if (tf.getFeature(SAXTransformerFactory.FEATURE) == false) {
        throw new CISException(ErrorCodes.SAX_TRANSFORMER, "");
    SAXTransformerFactory stf = (SAXTransformerFactory)tf;
    TransformerHandler hd = stf.newTransformerHandler();
    Transformer serializer = hd.getTransformer();
    serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    serializer.setOutputProperty(OutputKeys.INDENT, "yes");
    serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    return hd;

    TransformerFactory tFactory =
    TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
    transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "5");

  • I partially downloaded microsoft office to my mac. Its has really affected my mac and I want to remove it completely, I can't find it anywhere to remove it, please can someone help

    Hi. I partially downloaded microsoft office for mac, It has really affected my mac and I need to get rid of it completely. I cant find it anywhere to remove it. Please can someone help???

    How can a partially downloaded program affect your computer? If you don't find it in the Download folder or wherever you download to, then it's not on your computer.

  • Amount has moved one decimal place in the report

    Hi,
    I am looking in to a report at present, Transaction amount has moved one decimal place, while the local amount stays the same. Any one could tell me the possible reason for this?
    Thanks in advance
    RN

    Hi,
    Check this link,
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw/key-figure-in-cube-is-multiplied-by-100-when-displayed-in-bex-report-743076
    same issue find in this.
    Hope it will help you.
    Thanks,
    Hema

  • Amount has been deducted from my account

    Hello Team,
    I am trying to create a new account with iTunes, and I haved entered my debit card details. Amount has been deducted from my account without any reason. Please let me know why iTunes department deducted my amount from my account.

    Copied from iTunes Store & Mac App Store: About payment card authorization holds
    As with many other merchants, the iTunes Store and Mac App Store places an authorization hold on your payment card account for the approximate amount of any purchase you make. Similarly, if you update your billing information, the iTunes Store or Mac App Store will place an authorization hold on your payment card account, usually in the amount of 1 USD, to verify your account information.
    You might see such authorization requests on your online statement. These requests are not actual charges; they are tests to confirm that your payment card account is active and has available funds to accommodate transactions. Authorization holds are removed by your financial institution shortly after your purchase clears. The amount of time it takes to remove authorization requests varies by financial institution.
    To review the actual charges on your account, you may review your iTunes Purchase History. You will be prompted to enter your iTunes account name and password. Note that Mac App Store web order details can only be seen in the iTunes purchase history. Your Purchase History will display your most recent purchases first. To view details of any purchase, click the arrow to the left of the order date.
    If you have questions about the way your financial institution handles authorization requests, contact their customer service department.

  • Amount has been deducted from my account with any reason

    Hello Team,
    I am trying to create a new account with iTunes, and I haved entered my debit card details. Amount has been deducted from my account without any reason. Please let me know why iTunes department deducted my amount from my account.
    Please call me if you need any further details. My contact number is +91 89789 35435.
    PS: Attached SMS snapshot of bank transaction.
    Regards
    Shashi Kanth

    Hi ,
    Even when i created a new apple id using my credit card details amount was deducted ...Please some one answer this question Why it has been deducted ??

  • Once Bonus amount has been paid,still it has been deducted from salary

    Hi all,
    We have paid bonus to eligible employees in off-cyle in October. When we ran their regular payrun for October, found that their salary has been deducted exactly by the bonus amount paid. We can see in RT that "/552 - Net Stat subseq adjustment" with bonus amount has been found. As a result of which their home take salry mismaches with "earnings less deduction" in the payslip. Why bonus amount has been deducted from salary once it has been paid?
    Suitable answers will be rewarded.
    Thanks
    Rajesh

    hi rajesh.
    this is due to the termination action you have performed in your company.( i presume that you have terminated the employee, if not you should follow as guided below)
    the employee left on 10th october and
    the bonus is paid on 21st october.
    in sap it is not accepted but in real it will be happend.
    but still you have a solution for this
    you have to terminate the employee with effect of 10th october and remember you have to modify the payroll status infotype " run payroll up to" should be maintained with the date on which the bonus is paid.
    in your case it should be 21-10-2008.
    ok
    when you perform offcycle payment of bonus with the specified date, system will pay that amount.
    feel free to ask me anything further.
    regards,
    rashmi.

  • I have subscribed to the student package and I also received a confirmation SMS saying that the amount has been deducted. But when I sign in through creative cloud, it shows that I am still running on a trial version. Why is that?

    I have subscribed to the student package and I also received a confirmation SMS saying that the amount has been deducted. But when I sign in through creative cloud, it shows that I am still running on a trial version. Why is that?

    Sign in, activation, or connection errors | CS5.5 and later, Acrobat DC
    Mylenium

  • HT3302 I do not know if my ipad 3 (the new ipad) has been affected by liquid. How can i know it?

    How can i know if an ipad 3 has been affected by water? I have been installing a screen protector using water, i put the ipad in my bed and go to eat, and when i arrived he ipad 3 was on the apple log, i try to restart it but i could not pass the apple logo. What happened to my ipad 3?

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.

  • Va41 : Enhancement : In conditions tab pricing elements amount has to be fetched automatically

    Hai Guru's. Trust every one is doing good. I have a requirement where in VA41 basing on Document type amount in conditions tab pricing elements has to be fetched automatically and it should be in non modifiable mode. I tried exit MV45AFZZ but KOMV-KBETR this field is clearing. SELECT * FROM ZMARKET_PRICE INTO corresponding fields of table IT_PRICE    WHERE BUDAT    = SY-DATUM        and  COMMODITY = 'SUGAR' . LOOP AT IT_PRICE.  IF VBAK-AUART = 'ZKSA'.  KOMV-KBETR = IT_PRICE-KSLNP. ENDIF. endloop. I tried exit MV45AFZZ and added the logic mentioned  above but KOMV-KBETR this field is clearing. Please help me. Regards, Prudhvi Choudary.

    Hi ,
    Please check whether the code that  you have added is at the right place in the exit. It might so happen that the value you are trying to populate is getting overwritten or getting cleared some time later in the processing after executing your code.
    Otherwise as suggested above, you can create a custom routine(copy of original with additional changes of your requirement )  in VOFM and try to assign it to conditions tab value with the help of your functional.
    Regards,
    Shruti

  • Aging report total amount has been changed

    the total dollar amount for both AR aging and AP aging as of 8/31/08 keeps changing when i put new invoice in 'A/P invoice' or 'A/R invoice.'
    or maybe because i cut checks through 'payment wizard' or made deposit using "incoming payments."
    All the posting dates for those invoices and deposit were after 9/1/08, so it should not change the aging total as of 8/31. I don't know why it keeps changing. any ideas?

    sorry for the confusion...
    We recently implemented the SAP system, and we're running accounting system simultaneously with peachtree right now because SAP isnt fully functioning yet.
    We're trying to match aging AR & AP amount, run trial balance, and enter journal entries to match all the numbers with peachtree. That way, the beginning balance of September will match with the one of peachtree. i hope this makes sense to you...
    but the total dollar amount of aging AP & AR report as of 8/31/08 is different when i excute the report every time. since it's already October and no invoices or credit memos have been issued with August date, the aging report as of 8/31/08 should not be changed at all. it doen't make sense and i don't know why this is happening...

  • How can I be sure the new picture zoom value has taken affect?

    Hi,
    I'm writing a LV prog that displays a series of pictures (jpegs) one after the other.
    The pictures are passed one at a time from the main vi to a sub vi that outputs the picture on its front panel.
    Also passed to the sub vi is the smaller of the two dimensions of the picture whichever it may be (width or height). This varies from picture to picture.
    The sub vi uses this dimension to calculate the zoom factor to use so that the picture will fill the whole of the picture box on the front panel.
    I've used a flat sequence struture to:
    1. Caluculate the required zoom factor and write this to the picture box property node.
    2. Read the zoom factor from the property node of the picture and wait until it has changed to within 1/100th of the new value. (The reason for not waiting until it is equal to the new value is because they are floating point data types and even if they were minutely out it would wait forever. Anyway, 1/100th is close enough).
    3. Write the picture to the picture box.
    Even after including step 2 above I still occasionally found that it has displayed the picture before changing the zoom value.
    Any ideas? I've attached the sub vi in question. The two inputs: 'PicInput' is the picture to be displayed and 'ZoomDim' is the smallest of the width,height dimensions in pixels determined by the calling vi.
    Also, as I said my program sets the zoom value using the smallest of the two dimensions of the jpeg so as it entirely fills the picture box. This means that the other dimension will overspill outside of the box, can this cause any problems such as memory corruption?
    Thanks,
    Dave.
    Attachments:
    DisplayPicture.vi ‏31 KB

    johnsold wrote:
    Dave,
    I could not duplicate your problem. On my system (LV 7.1.1, Mac OS X 10.3.9, 450 MHz G4) the while loop always executes only once. The read Zoom Factor is always exactly equal (within Probe display resolution) to the written Zoom Factor. If your system needs several iterations to get the Zoom Factor right, I would try putting in some delay, perhaps enough time to allow the display system to update (i.e, the frame rate).
    As for the memory overwrite issue, I do not have any experience. Usually LV's memory manager is pretty good about such things, but someone else will have to answer that question.
    Lynn
    Hi Lynn,
    Thanks for your reply,
    Dave.

  • Re : partial Amounts has been pay to APP

    hi kings
    I have one doubt, that is I want to Run Automatic payment program to partial amounts that is possiable or not. Please let me confirm to me. If possiable what are the steps are required.

    Hi,
    Go to tcode OBB9
    Click New entries
    Sample Example:
    Terms of pmt - 0009; Inst:1; Percent: 30; Pmt term: 0001
    Terms of pmt - 0009; Inst:2; Percent: 40; Pmt term: 0001
    Terms of pmt - 0009; Inst:3; Percent: 30; Pmt term: 0001
    Save
    Metion the terms of pmt i.e. 0009 (in our e.g) in vendor master  - Payment terms.
    <i><b>Please assign points</b></i>
    regards,
    Sridevi

Maybe you are looking for

  • Mm open and close posting periods

    Hi, Any one can suggest me how can I ope a closed  posting period, Ex:- present period is 16/1/2007,in System while running T_Code MMRV        Current Period:- 12  2007        Previous Period :-11 2007        Last period in prev.year:- 12 2006 and wh

  • Disc cannot be read from or written to

    I have seen a couple of posts relating to this same problem. My nano will download a random number of songs and then i will get the "disc cannot be red from or written to" message. I've tried different computers, restoring, different cds, uninstallin

  • Date format for Calendar Prompt  in Oracle BI

    Hi, 1) In Oracle Answers, I need to have this format : dd-MMM-yy in a Calendar Prompt I've changed in localedefinitions.xml : <property name="dateShortFormat">dd-MMM-yy</property> <property name="dateOrder">dmy</property> <property name="dateSeparato

  • Illustrator cs5 changes Kuler color values when importing, Help!

    I am using Illustrator cs5. I access the Kuler Color theme feature for color themes. I will select a them from the Kuler feature and then choose to add that theme to my swatch panel. I then check the individual colors in the color panel. Here is the

  • How do I embed MS Word in a browser frame

    I am writing an applet from which I want to control MS-Word. I can't quite see how to embed Word into a frame so that my applet is rendered in a left frame while Word is running in a right hand frame. Can anyone help me with this.