How to create XML document in Java from scratch ?

I've downloaded the package generated for my schema.
Now I'm trying to create a XML Document using the interfaces generated and the
xmlbeans package. In documentation, all samples start with a call to XmlLoader.load(xmlinput).
In my case I've no xmlinput, I've only java parameters and i need to produce an
XML document.
Could you provide a sample code please ?
Thanks in advance.

It looks like you only need to use the xmlText() method from the root of any node
you want to print out to a file. I used a PrintStream() class and then used the
ps.print(vpDetails.xmlText()); to save to a file.
Hope this helps.
Jerald
"Eric Vasilik" <[email protected]> wrote:
>
To create a new, untyped document:
XmlObject x = XmlLoader.newInstance();
To create a new, typed document:
Map options = new HashMap(
XmlOptions.DOCUMENT_TYPE,
CustomerDocument.type );
CustomerDocument cd = (CustomerDocument) =
XmlLoader.newInstance( options );
I have changes pending which will alow you to do this more easily:
CustomerDocument cd = CustomerDocument.Factory.newInstance();
- Eric
"Pascal Fuget" <[email protected]> wrote:
I've downloaded the package generated for my schema.
Now I'm trying to create a XML Document using the interfaces generated
and the
xmlbeans package. In documentation, all samples start with a call to
XmlLoader.load(xmlinput).
In my case I've no xmlinput, I've only java parameters and i need to
produce an
XML document.
Could you provide a sample code please ?
Thanks in advance.

