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");

Similar Messages

  • Is there a way to set the amount of time before Messages shows me as idle?

    I ran a script in iChat that allowed me to extend the amount of time before I showed as idle, but I haven't been able to find something comparable for Messages.

    HI,
    Yes.
    See http://hints.macworld.com/article.php?story=200402181751007
    You  need to Write to the com.apple.IMAgent.plist instead of the iChatAgent one listed.
    9:58 pm      Monday; July 29, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • 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");

  • Is there any way to set a password so that txt messages only open when the password is entered

    Is there any way to set a password so that txt messages only open when the password is entered?
    Please help! Thanks for reading:)

    Hello Damien,
    There is an option to set a passcode for the entire iPhone.  You can use the following steps to set this up:
    You can configure a passcode for your iPhone, iPad, or iPod touch using Settings > General > Passcode Lock.
    Once enabled, you will be prompted for the passcode whenever you:
    Turn on or restart the device
    Wake the device
    Unlock the screen
    Note: You can specify the amount of time the screen must be locked before requiring a passcode.
    You can find the full article here:
    iOS: Understanding passcodes
    http://support.apple.com/kb/ht4113
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Can we set tax amount directly instead of tax code?

    Hi,
    Is there a way to set the TaxAmount value in an A/R Invoice document line object instead of tax code?
    Thanks and Regards,
    Sheetal

    You may only make it visible.
    A workaround would be to create a UDF and use a Formated Search or update it by code. This is not recommended at all because the TAX code and amount is used on many other forms such as VAT Report, Jurnal Entries etc. If you do this make sure to also set the appropriate TAXCODE, and check that the amount is OK with the percentage of the certain TAXCODE.

  • Set indent as default for all documents

    Is there a way to set my own indentations for paragraphs, as a default for any new document I create?
    An indent that starts way over here offends my art director's eye. <g>

    cafox513
    You will need to make a custom template with your own settings.
    The default text style is Body so set that the way you like it in the template.
    If you need help with templates and styles look here:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=2&sid=2abc89bd5c5512 60fd5ce34a4e6ad05b&mforum=iworktipsntrick
    You can set your custom template to open by default in your preferences.
    Peter

  • What is the best way to set up iTunes on our home network so all family members have access to all of our itunes library, even music we don't have on the cloud?

    I have five different people using 10 different apple devices on one itunes account in our family.  We have had trouble sharing.  What is the best way to set up itunes on our home network?  We have purchased music that sits on icloud, but we also have music we have imported from our previous cd library.  Our itunes program keeps crashing and dumping everyone's playlists.  So far we have all been using just the one desktop computer to sync to because we can't figure out how to share the same librarly and playlists on multiple computers in our home so devices can be synced at any location as well as playlists and purchases be made. 

    What is the best way to set up itunes on our home network? 
    One iTunes library per person.  One iTunes account per person.
    If people wish to share songs, they can make copies.
    When the inevitable day comes when the kids get older, you will not have to come back here and post asking how all that stuff can get separated!

  • My husband and I are using the same computer. He has a ton of songs in iTunes that I don't want...but when I sync my iPod I get all of his songs too. Is there a way of setting up another ITunes account without having to untick all of the ton songs iTunes

    My husband has a ton of songs in iTunes that I don't want on my iPod nano. Is there a way to set up a separate account on the same computer in iTunes? Do I have to un-tick all of his songs (would take forever!! And then he would have to tick them again)....when we sync our iPods?

    No. Its not possible.
    Alternatively, create another user account in your computer. Install iTunes in that account with the library you wish to sync.

  • Spry Collapsible Panels - Way to set them open only once per visit?

    I'm wondering if there is a way to set a Spry Collapsible
    Panel to be automatically open on the initial loading of the site,
    but as people navigate around the site and back and forth from the
    home page, to be able to have it closed on subsequent visits to the
    home page.
    Right now I have a collapsible panel set to OPEN by default
    when someone first hits the home page, but if they navigate around
    the site and then click to the home page again, they get the panel
    open again. Naturally, that will end up annoying people.
    Any suggestions?
    Thanks in advance!
    Sara

    Flash local shared object can help with this. Here is some info:
    http://www.bestflashanimationsite.com/tutorials/4/
    http://www.permadi.com/tutorial/flashSharedObject/index.html
    http://www.kirupa.com/developer/mx/sharedobjects.htm
    Best wishes,
    Adninjastrator

  • My wife and I share an iTunes account. Is there any way to set up a seperate one for her to sync her phone contacts, iCloud and music to without having to purchase all her music again and then share going forward?

    My wife and I share an iTunes account. Is there any way to set up a seperate one for her to sync her phone contacts, iCloud and music to without having to purchase all her music again and then share going forward?
    It would be so much easier having seperate accounts but we have hundreds of her purchased songs on my account and she would need to be able to access these from her account. Possible?
    Also, if we bought a song in future we would want to be able to both have access to it.
    Alternatively, what is the easy way to sync two distinctly different contact lists to one iTunes account?
    Thank you in advance.

    FYI: iTunes account (used to make purchases) is not the same as iTunes library (iTunes on your computer with music, movies, etc.).
    ecbclb wrote:
    Will we have to create a seperate account for her, or can we all have the same one?
    You can but you will not be able to limit what she syncs.
    I would like to avoid 'checking' and 'unchecking' individual songs every time one of us tries to synch our ipods to the library.
    I don't recommend using (only) the checkmarks to select what to sync.
    Each of you can create your own playlists then sync only those playlists.
    Then add/delete from your own playlists to change iPod content.
    The only time I uncheck items is if I rarely/never want to sync them to anything, such as Christmas music or old audiobooks.
    I suggest you each have your own computer login account. Then everyone has their own contacts, calendars, and everything else.
    You and your husband can share an iTunes library and let your daughter have her own.

  • I have an iTunes account with my own music library.  My wife wants to have her own music library.  Is there a way of setting up a sub account for her, or do I have to set of husband playlists and a separate set of wife playlists?

    I have an iTunes account with my own music library.  My wife wants to have her own music library.  Is there a way to set up a sub account for her, or do I have to set up a set of husband playlists and a set of wife playlists?

    Sorry, but that's not possible.
    You can share iTunes libraries on a network >  iTunes: Setting up Home Sharing on your computer

  • What Is The Best Way To Set Up Kids iTouch To My iTunes?

    I have an iTouch set up with my iTunes music, movies and apps, but now I gave my kids each an iTouch.
    What is the best way to set up there account, should it be a unique account for each of them or should I put them under my account?
    They will be using my same iMac when they sync or update there iTouch, so will they need to log in under their name every time?
    Not sure what is the best way to set this up, they are both minors, i.e. no credit card.
    Thanks

    Better just your account for multiple devices. The only drawback is that the music will have to managed manually.
    Connect one of the iPods to your computer then launch iTunes. You should see the iPod under Devices on the left side of the iTunes window. Double click then you can name each iPod to keep them separate but only syncs to your iTunes account.
    Without knowing your Apple ID user name and password they would not be able to make purchases ergo no downloads you aren't aware of.
    How to use multiple iPods, iPads, or iPhones with one computer
    The kids are minors.. if they are under 13 years of age, according to Apple, they can't have their own accounts regardless.
    http://www.apple.com/legal/itunes/us/terms.html#GIFTS

  • What is the best way of setting up Family Sharing?

    I just bought my son an iPad Mini and I am trying to decide on what is the best way of setting it up for him. The one thing I do know is that I do NOT want all the content that is my iPhone 6 to pop up on his iPad Mini. I want his iPad to be used for his games and educational stuff and his own music. I don't mind setting up a family photo album and share photos with the family. So is the Family Sharing option the best way of doing this based on what I just mentioned? Do I set him up with his own Apple ID? If so will everything still be based off my account so he won't have to create his own iTunes Library?
    I always use iTunes gift cards to purchase music and content. Will I be able to continue to use them even if I want to put some new content on his iPad and not my iPhone? Do I enter in his Apple ID info. Can you restrict certain family members to just certain things for example you only want to share photos with one person whereas you might want to share your music with another family member?
    Any suggestions on the best way of setting this up would great!
    Thanks!

    Hi DVX100Shooter,
    Congratulations on getting your son a new iPad, I am sure he will enjoy it. 
    Family Sharing is one way of managing both purchases and content between members of a related group of people. Each member must have their own Apple ID. You can choose what music you wish to share with the family from your own account. See this article -
    OS X Yosemite: Share purchases with your family
    In particular the section titled Hide a purchase from other family members
    The music library on your son's iPad is separate from yours, but under Family Sharing you agree to pay for all purchases made through the iTunes store. If you wish to control what is purchased you can set up the Ask to Buy option for any family member under adult age in your location. See this article for details -
    Request and make purchases with Ask to Buy - Apple Support
    Gift cards may not be used for billing of purchases under family sharing, with the exception that a family member may use gift cards to purchase their own content. See this article for information about Family Sharing billing policies -
    Family purchases and payments - Apple Support
    The shared family photo album is available to all family members.
    Family Sharing - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • Is there a way to set wireless network priority on iphone? If not, there should be!

    Is there a way to set wireless network priority on iphone? If not, there should be! I have a wireless router with dual band signals, as well as an extender at the other end of my home... it would be nice if I could set a priority list so my phone knows to always connect to the 5GHz signal if available, rather than trying to connect to the 2.4GHz signal which is on the other side of the house...

    By default, the iPhone will prioritize Wi-Fi over cellular for data and when doing Wi-Fi, will latch on to the strongest signal it can associate (latch on) to. But all that is automatic, there's no evident control for manual adjustments. Other than deleting the Wi-Fi networks you don't like.

  • I want to use Mac Mail for my work email address, which containts multiple outbound options (i.e. hr@, me@ etc). Is there a way to set up Mac Mail to have an account with multiple outbound addresses rather than adding in multiple accounts?

    I want to use Mac Mail for my work email address, which containts multiple outbound options (i.e. hr@, me@ etc). Is there a way to set up Mac Mail to have an account with multiple outbound addresses rather than adding in multiple accounts?

    This sounds like the age old problem with keychain & Safari. I don't know of a way to solve it without using something like 1Password.
    The iOS app has it's own built in browser, so it has more control over what gets autofilled. Safari on OS X has an 1Password extension that handles account selection & autofill etc.
    Keychain is great in principle, but it quickly falls down when you need tight integration with many ID's & different use cases (work, home etc).
    I'd suggest you submit feedback to Apple about your thoughts. I did so years ago about this issue & this is how far we have come (back to the point where me.com synced passwords) :^)
    http://apple.com/feedback/macosx.html
    Other tools like lastpass or keypassx may also help if you want to truly segregate password storage, but that doesn't fix autofill, the way around that issue is to dedicate one browser for work.

