Auto indent XML Java API

Is the "Auto Indent XML" context menu function available as an API.
I have several JDeveloper Addin's that generate XML, but would prefer to use the built-in formatter.
Thanks
Pat

There is an API for manipulating XML in the product, but unfortunately it's not public yet.
In the meantime, probably the easiest way to reformat XML (or any file) in 10.1.3 is to programmatically invoke the Reformat command. This will work on any context where the document or selection is an XMLSourceNode.
// !! The CodingStyleController.FORMAT_CMD constant is not guaranteed
// !! to stay the same in future releases.
IdeAction action = IdeAction.find( Ide.findCmdID( "CodingStyleController.FORMAT_CMD" ) );
action.performAction( context );Thanks,
Brian

Similar Messages

  • Urgent - Need an answer - XML Java API

    This is the 3rd time I've posted this question in last week - Oracle Support: How can I get an answer to this?
    This question is about how to free up the memory of XMLDocuments, Parsers, etc using the Java APIs - not the PLSQL wrappers.
    I'm writing an app using the DocumentSplitter class (from Steve M.'s book) that allows for the SAX parsing of large XML documents. But this question is really about the Oracle Java XML API.
    Is there a way to free the memory of each of the "temporary" XMLDocuments that get created? I know there's a XMLNodeCover.freeDocument(int id)
    method in the xmlplsql.jar- where do you get the id from? I'm trying XMLNodeCover.getDocumentId(curDoc) - but that doesn't seem to work.
    And can I use that same method for each Node and Element that gets created also?
    Also, would like to free the memory for the XSL processor, SAXParser, and XSLStylesheet - but this is even less obvious (although not as critical).
    I'm actually getting out-of-memory errors even sooner when using the SAX parser then when using the DOM parser, and I think its due to this issue.
    I know that there are PL/SQL wrappers for all these, but I'm trying to use the DocumentSplitter and associated custom classes
    in only Java stored procs, and then writing a single XSLT.transform wrapper. This way its largely invisible to the PLSQL layer.
    Thanks

    Hi - thanks for your response.
    Actually, yes, I did change the split method to return a CLOB. The big picture is I'm trying to use the DocumentSplitter
    class to assist in the transformation of large XML documents to html or tab-delimited output. Using the standard DOM parser,
    I eventually get an out-of-memory situation. So now I'm trying the DocumentSplitter to do a "mini" XSL transform on each <ROW>.
    The good news is it works for small to medium size reports. But its slower and runs out of memory quicker.
    Below is some of the relevant code. I also wrote associated classes to wrap the DocumentSplitter and to be the 'handler' that transfoms the XML when a <ROW> is found, and returns a string (see 'endElement' method below).
    I'm freeing the CLOBS in PLSQL after reading them - do I need to free them from JVM memory seprately? If so, how can I do that if I need to pass them to PLSQL?
    Thanks much,
    Eric
    // Split a large XML document into N subdocuments, each one identified
    // by the an opening 'splitElement' element. Invoke an XMLDocumentHandler
    // to process each subdocument encountered.
    public CLOB split(String splitElement, CLOB inputCLOB, CLOB outputCLOB)
    throws Exception, SAXParseException,SAXException,IOException, SQLException {
    this.inputCLOB = inputCLOB;
    this.outputCLOB = outputCLOB;
    this.splitOnElement = splitElement;
    // Create a new SAXParser
    SAXParser parser = new SAXParser();
    // Register the current instance of this class as the Document Handler
    parser.setDocumentHandler(this);
    // Create ascii stream from CLOB source
    InputStream inputStream = inputCLOB.getAsciiStream();
    // Start parsing the stream of XML
    parser.parse(inputStream);
    Writer out = this.outputCLOB.getCharacterOutputStream();
    // Set buffer to be the optimal size
    int chunk = outputCLOB.getChunkSize();
    char[] buffer = new char[chunk];
    // Create a reader from the output string
    StringReader reader = new StringReader(this.outputString);
    int length = -1;
    // Now write from output string to output CLOB
    while ((length = reader.read(buffer)) != -1) {
    out.write(buffer, 0, length);
    // Close streams
    reader.close();
    out.close();
    inputStream.close();
    return outputCLOB;
    portion of endElement method:
    // Handle the </Element> "end-element" parsing event
    public void endElement(String name) throws SAXException {
    // If we're NOT building a subdocument, we don't care. Just return.
    if (curDoc == null) return;
    // If this is the endElement event for the subdocument splitElement
    // then we're done with the subdocument and are ready to call the
    // handler to handle it.
    if (name.equals(splitOnElement)) {
    if (curDoc != null) {
    try {
    // Call the XMLDocumentHandler.handle() method for current subdoc
    //Append the output to the growing output string
    if (this.outputString == null) {
    this.outputString = handler.handleDocument(curDoc);
    } else {
    this.outputString = this.outputString + handler.handleDocument(curDoc);
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    }

  • 10g Preview Bug: Auto Indent XML

    When auto-indenting an xml document with multi-line comments, each time you ask for the auto-indent, the trailing lines of the comment are indented further. The following example shows a document that is unintented, and then the same document after selecting auto-indent once, and then after auto-indenting the auto-indented document. The comments will keep moving to the right if I keep selecting auto-indent.
    Original:
    <tag>
    <subtag>
    <!--
    A multi-line comment.
    -->
    </subtag>
    </tag>
    Indented once:
    <tag>
      <subtag>
        <!--
        A multi-line comment.
        -->
      </subtag>
    </tag>
    Indented twice:
    <tag>
      <subtag>
        <!--
            A multi-line comment.
            -->
      </subtag>
    </tag>

    Hi Markus,
    Though this is not a UIX issue, request for Auto indent feature from application navigator for multiple xml (uix, uit, xss, and xml) files has been made. Your post has been passed to the IDE team which looks after these issues.
    Thanks,
    Vijay V
    Team UIX.

  • User defined Metadata for XML DB using Java API

    I have been looking through and reading the documentation for Oracle XML DB. I am trying to find out if there is a way to create user define metadata using a Java API. when I look in the XML "Java API Reference (Javadoc)" setProperty(java.lang.String name, java.lang.String value, int type) it states: Sets the specified (single-value) property to the specified value. If the property does not yet exist, it is created. I have tried several ways to do this and have not been successful. I have looked for java examples in the XML DB Developer's Guide, XML Developer's Kit Programmer's Guide.
    Is there a good example out there as to how to create user-defined metadata that can be populated using the JCR API.
    Thanks in advance.

    We need to create the 2 xml schemas, one for request and the other for response of selected operation in the WSDL.
    This we need to do dynamically. There will not be any java classes generated, the xsd files need to be created on the fly.
    Please suggest xml schema creation in this sequence.

  • [E2010][EWS-XML][JAVA]How to get the properties of meeting rooms in Exchange 2010 using EWS Java API

    When you look at meeting room properties in Outlook 2010, you can see 'City', 'Country/Region' and 'Department' information.
    Is there any way to get this information using EWS Java API? 

    Hi Glen,
    I am able to understand what u have said, but do not know how to implement it with meeting rooms....
    If i am implementing
    "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in ews-java-api, as you have mentioned above, i am able to get only my appointments from the start date to end date , as i
    have given my email id and password, how to get my organization meeting room details, booked or not.
    static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
    public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    ExchangeCredentials credentials = new WebCredentials("[email protected]", "zzzz");
    service.setCredentials(credentials);
    try {
    System.out.println("Check");
    service.autodiscoverUrl("[email protected]",new RedirectionUrlCallback());
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    NameResolutionCollection nameResolutions = service.resolveName("SDB1",ResolveNameSearchLocation.DirectoryOnly, true);
    System.out.println("nameResolutions==="+nameResolutions.getCount());
    for(NameResolution nameResolution : nameResolutions)
    System.out.println("NAME==="+nameResolution.getContact().getDisplayName());
    The above code gives me the output like, the meeting room in my organization with word SDB1 are
    Output:
    nameResolutions===2
    NAME===SDB1- TELCON - 1
    NAME===SDB1-TELCON - 2
     for. eg. I need to know today at what are the appointments in the room SDB1-TELCON2 and who all have booked the room.
    I do not know how to implement for the meeting room can you please help me how to give it.
    Thanks in advance.

  • New to XML+Java: which is the best API?

    Hi,
    I am new to XML+Java and I am trying to develop an application that will both read and write to an XML file. After reading some tutorials, I decided that jaxp, sax, and org.w3c.dom.* are rather low-level and very unfriendly.
    After a cursory web search, I came to the conclusion (please correct me if I am wrong) that JDOM and DOM4J are the most easy-to-use free APIs. So I would like to ask which one of the two (or any other API) is the "best"? With "best" I mean larger user base, better documentation, more features, less bugs, active development community (i.e. if a bug gets discovered, it will be fixed). I don't want to start building my application, just to realise 6 months later that the API I've chosen is very limited.
    Your experience is much appreciated. Thanks for taking the time to reply.

    Thanks guys. It seems that there is no clear answer as to which one should I use.
    I will start using dom4j because it has more convenience methods and it heavily uses JCF, which I am very comfortable with. Although it seems that the learning curve is steeper (more complicated API) it is probably worth the effort.
    Thanks again for your responses.

  • Java API - Editor class for an XML schema

    Hi,
    i am very interesting in Java API. I would like to make an editor class for an XML schema. (I will create XML files in the current project based on this XML schema.) What step's are require for this editor class?
    Regards
    Gabor

    DavidThi808 wrote:
    jtahlborn wrote:
    you can provide a schema when parsing an xml document in order to check for schema conformance, but that isn't going to affect your XPath queries at all. DOM content is never anything but strings.In the case of both dom4j/jaxen and the .NET runtime the values returned from XPath queries when a schema is provided are typed. So you get back numbers, dates, and booleans as well as strings. And for numbers you get correct comparisons so 20 > 1.i guess it's possible. i use schemas when parsing xml, and i've used xpath (infrequently), but i'm not sure that i've ever used them together in a way that i would see functionality like that.
    FYI, you use http://docs.oracle.com/javase/6/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#setSchema%28javax.xml.validation.Schema%29 to specify a schema while parsing with a DocumentBuilder.

  • Question about Java API for XML schema?

    Hello, everyone!
    I am looking for a java api for XML schema. I hope the API is capable for parsing the structure of element
    or complextype declarations in XML schema. So for example, if I specify a name of an element or
    complextype defined in a schema, the name, dataype and other constraints of contained child elements can be returned.
    Does anyone know if there exists such a paser?
    Thanks very much!

    An implementation of DOM Level 3.

  • How to SaveAs the MSword file into xml file format using Java APIS?

    Hello all,
    I want to convert MSword file into Xml format using java APIS or any other inbuilt APIS that i can integrate in Java code.

    Sorry, that doesn't make much sense.
    The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
    Are you a user of this utility?

  • Java API docs as XML?

    Hello:
    I'm posting here because I don't really know where to post this question.
    Are the Java API docs available as XML?
    Thanks!
    Greg

    I don't think so. I believe they come in the "javadoc" format only,
    besides the HTML ones that are hosed online on java.sun.com.

  • Java Api VS Ejb/Xml

    Hi, I need some information from all of you experts out there.
    Currently we are running an appserver, the way it works is that we use ejb/xml to talk to corba stubs which eventually will talk to the server objects.
    I am quite new to this technology, and currently considering of removing the use of ejb/xml layer and replace it with JAVA API. The idea is to get Webservice to talk to Corba stubs through JAVA API.
    My question is:
    1. Has anyone out there done this before? if so, what is your suggestion to this?
    2. Is there any performance issue?
    3. Is there any sample out there that does this?
    Any reply/opinion is highly appreciated.
    Thanks in advance.

    I don't think so. I believe they come in the "javadoc" format only,
    besides the HTML ones that are hosed online on java.sun.com.

  • Replication of Berkeley DB Xml Edition with the help of JAVA API

    hi,
    i am trying to replicate berkeley DB to 2 other replicas.with the help of small program which along with its documentation(of chapter 3). And i'm using java API for the same(specifically replication framework program.)
    All necessary files are get created at host side like log files, dll files, db files. But at replica(client) side nothing get created. Host and clients are placed in the same network.
    But unfortunately its not working. don't know the reason. And its not giving any sort of error. And i dont know how to go ahead. Or is there any other way should i proceed with.
    So could you help me out to get rid of this problem.
    Thanks

    What compiler are you running?
    See this message and thread:
    Re: Problem after update to 2.3.8
    It may be necessary to apply the -fno-strict-aliasing flag to the Berkeley DB Java library as well.
    Regards,
    George

  • Java API to read the Encrypted Values from Windows Registry settings

    Is there any Java API to read the Encrypted Values from Windows Registry settings ?
    My Java Application invokes a 3rd party Tool that writes the key/value to windows registry settings under : “HKLM\Software\<3rdparty>\dataValue”.
    This entry is in BINARY and encrypted with 3DES, using crypto API from Microsoft.
    3rd party software to encrypt the data stored in registry it
    either uses C++ code: and uses the call “CryptProtectData” and “CryptUnProtectData” or
    If it is a .NET (C#) it uses the call “Protect” or “UnProtect” from class “ProtectData” of WinCrypt.h from the library “Crypt32.lib.
    Note: The data is encrypted using auto-generated machinekey and there is no public key shared to decrypt the Encrypted data.
    Since the data is encrypted using auto-generated machinekey the same can be decrypted from a .Net / C++ application using CryptUnprotectData or UnProtect() API of WinCrypt.h from the library “Crypt32.lib.
    To know more about Auto-Generated MachineKey in Windows refer the links below
    http://aspnetresources.com/tools/machineKey
    http://msdn.microsoft.com/en-us/library/ms998288.aspx
    I need to find a way in Java to find the equivalent API to decrypt (CryptUnprotectData) and Microsoft will automatically use the correct key.
    But i couldn't find any informato related to Java APIs to enrypt or decrypt data using auto-generated machinekey.
    Is there a way to read the encrypted data from Windows regsitry settings that is encrypted using the Auto-Generated Machine Key ?
    Kindly let me know if Java provides any such API or mechanism for this.

    If the symmetric key is "auto-generated" and is not being stored anywhere on the machine, it implies that the key is being regenerated based on known values on the machine. This is the same principle in generating 3DES keys using PBE (password-based-encryption). I would review the documentation on the C# side, figure out the algorithm or "seed" values being used by the algorithm, and then attempt to use the JCE to derive the 3DES key using PBE; you will need to provide the known values as parameters to the PBE key-generation function in JCE. Once derived, it can be used to decrypt the ciphertext from the Regiistry in exactly the same way as the CAPI/CNG framework.
    An alternate way for Java to use this key, is to write a JNI library that will call the native Windows code to do the decryption; then the Java program does not need to know details about the key.
    That said, there is a risk that if your code can derive the key based on known seeds, then so can an attacker. I don't know what your applicatiion is doing, but if this is anything related to compliance for some data-security regulation like PCI-DSS, then you will fail the audit (for being unable to prove you have adequate controls on the symmetric key) if a knowledgable QSA probes this design.
    Arshad Noor
    StrongAuth, Inc.

  • Performance of Java API 2

    Hello,
    we are currently using Java API 2 that comes with MDM 5.5 SP5 (Build 5.5.42.65) to read extended information from the mdm repository.
    Our process:
    We are export every product as a XML file over the MDM Syndicator and enrich this file with extended information from the API (This step is needed because we cannot export all data by the Syndicator, for example multilingual attributes / some product data like textblocks / id's for incremental updates ...).
    Actually the performance is really bad, we need ca. 10-15 secs to process one file, that is really frustrating when you have stored near 70.000 products in your repository.
    Are there some tricks to improve the performance or is the API really so slow? Or any better alternatives for an fast export?
    Thanks for your help ....
    Best Regards,
    Jan

    1 - If you are able to use the EJB connection with the LiveCycle SDK classes (you have are using a supported java version such as 1.5_xx, your network security doesn't prevent RMI calls, etc.) then that is your best bet.
    2 - Yes, you will need the java APIs to be accessible for your application. The LiveCycle APIs have remote EJB endpoints so you can access them from another server.
    3 - There are samples that ship with the LiveCycle server (located in your LCInstall\LiveCycle_ES_SDK\samples\Forms). There are also samples on the LiveDocs page at: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000064.html

  • Invalid Argument Exception on Java API's DB Close

    When closing the database via the Java API's close method, I am getting an invalid argument exception... how can this be fixed... subsequent access to the DB causes the JVM to crash??
    ERROR: An exception has occurred: java.lang.IllegalArgumentException: Invalid argument
    java.lang.IllegalArgumentException: Invalid argument
    at com.sleepycat.db.internal.db_javaJNI.DbEnv_close0(Native Method)
    at com.sleepycat.db.internal.DbEnv.close0(DbEnv.java:217)
    at com.sleepycat.db.internal.DbEnv.close(DbEnv.java:77)
    at com.sleepycat.db.Environment.close(Environment.java:39)
    at com.sleepycat.dbxml.XmlManager.closeInternal(XmlManager.java:301)
    at com.sleepycat.dbxml.XmlManager.delete(XmlManager.java:33)
    at com.sleepycat.dbxml.XmlManager.close(XmlManager.java:310)
    at com.iconnect.data.adapters.BerkleyXMLDBImpl.insert(BerkleyXMLDBImpl.java:827)
    at com.iconnect.data.DataManagerFactory.insert(DataManagerFactory.java:182)
    at Xindice2Berkley.main(Xindice2Berkley.java:99)

    I had the same problem. I could fix it by carefully calling the delete() function on all those DBXML Xml..xyz objects that you create when you perform queries etc. It seems that those Java objects have some 'shadow' object in the underlying DLL and by calling delete() you free resources that remain otherwise assigned (maybe somebody with a C++ background who programmed this stuff?). Call delete() before the Java object gets out of scope. For instance:
    results = mgr.query(collection,context,null);
    XmlValue value;
    try {
    while ((value = results.next()) != null) {
    XmlValue c = value.getFirstChild();
    String ref = c.getNodeValue();
    c.delete(); c = null;
    value.delete(); value = null;
    catch (Exception e) {
    finally {
    if (results != null) {
    results.delete();
    results = null;
    Once i did this on all possible dbxml objects i used in my code, the java.lang.IllegalArgumentException: Invalid argument disappeared.
    Message was edited by:
    user562374

Maybe you are looking for

  • Condition WHERE in LOOP

    Good afternoon, I have the following issue, I  have that do a LOOP to a table Internal, ie. Loop at it_tabla where lgart = '0100' or lgart = '0200' or lgart = '0300' or lgart = '0400' or lgart = '0500' or  lgart = '0600' or lgart = '0700' or lgart =

  • Re: Qosmio F30-141: Is PA3237U-1ACA adapter compatible?

    I've got a Toshiba Qosmio F30-141. Its AC adapter (PA3237E-3AC3) is out of function. May I use PA3237U-1ACA instead?

  • Selection inputs in report designer

    Hello Friends, Need some help . I am currently working on BI7 and there is one requierment for Report Designer. Actaully user is looking for the selection creteria after execution of the report like I have executed the report designer application wit

  • SharePoint 2013: Edition requirement for multi tier setup.

    Dear all, I am planning to setup a high availability 3-tier SharePoint farm. My question is which edition of SharePoint 2013 should i purchase? Standard version or enterprise version? My requirement is just a simple document management system. Any he

  • Applets and Bluetooth

    What I wanna know is if it is possible to receive and transmit bluetooth communication with an applet ? I recon an Applet has certain restrictions that normal desktop application does not have.. thats why I wanna know.. I was planning on writing an a