Binding XML file Dynamically

Can I bind a xml file dynamically to a form? say, bind to a different xml file after user select a value from a drop down list in the form?how to do it? Thanks.

I think it's best to create different XPD files for each language and add an XML tag <language>countryCode</language> to your XML dataset and XSD file. this way you could tell the workbench to use a different xpd file for generating the PDF file.
Anyway if you want to load an XML file from your local filesystem you should check out this URL: http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm it shows you how to read & write files using javascript.
The problem you'll be facing is editing the binding and reading + validating the given XML file. Especially validating the XML vs the XSD file used in the designer will probably cause a few errors, yet this is highly recommended in order to make sure you're not modifying your PDF with the wrong (or even malicious) data.
Security-wise i would not implement it your way but make a different XPD file for each language. In the LiveCycle Workbench you can select the correct XPD file based on the data you provide. Then it's just the user who needs to specify his/her language and your pdf is always build correctly. Yet I do not know if this is applicable to your situation and/or needs.

Similar Messages

  • Generate XML file dynamically using java

    Hi,
    I searched on this topic on the net and also in this forum but everything leads to parsing an existing file using JAXP technology. But i need to create an xml file dynamically from the data coming from a different source. I can do it manually by writting the content to a file. But i am sure there is a better way for it. I would be obliged if some one could give me and example java class which produces a simple xml file or direct me to any resource online.
    Thank you in advance.

    Yes you can create the xml file dynamically. Like this,
    BufferedWriter bw = new BufferedWriter(new FileWriter("xyz.xml"));
    bw.write(buffer.toString()); //where buffer is StringBuffer whcih contains the your xml data
    bw.close();
    Remember to close the BufferedWriter, otherwise it will create the file but don't write anything.
    Hope this will help u.
    ....yogesh

  • IDoc-To-xml File Dynamic Configuration

    Hi all.
    a few days ago i posted a thread about file-to-file dynamic configuration.
    now i have to do the same but with difference that my inbound document is an IDOC, so message_header information cant be use!
    i've seen some blog like
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2161. [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    ussing file convertion, XI save a plain text document, no xml.
    What you sugguest to do?
    Rgds
    RP

    hi RAJEEV GUPTA .
    you said do this?
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //get  Key of Directory File name
    DynamicConfigurationKey keyF = DynamicConfigurationKey.create( URLFile, "FileName");
    //get  Key of Directory
    DynamicConfigurationKey keyD = DynamicConfigurationKey.create( URLFile, "Directory");
    //Replace value of Filename
    conf.put(keyF,file);
    //Replace value of Directory
    conf.put(keyD,dir);
    the problem in this case is there no Key, because there no message_header.
    do you know the sentence to generate a new key for file name and Directory?
    Rgds!
    Rp
    Message was edited by:
            Rodrigo Pertierra

  • Urgent, creating xml files dynamically, request dispatcher problem

    hi all,
    Problem 1:
    There is a problem we are facing, while request dispatching.
    The files CBECBC.XML & CBECBC_Envelop.XML,
    both xml files. These files are created on request from the user, dynamically, and displayed on the browser,
    by including them in a jsp page.
    Here we face a problem when they are to be included into the jsp page.
    The error is the following :
    //////// Error ////////
    Could not find request dispatcher for the url CBECBC.xml
    Could not find request dispatcher for the url CBECBC_Envelop.xml
    The created files are stored in the "d:\pstudio35\desks\bank\BankWeb\".
    We are using " <jsp:include page="...."/> " (dynamic jsp include tag), to include the xml files.
    Problem 2:
    And could you just let me know how to include a xml file in a jsp file,
    so that the xml file is displayed in the exact format of xml(with the tags).
    I am using Pramati Studio 3.5
    Its urgent!!!
    Regards,
    Deepa Datar

    problem 2:
    either translate all < en > into < and > or display the XML in a textarea

  • Binding Xml file with Xsd Schema

    Hello
    everybody there.
    I am trying to make an application where word files are converted into xml.
    For that i have used org.exolab.castor and org.apache.poi.hwpf.
    Now the problem is that i was able to generate the xml file from word, but when i am binding it with XMLSchema.xsd following error is coming.
    java.lang.IllegalArgumentException: getSimpleType: the simple type 'formChoice' is not a built-in type as defined in XML Schema specification.
         at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1289)
         at org.exolab.castor.xml.schema.Schema.addSimpleType(Schema.java:583)
         at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:643)
         at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:198)
         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
         at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
         at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
         at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:430)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
         at TempHwpf.<init>(TempHwpf.java:35)
         at TempHwpf.main(TempHwpf.java:44)the code for binding my xml file with xsd schema is as under:-
    SourceGenerator sourcegen = new SourceGenerator();
    sourcegen.getVersion();
    System.out.println(sourcegen.getVersion());
    sourcegen.generateSource("XMLSchema.xsd","packagename");I have checked XMLSchema.xsd file, in that formChoice is already defined, than also error is coming.
    can anyone help me out. first i thought that XMLSchema.xsd which i have is not proper, but i downloaded it again from w3c.org,
    than also same error is shown.
    please help me out.
    waiting for reply.
    milind

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • How to creat XML file dynamically

    i want to create a XML file where tags will be dynamically created based on the backend table feild name.After creating this table i want to insert this XML file into a table as a feild.

    Here is some pseudo to output a database contents to file.
      Writer.write("<Root>")
    //for each database d
      Writer.write("<" + d.getName() + ">")
       // for each table t in d
           Writer.write("<" + t.getName() + ">")
          //for each row r in t
              Writer.write("<Row>")
             //for each column c in r
               Writer.write("<" + c.getName() + " >" + c.getValue() + "</" + c.getName() + ">");
             //end for
            Writer.write("</Row>")
           //end for
         Writer.write("</" + t.getName() + ">")
       //end for
    Writer.write("</" + d.getName() + ">")     
      Writer.write("</Root>")

  • How to build a xml file dynamically with given data.

    hi there
    i need to create a writer that can create a xml with some given data. what is the procedure of creating a xml file? if it is possible, please post some samples, thank you.

    I would reccomend JDOM, although it is not the only way(DOM is another), i have found it the easiest document model to work with. http://www.jdom.org
    the code is as easy as:
    Document doc = new Document();
    Element root = new Element( "element-name" );
    root.setAttribute( "id", "1234" );
    doc.setRootElement( root );
    etc etc

  • Generate XML file Dynamically

    We want to generate an xml file for the given folder in file system. This XML should contain nested nodes for all subfolders and files. Please could any one help me with logic to generate xml?
    Sample of XML
    <Parent_Folder>
    <Sub_Folder>
    <Sub_Sub_Folder/>
    </Sub_Folder>
    <Sub_File/>
    </Parent_Folder>
    Thanks in advance.

    Welcome to the Sun forums.
    1. Please post your code using code tags, this formats it so that it is easier for people to read and understand it. Click on 'CODE' above the text area when posting.
    2. As far as possible, please post an SSCCE
    3. Please explain what you are trying, what you're expecting and what you're getting. Don't expect to be spoon-fed the answer without putting in any work.
    The very simplest way would be to simply write all the nodes yourself:
    FileWriter writer = new FileWriter(new File("myXML.xml"));
    writer.write("<Parent_Folder>");
    writer.write("<Sub_Folder>");
    writer.write(subFolderFileObject.getName());
    writer.write("</Sub_Folder>");
    //etcBut this is pretty brittle and prone to errors and would only work for the most trivial files. If you want robust XML support then you should use some library like perhaps jdom

  • Create XML file dynamically from textInput fields

    Hi,
    I'm very new to Flex and trying to create an application that creates XML files on the users' local computer, based on a users input into textInput fields.
    At the moment I'm having trouble finding how to dyamically create an external XML file at all, ideally when the user pushes a button a browseForSave dialog box will open allowing the user to select somewhere on their hard drive to create the XML file.
    Can anyone give me a hint what direction I should be heading in?
    Thanks

    If this post answered your question or helped, please mark it as such.
    You could use a SharedObject for small files, but in general Flex does not have access to the local hard drive.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      initialize="init()">
      <mx:Script>
        <![CDATA[
          public var mySO:SharedObject;
          public function init():void{
            mySO = SharedObject.getLocal("mydata");
            if(mySO.data.myData!=null){
              var xml:XML = mySO.data.myData;
              fname.text = xml.fname;
              lname.text = xml.lname;
              email.text = xml.email;
          private function storeData():void{
            var xml:XML =
              <data/>;
            if(fname.text != ""){
              xml.appendChild(<fname>{fname.text}</fname>);
            if(lname.text != ""){
              xml.appendChild(<lname>{lname.text}</lname>);
            if(email.text != ""){
              xml.appendChild(<email>{email.text}</email>);
            mySO.data.myData = xml;
            mySO.flush();
          private function resetData():void{
            mySO.clear();
            fname.text = "";
            lname.text = ""
            email.text = "";
        ]]>
      </mx:Script>
      <mx:Form>
        <mx:FormItem label="First Name:">
          <mx:TextInput id="fname"/>
        </mx:FormItem>
        <mx:FormItem label="Last Name:">
          <mx:TextInput id="lname"/>
        </mx:FormItem>
        <mx:FormItem label="Email:">
          <mx:TextInput id="email"/>
        </mx:FormItem>
      </mx:Form>
      <mx:Button label="Store Data" click="storeData()"/>
      <mx:Button label="Reload Stored Data" click="init()"/>
      <mx:Button label="Delete Stored Data" click="resetData()"/>
    </mx:Application>

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • Preserving Line and Tab Spaces in XML File

    Hi all,
    Question is in detail
    I want to preserve spaces in my XML Document.
    XML File is as follows
    <?xml version="1.0" encoding="UTF-8"?>
    <desc xml:space = "prserved">          AAA&#xD;
    &#xD;
    Customer Id: [ customer_id ]&#xD;
    Customer Id: [ customer_id ]&#xD;
    Customer Id: [ customer_id ]&#xD;
    Customer Id: [ customer_id ]&#xD;
    Customer Id: [ customer_id ]&#xD;
    </desc>
    Output of the XML File Should be like this
    AAA
    Customer Id: [ customer_id ]
    Customer Id: [ customer_id ]
    Customer Id: [ customer_id ]
    Customer Id: [ customer_id ]
    Customer Id: [ customer_id ]
    i want same output that what you see above, when i am converting xml file to pdf file.
    First, i am generating XML File dynamically
    Second, i am writing XSL File(Predefined)
    Third, Using FOP, i am converting XML to PDF(By Using XSL File)
    Here is My XSL File
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:preserve-space elements="desc"/>
    <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <fo:layout-master-set>
              <fo:simple-page-master master-name="simple">
                   <fo:region-body margin-left = "2cm" margin-right = "2cm" margin-top = "2cm" margin-bottom = "2cm"/>
              </fo:simple-page-master>
         </fo:layout-master-set>
         <fo:page-sequence master-name="simple">
              <fo:flow flow-name="xsl-region-body">
                   <xsl:apply-templates select="desc"/>
              </fo:flow>
         </fo:page-sequence>s
    </fo:root>
    </xsl:template>
    <xsl:template match="desc">
    <fo:block font-weight="bold" color = "brown"><xsl:value-of select="."/></fo:block>
    </xsl:template>
    </xsl:stylesheet>
    i used (space preserving) attributes in XML File and XSL File also. But i am getting below output.
    AAACustomer Id: [ customer_id ]Customer Id: [ customer_id ]Customer Id: [ customer_id ] Customer Id: [ customer_id ]Customer Id: [ customer_id ]
    Please help me.

    Thanks for your Response
    I want to preserve space when i convert xml file to pdf. So we need to use FO
    attributes.
    <fo:block wrap-option="no-wrap" white-space-collapse="false"><xsl:value-of
    select="."/>
    </fo:block>

  • Castor XSD Code Generation ANT task: mapping  XML file?

    Hello,
    I am new to Castor and am using the Castor Code Generator ANT task to generate code from a XSD schema file.
    I am using a binding XML file as well. One thing that I have a question about is the needed XML mapping file. I set the ‘*generateMapping*’ attribute to ‘true’ but have not found a mapping XML document.
    Is there something I am doing wrong?
    I would have attached the XSD files(some are imported), binding XML file and the ANT build.xml file in a .zip file to this post, but this forum does not have a facility for file attachments, but I can email them upon request.
    Thanks in advance,
    Andrew

    Hi Andrew,
    JAXB is the Java standard (JSR-222) for generating Java classes from an XML schema. Several implementations of this standard are available:
    - Metro JAXB: The JAXB reference implementation, available in Java SE 6 and as part of GlassFish
    - EclipseLink JAXB (MOXy): Part of EclipseLink, also available in Oracle TopLink
    - JaxMe: Available from Apache
    - Etc...
    Castor is a proprietary XML binding tool. For Castor related questions you should visit the Castor website.
    -Blaise

  • Filtering columns in a .csv file v .xml file

    Hi everyone,
    The following code fragment apparently creates a dataset from an xml file. The first line creates the dsStates dataset from an xml file called states.xm. The second line seems to be pulling in the list of cities into the dsCities dataset from the same xml file. I mean I assume this is what it's doing since it's accessing {dsStates::url} and then "/state/cities/city".
    var dsStates = new Spry.Data.XMLDataSet("../../data/states/states.xml", "/states/state");
    var dsCities = new Spry.Data.XMLDataSet("../../data/states/{dsStates::url}", "/state/cities/city");
    My question is that since I'm not using xml as the source file for the dataset I'm creating but instead I'm using a .csv file, I'm wondering whether I can create two similar constructor functions like the above xml versions. I assumed that the first line would be as follows:
    var dsTypes = new Spry.Data.CSVDataSet("data/types.csv");
    This would bring in the data from a .csv file called "types.csv".
    The question is though how would I access certain columns in this types.csv file so that I can filter them into the second dataset which would be called dsHospitals. I started off with the following line:
    var dsHospitals = new Spry.Data.CSVDataSet("    ");
    ...but then since it's not xml is there are way to target these columns as it's done in the xml version. Or are there limitations with what I can do with a .csv file compared to xml files?
    Would really appreciate any advice.

    Thanks for the reply,
    I've actually ended up using an xml file instead of a .csv due to the limitations.
    I'm pulling in some xml files dynamically into a table and have based the code on the information at the following url:
    http://labs.adobe.com/technologies/spry/samples/data_region/SpryPagedViewSample.html
    My application is identical to the one in the above url except that instead of bringing in state and cities, I'm bringing in categories instead of the states and hospital names and addresses instead of the cities.
    The example in the url uses an unordered list to display the names of the cities as in the following code:
    <div spry:region="pvFacilities dsFacilities">
          <ul spry:repeatchildren="pvFacilities" spry:choose="choose">
                <li spry:when="{pvFacilities::ds_RowID} == {pvFacilities::ds_CurrentRowID}" spry:select="select" spry:selectgroup="page" spry:selected="selected" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::name}</li>
                <li spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::name}</li>
          </ul>
    </div>
    I needed to revise this since I'm not only displaying one item, ie. the city name as in the example, but instead I'll be displaying the full hospital details which would require that the information is inserted into a table. So I had to adapt the above code to work with a table and I came up with the following:
       <div id="privRegion" spry:region="pvFacilities dsFacilities">
      <table id="private" cellspacing="0" summary="A list of private hospitals">
    <caption>Private Hospitals </caption>
    <thead>
      <tr>
        <th id="name" scope="col"><a href="#">Name</a>
          </td>
        <th id="address" scope="col">Address</td>
        <th id="suburb" scope="col"><a href="#">Suburb</a>
          </td>
        <th scope="col">State
          </td>
        <th scope="col">Postcode</td>
        <th scope="col">Phone</td>
        <th scope="col">Fax</td>
      </tr>
      </thead>
      <tbody>
      <tr spry:repeatchildren="pvFacilities" spry:choose="choose">
        <td spry:when="{pvFacilities::ds_RowID} == {pvFacilities::ds_CurrentRowID}" spry:select="select" spry:selectgroup="page" spry:selected="selected" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::Name}</td>
        <td spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::Address}</td>
        <td spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::Suburb}</td>
        <td spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::State}</td>
        <td spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::Postcode}</td>
        <td spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::Phone}</td>
        <td spry:default="default" spry:select="select" spry:selectgroup="page" spry:hover="hover" spry:setrow="pvFacilities">{pvFacilities::Fax}</td>
      </tr>
      </tbody>
    </table>
    </div>
    When I test though, it's only bringing in the first row and even then, it's only bringing in the hospital name and then 19 of the phone numbers from other hospitals! Not exactly what I was aiming for?
    Are you able to take a look at the following url to see where I may have gone wrong?
    http://files.officelinkonline.com.au/spry_test/
    Really appreciate any help/advice.

  • How to generate Java objects from XML files with out  scema compilation

    Dear participants,
    My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of structures are there. i want a generic solution. Please Help.
    Thanks ,
    Raghavendra Ach
    you can mail me to " [email protected]"

    georgemc wrote:
    You could also look at something like Apache Digester, which will parse your XML and populate Java objects with the data. A slightly steeper learning curve than the lower-level APIs such as JDOM, but that's outweighed by the lesser development effortdon't think that would work for the original problem, which seemed to indicate that the xml had an unknown structure.