Similar Messages

  • How to create a report in EM from scratch level ?

    Hi,
    Can anybody help me on this ?
    The report I want to create in EM is about where the user selects a target from a drop down and it shows the CPU utilization or memory Utilization for that respective target. Is it possible to create such kind of ? If Yes, How to create the report ?
    Thanks in advance.

    Are you sure you want to create a report for this info?
    As CPU and MEM utilization changes every second, what would be the use of a report?
    I assume you are aware of the fact that CPU and MEM utilization is included for instance in the Host Homepage and can also be included in Group Pages and Dashboards.
    Regards
    Rob
    For more information on OEM GC, like Tips and Tricks please see: http://oemgc.wordpress.com

  • How to create xml entity in java?????

    public Document createXml(String Error,String src,String trg)
                 DocumentBuilderFactory docBuilderFactory = null;
                DocumentBuilder docBuilder = null;
            //    src= src.replaceAll("&","I want this ");
               //  trg= trg.replaceAll("&","Yse !!!;");
                 try {
                      docBuilderFactory = DocumentBuilderFactory.newInstance();
                      docBuilder = docBuilderFactory.newDocumentBuilder();
                      xmlDoc = docBuilder.newDocument();
                     //create the root element
                     Element errorLog = xmlDoc.createElement("errorLog");
                     //all it to the xml tree
                       xmlDoc.appendChild(errorLog);
                      Entity e1=(Entity) xmlDoc.createEntityReference("amit");
                        xmlDoc.appendChild(e1);
                       Entity e2=(Entity) xmlDoc.createEntityReference("chch");
                       xmlDoc.appendChild(e2);
                          Element error = xmlDoc.createElement("error");
                             error.setAttribute("Type",Error);
                             errorLog.appendChild(error);
                             Element source = xmlDoc.createElement("source");
                             source.appendChild(xmlDoc.createTextNode(src));
                             error.appendChild(source);
                             Element target = xmlDoc.createElement("target");
                             target.appendChild(xmlDoc.createTextNode(trg));
                             error.appendChild(target);
                 } catch (Exception ex) {
                 return xmlDoc;
            }It seem to be failing in creating entities Help plzzzzzzzzzzzzzzzzzzzzzz

    I want out put like
    <?xml version="1.0"?>
    <!ENTITY amit ' xyz'>
    <errorLog>
    <error Type="Error">
    <source> this is </source>
    <target>Yes</target>
    </error></errorLog>
    bUT iT gives rest except Entity part
    Help!!!!!!!!!!!!

  • How to convert Xml Document into orcale tempary table

    i am creating xml document into java and passing this xml into oracle database and i need to fetch this xml into result set | rowset.
    Xml Structure
    <Department deptno="100">
    <DeptName>Sports</DeptName>
    <EmployeeList>
    <Employee empno="200"><Ename>John</Ename><Salary>33333</Salary>
    </Employee>
    <Employee empno="300"><Ename>Jack</Ename><Salary>333444</Salary>
    </Employee>
    </EmployeeList>
    </Department>
    i need like this format
    Deptno DeptName empno Ename Salary
    100 Sports 200 Jhon 2500
    100 Sports 300 Jack 3000

    It does depend on your version as odie suggests.
    Here's a way that will work in 10g...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select xmltype('<Department deptno="100">
      2  <DeptName>Sports</DeptName>
      3  <EmployeeList>
      4  <Employee empno="200"><Ename>John</Ename><Salary>33333</Salary>
      5  </Employee>
      6  <Employee empno="300"><Ename>Jack</Ename><Salary>333444</Salary>
      7  </Employee>
      8  </EmployeeList>
      9  </Department>
    10  ') as xml from dual)
    11  --
    12  -- End of test data, Use query below
    13  --
    14  select x.deptno, x.deptname
    15        ,y.empno, y.ename, y.salary
    16  from t
    17      ,xmltable('/'
    18                passing t.xml
    19                columns deptno   number       path '/Department/@deptno'
    20                       ,deptname varchar2(10) path '/Department/DeptName'
    21                       ,emps     xmltype      path '/Department/EmployeeList'
    22               ) x
    23      ,xmltable('/EmployeeList/Employee'
    24                passing x.emps
    25                columns empno    number       path '/Employee/@empno'
    26                       ,ename    varchar2(10) path '/Employee/Ename'
    27                       ,salary   number       path '/Employee/Salary'
    28*              ) y
    SQL> /
        DEPTNO DEPTNAME        EMPNO ENAME          SALARY
           100 Sports            200 John            33333
           100 Sports            300 Jack           333444
    SQL>If the XML is a string e.g. a CLOB then it can easily be converted to XMLTYPE using the XMLTYPE function.

  • Heap space error while creating XML document from Resultset

    I am getting Heap space error while creating XML document from Resultset.
    It was working fine from small result set object but when the size of resultset was more than 25,000, heap space error
    I am already using -Xms32m -Xmx1024m
    Is there a way to directly write to xml file from resultset instead of creating the whole document first and then writing it to file? Code examples please?
    here is my code:
    stmt = conn.prepareStatement(sql);
    result = stmt.executeQuery();
    result.setFetchSize(999);
    Document doc = JDBCUtil.toDocument(result, Application.BANK_ID, interfaceType, Application.VERSION);
    JDBCUtil.write(doc, fileName);
    public static Document toDocument(ResultSet rs, String bankId, String interfaceFileType, String version)
        throws ParserConfigurationException, SQLException {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.newDocument();
            Element results = doc.createElement("sims");
            results.setAttribute("bank", bankId);
            results.setAttribute("record_type", "HEADER");
            results.setAttribute("file_type", interfaceFileType);
            results.setAttribute("version", version);
            doc.appendChild(results);
            ResultSetMetaData rsmd = rs.getMetaData();
            int colCount = rsmd.getColumnCount();
            String columnName="";
            Object value;
            while (rs.next()) {
                Element row = doc.createElement("rec");
                results.appendChild(row);
                for (int i = 1; i <= colCount; i++) {
                    columnName = rsmd.getColumnLabel(i);
                    value = rs.getObject(i);
                    Element node = doc.createElement(columnName);
                    if(value != null)
                        node.appendChild(doc.createTextNode(value.toString()));
                    else
                        node.appendChild(doc.createTextNode(""));
                    row.appendChild(node);
            return doc;
    public static void write(Document document, String filename) {
            //long start = System.currentTimeMillis();
            // lets write to a file
            OutputFormat format = new OutputFormat(document); // Serialize DOM
            format.setIndent(2);
            format.setLineSeparator(System.getProperty("line.separator"));
            format.setLineWidth(80);
            try {
                FileWriter writer = new FileWriter(filename);
                BufferedWriter buf = new BufferedWriter(writer);
                XMLSerializer FileSerial = new XMLSerializer(writer, format);
                FileSerial.asDOMSerializer(); // As a DOM Serializer
                FileSerial.serialize(document);
                writer.close();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            //long end = System.currentTimeMillis();
            //System.err.println("W3C File write time :" + (end - start) + "  " + filename);
        }

    you can increase your heap size..... try setting this as your environment variable.....
    variable: JAVA_OPTS
    value: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • How to create ArrayColletion in mx:Script from mx:Model id="results" source="/data/data.xml" /

    How to create ArrayColletion in mx:Script from <mx:Model
    id="results" source="/data/data.xml" />
    Please see my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Model id="results" source="/data/data.xml" />
    <mx:Script>
    import mx.collections.ArrayCollection;
    import mx.utils.ArrayUtil;
    import mx.controls.Alert;
    </mx:Script>
    <mx:ArrayCollection id ="dt1"
    source="{ArrayUtil.toArray(results.result)}"/>
    <mx:Script><![CDATA[
    [Bindable]
    public var expenses:ArrayCollection = dt1;
    [Bindable]
    public var expenses2:ArrayCollection = dt1;
    [Bindable]
    public var dp:ArrayCollection=expenses;
    public function changeDataProvider():void{
    Alert.show(expenses.toString());
    if (dp==expenses){
    dp=expenses2;
    }else{
    dp=expenses;
    ]]></mx:Script>
    <mx:Panel x="10" y="10" width="100%" height="378"
    layout="absolute">
    <mx:ColumnChart dataProvider="{dt1}" x="10" y="10"
    id="myChart" height="318" width="100%">
    <mx:horizontalAxis>
    <mx:CategoryAxis categoryField="month"/>
    </mx:horizontalAxis>
    <mx:series>
    <mx:ColumnSeries displayName="apple" yField="apple"/>
    <mx:ColumnSeries displayName="orange"
    yField="orange"/>
    <mx:ColumnSeries displayName="banana"
    yField="banana"/>
    </mx:series>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{myChart}" x="481" y="10"/>
    </mx:Panel>
    <mx:Button x="284" y="416" label="Change Data" id="bt"
    click="changeDataProvider()" />
    </mx:Application>

    Tracy,
    Thanks. That worked. However I have another related question:
    I convert the xml feed to a XMLListCollection by doing:
    <mx:XMLListCollection id="mission"
    source="{xmlFeed.lastResult.day}"/>
    and
    <mx:XMLListCollection id="mission1"
    source="{xmlFeed.lastResult.day.tBlock}"/>
    On the chart I have
    <mx:ColumnChart id="missionReadiness" height="150%"
    width="100%"
    paddingLeft="2" paddingRight="2"
    showDataTips="true" dataProvider="{mission1}">
    <mx:series>
    <mx:ColumnSeries xField="" yField="@today"
    displayName="Today"/>
    <mx:ColumnSeries xField="" yField="@tomorrow"
    displayName="Tomorrow"/>
    <mx:ColumnSeries xField="" yField="@afterT"
    displayName="After Tomorrow"/>
    </mx:series>
    </mx:ColumnChart>
    the yField works, but for the xField I want to have the @date
    but refers to the parent node, so I am clueless on how to refer to
    it.
    Also, I would like to display on the chart only the values to
    a specific date (like @date="05/17/2007").
    Any suggestions on how to do that?
    Gilbert

  • UCCX 8 - Dramatic change in the Create File Document step that is used by the Create XML Document step in order to read an XML file

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    For the last 5 years (and in IPCC3.x/4.x,UCCX/5.x/7.x) I've used the same basic subflow to read a XML document that contains holiday dates where the queue should be closed.  I've re-used this script on 20+ client installs and it's always worked.  The structure of the script allows you to pass the path and filename of the XML document as parameters to the subflow. (The document is in the repository)
    I loaded this script in UCCX 8.0.2 recently and it crashed with a Java.IO error.  It looked like it was trying to read the file system directly and not the repository. (In the Linux appliance model this kind of makes sense but why is the step trying to read the file system directly?)
    So I open a TAC case (SR# 615243125) and TAC tells me that the method of using the Create File Document step is not supported anymore and that I should specify the filename directly in the Create XML Document step
    The problem that I see (aside from having to edit all my scripts that use XML files) is that the Create XML Document step is looking for the input to be a type DOCUMENT and not a type STRING.  This seems to imply that I have to hardcode the document in each script that I deploy for a customer.  When it was a string it was easy to construct the full file path from parameters and pass to the subflow.
    Questions to the group
    #1 Am I missing something here?
    #2  Do you assume that you'll be able to load a script that worked fine in UCCX 7 into UCCX 8 and that it should completely function when you're doing everything according to the step reference documentation.
    #3 Cisco didn’t document this in any way that I can find.
    #4 How can you use the Create XML Document step in a fashion that would let you construct the path of the file and the filename previously in the script so you could pass it to a subflow ?  It would seem this functionality has been killed in UCCX 8
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    (Background)
    Create File Document Step
    The input filename is a STRING, could be an explicit path and filename in the repository or a variable that represents that path and string
    The output of this step is a DOCUMENT to be used in the Create XML Document step
    The string FILE_FullPathHolidayFiles references  en_us\folderName\documentName.xml
    The document was properly uploaded into the repository only, NOT trying to directly read c:\foo\blah…
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    The create XML document input can only be a type DOCUMENT

    #1 Am I missing something here?
    You are mixing two different issues together here.
    The Create File Document step is indeed not needed or supported for creating an XML document. That is why there is a unique step; to trigger XML parsing within the MIVR subsystem.
    Accessing the file system is restricted to a single folder within the VOS model (i.e. 8.0+). This folder is not backed up, replicated, or cleaned up automatically. It was intended to give developers some FS access as a temporary swap location only.
    #2  Do you assume that you'll be able to load a script that
    worked fine in UCCX 7 into UCCX 8 and that it should completely
    function when you're doing everything according to the step reference
    documentation.
    Assume nothing; read the documentation and attend one of the dozens of partner training sessions that CCBU put on advising of the upcoming changes.
    #3 Cisco didn’t document this in any way that I can find.
    You're right, I guess, on the Create File vs. XML Document step. AFAIK Cisco never wrote a notice into the Step Reference Guide explicitly stating that you cannot use the Create File Document although the documentation seemed pretty clear to me without it. File system restrictions are documented in the 8.0 release notes.
    Scripting and Development Series: Volume 2, Editor Step ReferenceUse the Create XML Document step to create a logical document that maps a document to another document variable (where the document has already been pre-parsed as an XML document and is ready to be accessed by the Get XML Document Data step).Use this step before the Get XML Document Data step to obtain data from a document formatted using the Extensible Markup Language (XML).
    #4 How can you use the Create XML Document step in a fashion that would
    let you construct the path of the file and the filename previously in
    the script so you could pass it to a subflow ?  It would seem this functionality has been killed in UCCX 8
    No it hasn't; just concatinate a string to build the Source Document parameter the step needs. Example:  "DOC[" + myFilePath + "]"

  • Error in tutorial: Could not create XML document carrying AQ Headers

    Hi,
    We try to run the AQOutboundCorrelation tutorial. After running the enqueue_reply.sql script the message was placed from the request to the reply queue and read by the AQ inbound adapter.
    Nothing happened in the flow. The following error occured in the domain log:
    Could not create XML document carrying AQ Headers
    Please help!!
    See log messages below
    <2007-01-18 13:58:59,187> <DEBUG> <default.collaxa.cube.activation> <AQ Adapter::Inbound> MessageReader_addPrimitive: field = PAYLOAD, value = Hallo
    <2007-01-18 13:58:59,187> <DEBUG> <default.collaxa.cube.activation> <AQ Adapter::Inbound> MessageReader_addPrimitive: field = RESULT, value = request received
    <2007-01-18 13:58:59,187> <DEBUG> <default.collaxa.cube.activation> <AQ Adapter::Inbound> MessageReader_getAsXML message:<<<<<<<
    <?xml version = '1.0' standalone = 'yes'?>
    <CORRELATIONREPLY_TYPE xmlns="http://xmlns.oracle.com/xdb/ANDRE">
    <PAYLOAD xmlns="">Hallo</PAYLOAD>
    <RESULT xmlns="">request received</RESULT>
    </CORRELATIONREPLY_TYPE>
    >>>>>>>>
    <2007-01-18 13:58:59,187> <DEBUG> <default.collaxa.cube.activation> <AQ Adapter::Inbound> MessageReader_readMessage: aqHeader = oracle.xml.parser.v2.XMLDocument@eabad
    <2007-01-18 13:58:59,187> <DEBUG> <default.collaxa.cube.activation> <AQ Adapter::Inbound> MessageReader_readMessage:Header<<<<<<<
    <?xml version = '1.0' standalone = 'yes'?>
    <Header xmlns="http://xmlns.oracle.com/pcbpel/adapter/aq/inbound/">
    <MessageId>CA714367FA1B4BB3B2AC0211C9ECF2DB</MessageId>
    <Priority>1</Priority>
    <Correlation>209EE57CB6AC4B2FA2034C6FA58AD24B</Correlation>
    <Attempts>0</Attempts>
    <EnqueueTime>2007-01-18T13:58:59.000+01:00</EnqueueTime>
    <OrigMessageId></OrigMessageId>
    </Header>
    >>>>>>>>
    <2007-01-18 13:58:59,187> <ERROR> <default.collaxa.cube.activation> <AQ Adapter::Inbound> MessageReader_ReadMessage: Could not create XML document carrying AQ Headers: [Ljava.lang.StackTraceElement;@12916fe
    <2007-01-18 13:58:59,187> <ERROR> <default.collaxa.cube.activation> <AQ Adapter::Inbound>
    java.lang.NullPointerException
         at java.lang.String.<init>(String.java:479)
         at oracle.tip.adapter.aq.database.MessageReader.readMessage(MessageReader.java:573)
         at oracle.tip.adapter.aq.inbound.AQActivationSpecDequeuer.run(AQActivationSpecDequeuer.java:183)
         at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
         at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:272)
         at java.lang.Thread.run(Thread.java:595)
    Message was edited by:
    rverbeea1

    Sorry for not mentioning the product versions:
    The bpel process was build and deployed with Jdeveloper Studio edition version 10.1.3.1.0.3984 on a Bpel server/Application Server with version 10.1.3.1 (NT).

  • Newbie - How to create XML based on given schema

    Hello,
    We have a requirement to create an XML message from our system (Oracle 9iR2 with Oracle Apps 11.5.10). The XML is generated from a query in our HR tables, and must be in a specific format (schema and example XML has been provided to us).
    Newbie question is this: What is the best way to create this XML message (dynamic data coming from a SQL select) while ensuring that it matches the given schema? Most of our developers are strong PL/SQL with limited Java experience.
    Thanks,
    -- John

    I've updated the FAQ with an answer and example for this question...
    Please see the following thread
    How to create XML from relational tables based on an XML Schema ?

  • Schema Parsing to create xml documents(Urgent)

    Hi,
    I'm new to XML and need some help for my course project. I need to parse xml schema and get the values of element name, attributes etc so that user can input values to create xml documents. Also I need to write a code that extracts the schema once the user selects schema of his choice. So its basically I need to provide dynamic interface for user to input values based on various schema.
    It would be helpful if some advices me or let me know where I can proceed.
    Thanx
    swetha

    Hello Swetha,
    If you choose an XML binding technology go with JAXB 2.0. This is an industry standard included in Java since Java SE 6. Oracle offers a JAXB implementation as part of the TopLink product see the latest tech preview), and has recently open sourced it through Eclipse (Eclipse Persistence Services or EclipseLink). EclipseLink/TopLink offers features beyond what is available in standard JAXB that you may need.
    TopLink object-to-XML/JAXB:
    http://www.oracle.com/technology/products/ias/toplink/oxm/index.html
    EclipseLink:
    http://www.eclipse.org/eclipselink/
    http://wiki.eclipse.org/EclipseLink
    You may also consider using SDO. SDO can be viewed as a dynamic object model, the metadata can be loaded from XML Schemas (even the XML Schema for XML Schema). TopLink & EclipseLink include SDO implementations. The dynamic model is very rich in metadata which may be useful to you in creating a dynamic interface. For more information on SDO see:
    http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
    If you are interested in the SDO approach post back, and I can provide more details.
    -Blaise

  • How to create a document folder using ListData.svc

    Hi All,
    I've recently been put on a project where I need to use the REST services (ListData.svc) to retrieve and add documents to the document library. It all has been smooth sailing until I hit the point where I want to save a document in a path that doesn't exist.
    I get an error if I try to save a file where the folder structure doesn't exist. I then went about it a different way trying to create the folder structure first. This also didn't work and I get an error message saying that the entity type is marked with the
    MediaEntry attribute but no save stream was set for the entity. Not too sure what set for the save stream if I'm just adding a folder.
    So my question is can a file be added to a folder structure that doesn't exist where it automatically creates the folders. If not can the service create folders?
    Some sample code I've been using:
    var folder = new SampleDocumentLibraryItem();
    folder.Name = "Sample";
    folder.Title = "Sample";
    folder.ContentType = "Folder";
    folder.Path = "/sample/folder1/folder2";
    spContext.AddToSampleDocumentLibrary(folder);
    spContext.SaveChanges();
    Thanks in advance,
    Damo

    Hi All,
    Finally managed to figure this one out. For anyone who needs source on how to create a document folder. Some sample source is below...
    var folder = new DocumentLibraryItem();
    folder.Name = "Folder Name";
    folder.Title = "Folder Name";
    folder.ContentType = "Folder";
    folder.Path = path;
    spContext.AddtoDocumentLibrary(folder);
    spContext.SetSaveStream(folder, stream, false, folder.ContentType, folder.Path + folder.Name + "|0x0120009BCC19899CEBC6468FF4EEAC7B8CF4F5"
    spContext.SaveChanges();
    So the important differences in the code above. The content type of the object and stream MUST be set to "Folder". I'm not sure why but you still need to set the save stream to be a valid stream even though you're only adding a folder. So just keep the stream
    open and then pass "true" to close it when you actually save the file. The other important element as noted from the URL's in the previous comments is you need to add a "|" + Content Type ID of a folder. You'll be able to get this ID by visiting the rest service
    for an existing document library and view source to see the actual content type id for a folder.
    Thanks everyone for your help,
    Damo

  • How to create a Document Set in SharePoint 2013 using JavaScript Client Side Object Model (JSOM)?

    Hi,
    The requirement is to create ""Document Sets in Bulk" using JSOM. I am using the following posts:-
    http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1904cddb-850c-4425-8205-998bfaad07d7/create-document-set-using-ecma-script
    But, when I am executing the code, I am getting error "Cannot read property 'DocumentSet' of undefined "..Please find
    below my code. I am using Content editor web part and attached my JS file with that :-
    <div>
    <label>Enter the DocumentSet Name <input type="text" id="txtGetDocumentSetName" name="DocumentSetname"/> </label> </br>
    <input type="button" id="btncreate" name="bcreateDocumentSet" value="Create Document Set" onclick="javascript:CreateDocumentSet()"/>
    </div>
    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"> </script>
    <script type="text/javascript">
       SP.SOD.executeFunc('sp.js','SP.ClientContext','SP.DocumentSet','SP.DocumentManagement.js',CreateDocumentSet);
    // This function is called on click of the “Create Document Set” button. 
    var ctx;
    var parentFolder;
    var newDocSetName;
    var docsetContentType;
    function CreateDocumentSet() {
        alert("In ClientContext");
        var ctx = SP.ClientContext.get_current(); 
        newDocSetName = $('#txtGetDocumentSetName').val(); 
        var docSetContentTypeID = "0x0120D520";
        alert("docSetContentTypeID:=" + docSetContentTypeID);
        var web = ctx.get_web(); 
        var list = web.get_lists().getByTitle('Current Documents'); 
        ctx.load(list);
        alert("List Loaded !!");
        parentFolder = list.get_rootFolder(); 
        ctx.load(parentFolder);
        docsetContentType = web.get_contentTypes().getById(docSetContentTypeID); 
        ctx.load(docsetContentType);
        alert("docsetContentType Loaded !!");
        ctx.executeQueryAsync(onRequestSuccess, onRequestFail);
    function onRequestSuccess() {       
        alert("In Success");
        SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
        alert('Document Set creation successful');
    // This function runs if the executeQueryAsync call fails.
    function onRequestFail(sender, args) {
        alert("Document Set creation failed" + + args.get_message());
    Please help !!
    Vipul Jain

    Hello,
    I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
    Value cannot be null.Parameter name: context"...
    Also, I tried removing SP.SOD.executeFunc
    from my code, but no success :(
    Kindly suggest !!!
    Vipul Jain

  • How many web.xml in a java application

    Hi,
    can anyone give tell the answer for this question "How many web.xml in a java application?"

    1Why ?Because the Web container refers to only one web.xml for one web application.
    I havent heard of an application having more than 1 web.xml
    How?It reads all the definitions of servlet mappings, filters, welcome-file etc from this file itself.
    Where?From the following folder ...
    /WEB-INF
    By the way ..... the way you questioned me was amuzing ... Why? How ?Where ? Its funny :D
    I actually wanted to reply as below ..
    Why ?Why not
    How?
    Wait lemme think ....ummm... What do you mean how??
    Where ?
    Inside the web ;-)
    -Rohit

  • How to create FI Document in Idoc.....

    Hi Abapers,
    I hve small doubt that
    how to create FI Document in Idoc.....?????s
    I was new to the Idoc creation .......
    can u give me step by step process..............
    Thanks & Regard
    Ravi Sarma

    Hi Rahul,
    As per my understanding you are loking for creating the IDOC per FI document.
    So if in case the multiple rows have retrived from Oracle Join query then Multiple IDOCs to be created. Per row one IDOC.
    You can do this just by changing the Occurance of IDOC
    Export the XSD structure of imported IDOC from IR and modify the occurance of IDOC field as below example
    <xsd:element name="IDOC" type="ZTEST_IDOC.ZIDOC" maxOccurs="unbounded" />
    Then Import the xsd file as external defination and use it directly in mapping.
    It will create the multiple idocs  with mapping Row field of Oracle structure to IDOC field
    Thanks
    Swarup

Maybe you are looking for

  • Does anyone know what software was used for Mac Welcome Video?

    As you may remember when you turned your mac on for the first time, a ver neat welcome video played with upbeat music. Well I just wanted to know if anybody knew what program(s) was used to make it. If you know or have any idea please tell me. Thanks

  • Video Card effecting output?

    Does the video car in a computer have anything to do with the quality of the video files Premiere Pro or Encore write to an internal Blu-Ray burner? I can certaily see how the card impacts monitors and such but can it do anything to the actual files

  • Problem from redeeming Skype Credit Card

    I got some skype credit card, more than ten, from a workshop. Every time I redeem them it says You have tried too many invalid voucher or prepaid card numbers in a row. Please wait for 30 minutes and then try again. We're sorry for the inconvenience.

  • How to Insert.jpg and .ico files onto to JButton

    Hi, When I used to inserta jpg and ico files in to JButton, it's not coming. Can please help me Thank You

  • Can we transport BW QUERY VARIANT (created in DEV) to QAS and PRD?

    Hi gurus, I created a lot of QUERY VARIANT ( parameters saved when we execute queries )  in BW DEV. I am using those variants in my Analisys Process Designer and i do not want to create again in QAS and PRD. Somebody knows how to transport those vari