Maybe you are looking for

  • PS CS with color space set to Prophoto RGB - will ACR change embedded profiles?

    Probably a foolish question but my problem is that I have a mixture of files: My own files (all initially RAW (NEF) which I import into ACR as 16 bit Prophoto RGB ). Files from family members and from slide scanning performed elsewhere - they are in

  • Reseting the Hashed Password after enabling Windows File Sharing

    Disclaimer: you'll need a good bit of knowledge about OS X, UNIX, and encryption to understand what I'm talking about. All right, so normally OS X hashes user passwords using a salted SHA1 encryption. It uses shadowing so that you can't obtain the ac

  • JBO-25036 when executing executeQuery of a view Object

    I have a view object that performs a given query. when I call executeQuery the first time, it works perfectly. But on the second call I get the following error: JBO-25036: An invalid object operation was invoked on type View Object with name SxIdioma

  • Exchange any Lync 2010 - delayed emails

    Hi, I have Exchange 2010 configured with Lync 2010 to send email about missed Lync calls. A certain user is getting those email with a random delay (can be a few minutes up to few days), the user is getting all those mails in a bulk. Mails appear in

  • SEVERE: SAAJ0008: Bad Response; Bad Request

    Hey Guys, I am trying to send a SOAP request with attachments from java to a .NET webservice. Here is the extract from my code.. DataSource source = new FileDataSource(file); DataHandler handler = new DataHandler(source); AttachmentPart attachment =