Using XML to create files through API

Hi.
I created a new custom type - a subclass of "Document", with a few private attributes.
I wrote a small XML file that creates an instance of that type.
I have no problem using that XML with FTP or with the web interface - it parses the XML automatically and creates my custom file.
However, when I try to use the java API to do the same, it just copies the XML file into IFS, but doesn't parse it or creates the custom file that is defined in it.
I am using the IFSFileSystem.createDocument method, with parsing set to true, and "null" for the callback parameter.
Of course, the XML parser is registered (as I said, it works with FTP and web interface).
Please help.
Thanks, Edo.

Sure .. you can use XML as the data source. If you have DW8,
you can even
do it right in the Dreamweaver Interface.
Nancy Gill
Adobe Community Expert
BLOG:
http://www.dmxwishes.com/blog.asp
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August,
2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004:
A Beginner's
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP
Web Development
"melneum" <[email protected]> wrote in
message
news:e7n37t$40m$[email protected]..
> Is it possable to use xml to create user lists that can
then be searched
> to
> allow access to a section of a site like you can do with
asp? I would
> prefer
> not to use any database stuff on a site i am currently
working on but need
> a
> secured login area.
>
> Any ideas??
>

Similar Messages

  • When we use XML,XSD,WSDL files to create SOA webservices in jdeveloper ,what will happen means internally,how will useful xml ,xsd,wsdl for composite ?

    When we use XML,XSD,WSDL files to create SOA webservices in jdeveloper ,what will happen means internally,how will useful xml ,xsd,wsdl for composite ?
    How xml will send message to XSD then how wsdl interaction then to composite ?

    XSD (XML Schema Definition), is an abstract representation of a XML characteristics.
    The WSDL (Web Services Description Language), describes the functionality offered by your web service.
    You can say what operations your services offers, and describe the messages used for this operations in your XSD.

  • Sender file adapter - Can I use *.xml for the file name

    Hi Gurus,
    I have some interfaces where I need to pick the file from a directory. The name of the file will have Data<i>time stamp</i> as the naming convention. Can I use *.xml to pick up my files from this directory?
    The help.sap.com documentation says that we can use this naming convention.
    <b>
    &#9679;      File Name
    Specify the name of the file that you want to process. The name can contain placeholders (*, ? (placeholders for exactly one character)) so that you can select a list of files for processing.
    </b>
    I tried using *.xml for my file name in the communication channel, XI is not picking up this file.
    Please let me know if you have the solution.
    Thanks
    Kalyan

    Murthy,
    Thanks for the reply.
    I am using GuildFTP tool as my FTP server. In this tool, all the permissions were given for the file to pick up.
    The status of the file is good.
    Where in the file adapter configuration I have to select 'Read-only'?
    The file adapter is working perfect with the exact name of the file.
    Thanks
    Kalyan

  • How Do You Use XML To Create Image Upload On A WebSite?

    Hello,
    Could some one please help me understand how to create web image gallery and web video gallery using XML? I have found few xml codes that could be used to do this but I am not so sure how to use them. I want my clients to be able upload images and videos with linking thumbnails to Image and or Videos. Do you think the codes I included in this question will help me achive this goal? And do I need to put all in one and in the same directory so it will work? Please help with your idea and tell me how you would use these codes and how you may step-by-step implement the idea your self to your own web site.
    I have also included the instruction I found on the web with the codes.
    Starting with You Tube, API on their video gallery, here are the codes I found,
    Assume you are to use the YouTube, XML code; What will you change here so it will work on your own www.domain.com?
    <% Dim xml, xhr, ns, YouTubeID, TrimmedID, GetJpeg, GetJpeg2, GetJpeg3, thumbnailUrl, xmlList, nodeList, TrimmedThumbnailUrl Set xml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
    xml.async = False
    xml.setProperty "ServerHTTPRequest", True
    xml.Load("http://gdata.youtube.com/feeds/api/users/Shuggy23/favorites?orderby=updated") If xml.parseError.errorCode <> 0 Then
        Response.Write xml.parseError.reason End If Set xmlList = xml.getElementsByTagName("entry") Set nodeList = xml.SelectNodes("//media:thumbnail") For Each xmlItem In xmlList
        YouTubeID = xmlItem.getElementsByTagName("id")(0).Text
        TrimmedID = Replace(YouTubeID, "http://gdata.youtube.com/feeds/api/videos/", "")
        For Each xmlItem2 In nodeList
            thumbnailUrl = xmlItem2.getAttribute("url")
            Response.Write thumbnailUrl & "<br />"
        Next     Next    
    %>
    For the image gallery, the following are the codes I found with your experience do I need to use the entire codes or just some of them that I should use?
    CODE #01Converting Database queries to XML
    Using XML as data sources presumes the existence of XML. Often, it is easier to have the server create the XML from a database on the fly. Below are some scripts for common server models that do such a thing.
    These are starting points. They will need to be customized for your particular scenario.
    All these scripts will export the data from a database table with this structure:
    ID: integer, primary key, autoincrement
    AlbumName: text(255)
    ImagePath: text(255)
    ImageDescription: text(2000)
    UploadDate: datetime
    The output of the manual scripts will look like:
    <?xml version="1.0" encoding="utf-8" ?>
      <images>
         <image>
              <ID>1</ID>
              <album><![CDATA[ Family ]]></album>
              <path><![CDATA[ /family/us.jpg ]]></path>
              <description><![CDATA[ here goes the description ]]></description>
              <date><![CDATA[ 2006-11-20 10:20:00 ]]></date>
         </image>
         <image>
              <ID>2</ID>
              <album><![CDATA[ Work ]]></album>
              <path><![CDATA[ /work/coleagues.jpg ]]></path>
              <description><![CDATA[ here goes the description ]]></description>
              <date><![CDATA[ 2006-11-21 12:34:00 ]]></date>
         </image>
      </images>
    These are all wrapped in CDATA because it is will work with all data types. They can be removed if you know you don't want them.
    Note: If using the column auto-generating versions, ensure that all the column types are text. Some databases have data type options like 'binary', that can't be converted to text. This will cause the script to fail.
    CODE #02ASP Manual: This version loops over a query. Edit the Query and XML node names to match your needs.
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <%
    Dim MM_conn_STRING
    MM_conn_STRING = "dsn=image_gallery;uid=xxxx;pwd=xxxx"
    %>
    <%
    Dim rsImages
    Dim rsImages_cmd
    Dim rsImages_numRows
    ' Query the database and get all the records from the Images table
    Set rsImages_cmd = Server.CreateObject ("ADODB.Command")
    rsImages_cmd.ActiveConnection = MM_conn_STRING
    rsImages_cmd.CommandText = "SELECT ID, AlbumName, ImagePath, ImageDescription, UploadDate FROM images"
    rsImages_cmd.Prepared = true
    Set rsImages = rsImages_cmd.Execute
    ' Send the headers
    Response.ContentType = "text/xml"
    Response.AddHeader "Pragma", "public"
    Response.AddHeader "Cache-control", "private"
    Response.AddHeader "Expires", "-1"
    %><?xml version="1.0" encoding="utf-8"?>
    <images>
      <% While (NOT rsImages.EOF) %>
         <image>
              <ID><%=(rsImages.Fields.Item("ID").Value)%></ID>
              <album><![CDATA[<%=(rsImages.Fields.Item("AlbumName").Value)%>]]></album>
              <path><![CDATA[<%=(rsImages.Fields.Item("ImagePath").Value)%>]]></path>
              <description><![CDATA[<%=(rsImages.Fields.Item("ImageDescription").Value)%>]]></description>
              <date><![CDATA[<%=(rsImages.Fields.Item("UploadDate").Value)%>]]></date>
         </image>
        <%
           rsImages.MoveNext()
         Wend
    %>
    </images>
    <%
    rsImages.Close()
    Set rsImages = Nothing
    %>
    CODE #03
    Automatic: This version evaluates the query and automatically builds the nodes from the column names.
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <%
    Dim MM_conn_STRING
    MM_conn_STRING = "dsn=image_gallery;uid=xxxx;pwd=xxxx"
    %>
    <%
    Dim rsAll
    Dim rsAll_cmd
    Dim rsAll_numRows
    ' Query the database and get all the records from the Images table
    Set rsAll_cmd = Server.CreateObject ("ADODB.Command")
    rsAll_cmd.ActiveConnection = MM_conn_STRING
    rsAll_cmd.CommandText = "SELECT * FROM Images"
    rsAll_cmd.Prepared = true
    Set rsAll = rsAll_cmd.Execute
    ' Send the headers
    Response.ContentType = "text/xml"
    Response.AddHeader "Pragma", "public"
    Response.AddHeader "Cache-control", "private"
    Response.AddHeader "Expires", "-1"
    %><?xml version="1.0" encoding="utf-8"?>
    <root>
      <% While (NOT rsAll.EOF) %>
         <row>
             <%
                 For each field in rsAll.Fields
                 column = field.name
             %>
              <<%=column%>><![CDATA[<%=(rsAll.Fields.Item(column).Value)%>]]></<%=column%>>
              <%
                 Next
              %>
         </row>
        <%
           rsAll.MoveNext()
         Wend
    %>
    </root>
    <%
    rsAll.Close()
    Set rsAll = Nothing
    %>

    OK, I understand - thanks for that.
    I thought the whole process was supposed to be a bit more seemless? Having to upload/download documents and manually keep them in sync will leave a lot of room for errors.
    It's kinda painful the way iOS doesn't have folders. It makes things incompatible with the Mac and means you can't group files from multiple apps into a single project - who organises their digital life by the apps they use?
    I think I'll recommend they use their iPad only.
    Thanks for that.
    Cheers
    Ben

  • Error while creating contact through API in Install Base

    Hello
    I am trying to create contacts when creating a install base through API...
    I tried below code as per metalink note# 215456.1 and giving the below error. I checked setup andI have 'Ship To' exists in Instnace Party Account Relationsship setup in the aplication and also I have a party Id 1232890 exist in hz_parties table with party type as 'Person' and I passed contact_ip_id as instance_party_id from CSI_I_PARTIES table for the instance to be update...
    Also, can anybody help me how to purge the error messages before calling the API, suppose if i have 2 records and all two records will error then my second record error getting contatenated with my first error and message count also getting increased(see error message below as message count coming as 2 even though there is only one error)
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
    p_instance_rec CSI_DATASTRUCTURES_PUB.INSTANCE_REC;
    p_ext_attrib_values_tbl
    CSI_DATASTRUCTURES_PUB.EXTEND_ATTRIB_VALUES_TBL;
    p_party_tbl CSI_DATASTRUCTURES_PUB.PARTY_TBL;
    p_account_tbl CSI_DATASTRUCTURES_PUB.PARTY_ACCOUNT_TBL;
    p_pricing_attrib_tbl CSI_DATASTRUCTURES_PUB.PRICING_ATTRIBS_TBL;
    p_org_assignments_tbl CSI_DATASTRUCTURES_PUB.ORGANIZATION_UNITS_TBL;
    p_asset_assignment_tbl CSI_DATASTRUCTURES_PUB.INSTANCE_ASSET_TBL;
    p_txn_rec CSI_DATASTRUCTURES_PUB.TRANSACTION_REC;
    x_instance_id_lst CSI_DATASTRUCTURES_PUB.ID_TBL;
    x_return_status VARCHAR2(2000);
    x_msg_count NUMBER;
    x_msg_data VARCHAR2(2000);
    x_msg_index_out NUMBER;
    t_output VARCHAR2(2000);
    t_msg_dummy NUMBER;
    BEGIN
    p_party_tbl(1).instance_party_id := null;
    p_party_tbl(1).instance_id := 1216497;
    p_party_tbl(1).party_source_table := 'HZ_PARTIES';
    p_party_tbl(1).party_id := 1232890;
    p_party_tbl(1).relationship_type_code := 'Ship To';
    p_party_tbl(1).contact_flag := 'Y';
    p_party_tbl(1).contact_ip_id := 1699185;
    x_msg_count := 0;
    p_party_tbl(1).OBJECT_VERSION_NUMBER := 1;
    -- Now call the stored program
    csi_item_instance_pub.update_item_instance(
    1.0,
    'F',
    'F',
    1,
    p_instance_rec,
    p_ext_attrib_values_tbl,
    p_party_tbl,
    p_account_tbl,
    p_pricing_attrib_tbl,
    p_org_assignments_tbl,
    p_asset_assignment_tbl,
    p_txn_rec,
    x_instance_id_lst,
    x_return_status,
    x_msg_count,
    x_msg_data);
    -- Output the results
    if x_msg_count > 0
    then
    for j in 1 .. x_msg_count loop
    fnd_msg_pub.get
    ( j
    , FND_API.G_FALSE
    , x_msg_data
    , t_msg_dummy
    t_output := ( 'Msg'
    || To_Char
    ( j
    || ': '
    || x_msg_data
    dbms_output.put_line
    ( SubStr
    ( t_output
    , 1
    , 255
    end loop;
    end if;
    dbms_output.put_line('x_return_status = '||x_return_status);
    dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count));
    dbms_output.put_line('x_msg_data = '||x_msg_data);
    -- COMMIT;
    END;
    ERROR
    SQL> @p
    Msg1: The Party Relationship Type (Ship To) entered is either invalid or it does
    not exist in the Installed Base Lookups
    Msg2: The Party Relationship Type (Ship To) entered is either invalid or it does
    not exist in the Installed Base Lookups
    x_return_status = E
    x_msg_count = 2
    x_msg_data = The Party Relationship Type (Ship To) entered is either invalid or
    it does not exist in the Installed Base Lookups
    PL/SQL procedure successfully completed.

    Hi
    We are in 11.5.10.2 and I already checked notes which you sent before and setups are fine as the relationship type' Ship to' having 'contacts' enabled in the setup.
    I am also seeing a differernt issue as once I update existing item instnace with the status 'Return for Credit' through API, system is not allowing me to update the extended attributes through front end application manually and I am seeing a note at the end of the screen as 'Note: This item instance cannot be updated. ' and this is only happening when I update the item instance status to 'Returned for Credit' not when I create new item instances with status as 'Created'. Is this intended functionality to restrict update on extended attributes if I change the status of item instnace to 'Return for Credit' ?
    Thanks

  • Search informatio​ns about using XML to create scripts (automate tests)

    Hello,
    I search some (A LOT OF...) informations  about using XML in Labview. I know that Labview use a specific schema for XML, but I search examples or tutorials.
    My aim is to control a VI with a script in XML, I would know if I can generate "while loop", modified attributes etc... with my XML file?
    Bye

    Hi leo,
    first for all others: this is related to this thread!
    Then:
    Your script should be handled by LabView in an interpreter-style. So you read in the script and parse the commands. For each command that is supported you have to provide the functionality in a state-machine like handling routine.
    I would stay away from the before mentioned "LabView scripting", atleast for production-type programs as LV-Scripting is not supported by NI (and not easy to handle...)!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • InDesign CS3: Problem in creating assignment files through API.

    I had written some code for InDesign CS2 that allows user to
    create an empty Assignment file,export any selected pageitem and add to the Assignment,save the assignment.
    Now I have ported the same code for InDesign CS3 by following porting guidelines.
    I am facing an issue in saving the article. When any page item is exported and added to the assignment, the exported file name displayed under the newly created assignment in Assignments Palette of InDesign. But when i save the assignment the exported file is moved into UnAssigned InCopy Content in the palette.
    Also the final InCopy file doesnot contain link to exported page item file(.incx).
    I am using the following API in my code,
    void ExportStoryAndCreateLink(const UIDRef & story,const IDFile & file,
    const FileTypeInfoID & fileTypeID
    ) [virtual]
    Please post in this thread if any one has come across this issue.
    Thanks in advance,

    Hi vivek,
    Have you tried adding the same document with the client ?
    OACT is the accounts table and this error message typically indicates that there is an account parameter missing somewhere in the system.
    Possible causes include:
    - you are using a tax group or warehouse which does not have all the required accounts set
    - There is a price rounding and the rounding price account has not been set in the account settings
    - etc.
    The first things I would check include the tax group settings and the G/L Account determination settings.
    Henry

  • Using XML to create folders with ACLs

    My current create folder XML file looks as such:
    <ObjectList>
    <Folder>
    <FolderPath> / </FolderPath>
    <Name> StartHere </Name>
    </Folder>
    I wish to add an ACL to this folder. Which tags should I use to do this. Is there a document I can refer to which has a list of XML tags?
    Regards,
    Liam Corkhill

    The Dev Reference A96698_01.pdf contains XML snippets.
    Note - CM SDK 903 only supports XML parsing through the CUP utility (ifsshell).
    Matt.
    Here are some extracts:
    <?xml version="1.0" standalone="yes"?>
    <FOLDER>
      <NAME>My Work-in-Progress</NAME>
      <ACL>
        <NAME>MyCMWorkInProgressACL</NAME>
        <ACL RefType = "Name">Private</ACL>
        <ACEs>
          <ACCESSCONTROLENTRY>
            <GRANTEE ClassName='DirectoryGroup' RefType="Name">
              CMProjectGroup
            </GRANTEE>
            <ACCESSLEVEL>
              <DISCOVER> true </DISCOVER>
              <GETCONTENT> true </GETCONTENT>
            </ACCESSLEVEL>
            <GRANTED>true</GRANTED>
          </ACCESSCONTROLENTRY>
        </ACEs>
      </ACL>
    </FOLDER>
    <?xml version="1.0" standalone="yes"?>
    <FOLDER>
      <NAME>Content Management Research</NAME>
      <ACL RefType = "Name">
        ContentManagementProjectACL
      </ACL>
      <FOLDERPATH>.</FOLDERPATH>
    </FOLDER>
    <?xml version="1.0" standalone="yes"?>
    <FOLDER>
      <UPDATE RefType = "Name">Content Management Research</UPDATE>
      <ACL RefType = "Name">
        Public
      </ACL>
      <FOLDERPATH>.</FOLDERPATH>
    </FOLDER>

  • Getting Error while creating Project through API:PA_PROJECT_PUB.CREATE_PROJ

    Hi Gurus,
    I'm getting an error while creating a New project.
    My code looks like this:
    APPS.PA_PROJECT_PUB.CREATE_PROJECT
    (p_api_version_number => l_object_version_number --IN Parameter
    ,p_commit => l_commit --IN Parameter
    ,p_init_msg_list => l_init_msg_list --IN Parameter
    ,p_msg_count => l_msg_count --OUT Parameter
    ,p_msg_data => l_msg_data --OUT Parameter
    ,p_return_status => l_return_status --OUT Parameter
    ,p_workflow_started => l_workflow_started --OUT Parameter
    ,p_pm_product_code => g_pm_product_code --IN Parameter
    ,p_op_validate_flag => l_op_validate_flag --IN Parameter
    ,p_project_in => g_project_in --IN Parameter
    ,p_project_out => g_project_out --OUT Parameter
    ,p_tasks_in => g_task_in --IN Parameter
    ,p_tasks_out => g_task_out --OUT Parameter
    The out put params are: p_msg_count => 1
    p_return_status => E
    p_workflow_started => N
    g_project_out.pa_project_id => 170000000000000000000
    g_project_out.pa_project_number => ^
    g_task_out_rec.pa_task_id => 170000000000000000000
    End process record p_proj_insert => 1
    Resetting the task count variable
    when I checked the API code I found this:
    PA_INTERFACE_UTILS_PUB.G_PROJECt_ID := null; --bug 2471668 ( not in the project context )
    PA_PM_FUNCTION_SECURITY_PUB.check_function_security
    (p_api_version_number => p_api_version_number,
    p_responsibility_id => l_resp_id,
    p_function_name => 'PA_PM_CREATE_PROJECT',
    p_msg_count => l_msg_count,
    p_msg_data => l_msg_data,
    p_return_status => l_return_status,
    p_function_allowed => l_function_allowed
    . I think I am getting the error because of this.
    Now, question.
    Do I need to run the Create Project from a specific Responsibility?
    because when I ran the underlined query, I fpound the final status as 'N'.
    I'm a HR guy and PA is a new world for me. Any help will be appreciated.
    Thanks!!
    Viky

    You need to find any responsibility and userid that lets you create a project using the screen.
    And then in your code, you need to set your context to that resp/userid.
    Hope this helps
    Sandeep Gandhi

  • Unable to create Groups through API

    Hi,
    I have an approval workflow for creation of a new organization and it works fine.Once the last level of approval is completed, I should create a new org and three groups inside OIM. My adapter creates the new organization successfully. however, I am getting exception when I try to create the groups. Can someone please tell me what the issue is. I have assigned all the group permissions to the user group approving the request.Following is the code snippet and exception that I get:
    HashMap<String,String> orgMap = new HashMap<String,String>();
                   orgMap.put("Organizations.Organization Name", orgName);
                   orgMap.put("Organizations.Type", "Organization");
                   long orgKey = orgOper.createOrganization(orgMap);
                   System.out.println("New Organization Created");
                   HashMap<String,String> groupMap = new HashMap<String,String>();
                   groupMap.put("Groups.Group Name", orgName+" Admin");
                   long adminGroupKey = groupOper.createGroup(groupMap); - this is the line I get the following exception
    Running CREATENEWORG
    Target Class =security.iam.identity.adapters.tasks.CreatePartnerOrg
    Initializing Class
    New Organization Created
    ERROR,08 Mar 2011 16:52:10,660,[XELLERATE.SERVER],Class/Method: tcDataObj/eventPreInsert Error :Insert permission is denied
    ERROR,08 Mar 2011 16:52:10,661,[XELLERATE.APIS],Class/Method: tcGroupOperationsBean/createGroup encounter some problems: maoRejections:You do not have permission to insert this object.
    Thor.API.Exceptions.tcAPIException: You do not have permission to insert this object.
    Thanks,
    Supreetha

    You need to give your user insert/create permissions for groups. If it is creating it after the approval is completed, then you need to assign the permissions to the group of users who would perform the last approval because their session is passed onto the rest of the tasks. You could use private key authentication though to switch to xelsysadm and use that user to create the group.
    -Kevin

  • Problem in uploading file through API

    I want to upload files in to mycontent folder through our
    application.After each steps followed, i get the status message ok
    from the server, but file is not uploaded. Is there any idea about
    this? Please help.

    what do you mean exactly with 'the file is not uploaded'?
    you checked in the content directory and the file isn't
    there?
    if so, could you please post your server side upload
    code?

  • Dynamically creating file using variable

    HI, i am facing an issue in creating file on run time using variable.
    i have a variable FileName. In refresh tab i have written a query like SELECT TO_CHAR(SYSDATE,'YYYY,MM,DD') || 'TEST' FROM DUAL. i tested the variable and its value is correct.
    i have created an interface to extract the data from table and store it in file. i have assigned variable FileName to the file.
    Now when i run the interface...the file is created but the header is created in different file and its name is ambiguous e,g(19) and the data is placed in other file with the name which is the value of variable FileName.....
    ISSUE is two ODI creates two files one for header only and other for data....
    when i run my interface in a package the file created perfectly ..... but i dun want to use package i want to create file through running interface only

    one file name is some number like 19.txt and other filename is 20121211_TEST.txt (this name is coming from variable).....
    however when i create a package with variable and interface,only one file is created 20121211_TEST.txt (header and data are not created in separate files.)
    create header     (ID,
         NAME,
         DEPT)
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=TARGET_FILESNP$CRLOAD_FILE=*E:\tempProj/19*SNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=0x007eSNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=IDSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLINE_OFFSET=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=NAMESNP$CRTYPE_NAME=STRINGSNP$CRORDER=2SNP$CRLINE_OFFSET=51SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=DEPTSNP$CRTYPE_NAME=STRINGSNP$CRORDER=3SNP$CRLINE_OFFSET=101SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CR$$SNPS_END_KEY*/
    Edited by: 975356 on Dec 11, 2012 10:57 PM
    Edited by: 975356 on Dec 11, 2012 10:58 PM

  • Using XML as persistance

    I'm re-writing a swing client that uses regular serialization to files in order to save user data. The data that needs to be persisted to file is very hierarchical by nature. I'm using MVC throughout the application.
    Now, I'm considering using XML as the file format for the persistence. I've written an XML schema (xsd) that dictates the data model.
    As I've stumbled upon XStream before I first had a look at that for marshalling/unmarshalling my XML. XStream is wonderful but it kind of makes the XML schema validation useless as I see it. So, now I'm looking at JAXB (or maybe XMLBeans) instead as the API between my XML files model layer in the application.
    Basically, what I'm looking for is a convenient way to read XML data from file into my data model. Obviously I want to be able to create XML from my data model as well. Will JAXB really save me from doing all the mapping between the XML and data model (POJO's) based on my XML schema?
    Am I barking at the wrong tree here? Also, please stop me if you think that XML are a ridiculous way of persisting application data.
    Thanks in advance!

    Thank you for your input DrClap!
    My Swing app is kind of a CAD app where users can make drawings of marinas. Objects can be moved, rotated, connected to each other and grouped and each object has a set of properties. The drawing layout, object props and calculation parameters needs to be persistent. Think MS Visio... Target audience is marine engineers that needs to make force calulations.
    Generating an xml file from my xml schema produces a file on about 7Kb (about 200 lines). A real life file would probably be at least 10 times bigger.
    I don't see an issue with updating or adding single elements in the XML. This is only done when the user saves to file, in all other cases the application would store data in the model layer. And as I understand it JAXB would handle all XML marhsalling/unmarshalling automagically.
    The only thing I'm worried about is having JAXB generating the model classes from my xml schema (xsd). Since I'm working with MVC my current model classes all fire property change events to its controllers whenever a setter is called. This would be lost if JAXB would generate the model for me. Am I right? My assumption with JAXB/XMLBeans is that you update the model by changing your xml schema and then generate/compile you model classes (and ObjectFactory).
    Thank you for taking your time to read this!

  • Use xml file to create a word/pdf document

    i have a xml doument created using jdom i need to create a word or a pdf document from this file
    is there a way to tackle this using java? or what else would you recomend?

    Without knowing any details, I would guess that you have a couple of options;
    Parse the xml using SAX or some similar tool and use the data recovered to create the document using an existing API; HWPF for example would allow you to create a simple Word documnet or, if you were much braver, you could use the SWT to 'drive' Word using OLE/COM.
    If you are very lucky and the xml document conforms to the format Word has recently begun to recognise, you could just try opening the document in Word using the Desktop class.
    As far as I am aware, there is no one tool that will do all of this for you. Of course, you could try using Google of visiting Sourceforge to see if anyone is working on such an application.

  • File is corrupted error while creating excel using xml

      Hi have created one excel file using XML code and sent it to mail as attachement. But when i open it, it displays error  message - file is corrupted and cannot be opened.
    below is my code - please review and tell what is wrong in it ASAP :
    * Creating a ixml Factory
       l_ixml = cl_ixml=>create( ).
    * Creating the DOM Object Model
       l_document = l_ixml->create_document( ).
    * Create Root Node 'Workbook'
       l_element_root  = l_document->create_simple_element( name = 'Workbook'  parent = l_document ).
       l_element_root->set_attribute( name = 'xmlns'  value = 'urn:schemas-microsoft-com:office:spreadsheet' ).
       ns_attribute = l_document->create_namespace_decl( name = 'ss'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:spreadsheet' ).
       l_element_root->set_attribute_node( ns_attribute ).
       ns_attribute = l_document->create_namespace_decl( name = 'x'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:excel' ).
       l_element_root->set_attribute_node( ns_attribute ).
    * Create node for document properties.
       r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT'  parent = l_element_root ).
       l_value = sy-uname.
       l_document->create_simple_element( name = 'Author'  value = l_value  parent = r_element_properties  ).
    * Styles
       r_styles = l_document->create_simple_element( name = 'Styles'  parent = l_element_root  ).
    * Style for Header
       r_style  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
       r_style->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Header' ).
       r_format  = l_document->create_simple_element( name = 'Font'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Bold'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Interior' parent = r_style  ).
       r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#92D050' ).
       r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss'  value = 'Solid' ).
       r_format  = l_document->create_simple_element( name = 'Alignment'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Vertical'  prefix = 'ss'  value = 'Center' ).
       r_format->set_attribute_ns( name = 'WrapText'  prefix = 'ss'  value = '1' ).
       r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
    * Style for Data
       r_style1  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
       r_style1->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Data' ).
       r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style1 ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
    * Worksheet
       r_worksheet = l_document->create_simple_element( name = 'Worksheet'  parent = l_element_root ).
       r_worksheet->set_attribute_ns( name = 'Name'  prefix = 'ss'  value = 'Sheet1' ).
    *  r_worksheet->set_attribute_ns( name = 'Protected'  prefix = 'ss'  value = '1' ).    " WORKING
    * Table
       r_table = l_document->create_simple_element( name = 'Table'  parent = r_worksheet ).
       r_table->set_attribute_ns( name = 'FullColumns'  prefix = 'x'  value = '1' ).
       r_table->set_attribute_ns( name = 'FullRows'     prefix = 'x'  value = '1' ).
    * Column Formatting
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '40' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '140' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '150' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
    * Blank Row
       r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
    * Column Headers Row
       r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
       r_row->set_attribute_ns( name = 'AutoFitHeight'  prefix = 'ss'  value = '1' ).
    * RFQ No.
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ No.'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * RFQ Line Item No
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ Line Item No.'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Material
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Material'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Quantity
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Quantity'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  Order UNIT
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Order Unit'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  Delivery Date
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Delivery Date'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  RFQ Creation Date
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ Creation Date'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  RFQ Deadline Date
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ Deadline Date'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Price
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Net Price'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    ** Login
    *  r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
    *  r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
    *  CONCATENATE 'Login - ' lv_date+6(2) '/' lv_date+4(2) '/' lv_date+0(4) INTO l_value.
    *  r_data = l_document->create_simple_element( name = 'Data'  value = l_value  parent = r_cell ).
    *  r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Blank Row after Column Headers
       r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
    * Data Table
       LOOP AT it_final1 INTO wa_final1.
         CLEAR l_value.
         r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
    * RFQ No.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         CLEAR l_value.
         l_value = wa_final1-ebeln .
    *    CONDENSE l_value NO-GAPS.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value  parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'String' ).                               " Cell format
    * Line Item No
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-ebelp.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'Number' ).                               " Cell format
    * Material
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-txz01.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'String' ).                               " Cell format
    * RFQ QTY
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-ktmng.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'Number' ).                               " Cell format
    * UNIT
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-meins.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell

    How to make a particular column non editable?
    Make your style protected and pass that style name to your required column while passing data.
    for example:
    Find below the code for protection of a style.
    Last two lines are very important.
    * Style for Headert
       r_style  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
       r_style->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Headert' ).
       r_format  = l_document->create_simple_element( name = 'Font'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Bold'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Interior' parent = r_style  ).
       r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#B2FF64' ).      
       r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss'  value = 'Solid' ).
       r_format  = l_document->create_simple_element( name = 'Alignment'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Vertical'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'WrapText'  prefix = 'ss'  value = '1' ).
       r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Protection'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Protected'  prefix = 'ss'  value = '1' ).

Maybe you are looking for