Maybe you are looking for

  • Mac Mini 2007 No OS

    Hello I have a macmini 2007 that my friend gave to me with no os and I said about the recovery discs and he said he doesnt know were they are so is there any chance of getting it to run ever again except to put windows on which I dont really want to

  • Javax.xml.rpc.JAXRPCException ???????

    I have deployed a simple web service using Apache Tomcat 6.0 and Axis 1.4 in Windows XP. Now the server is very simple: [code] import java.io.*; import java.util.*; HelloWorld.java This is our web service public class HelloWorld public String getHell

  • Disable Save As Prompt in Adobe Reader XI

    Hi, we upgraded our Adobe Reader 9 Installations to Adobe Reader XI. Now in multiple pdf-documents we are getting a save as dialog by exiting the PDF. We never made changes to this documents. The PDF-Documents having this problems are generated with

  • Working on epic slideshow....really could use some help please

    I have combed the manuals, discussion logs etc. but am yet to find a simple answer to my questions. Maybe there are none. My grandparents both passed away in the last month. I am not only archiving my pictures but creating a slideshow using final cut

  • Very poor SMB share performance on 3TB time capsule.

    Hi, Is the SMB shares performance on time capsule suposed to be very poor compared to the AFP shares? My TC will to around 9MB/s transfers using AFP, but on SMB it will do around 1.25MB/s (varies from a few KB/s to peaks of 4MB/s). I tested both prot