Create DATA ELEMENT with passing Parameter

Dear All,
     When we create the Data elementt in tcode SE61, normally we will write the text inside the text area.  How about can we  pass the paramater to the data element in tcode SE61 ?
  Example i pass the parameter with the text  "Tesing 123" , so the Data element will display Testing 123 when being called. The text flexible.
Thank

Hello
I want to use TPLNR to create data element in Operating Concern but I am not able to because of length of TPLNR (30) in Operating Concern we can create data element only upto 18 char. If i want to create new data element YTPLNR.
I did following steps
1. SE11
2. Data Element
3. and settings of particular data element what ever is required.
My question is how can I use YTPLNR as characteristic as same value of TPLNR. I want all data that is available in TPLNR. I am creating new element because of data length issue.
Table: IFLOT has data element TPLNR. I want all information of TPLNR in YTPLNR how it is possible to use that info in that.
I tried to create user defined characteristics for operating concern
i want to use with reference to existing value option in user define
How can I do that
thank you

Similar Messages

  • How to create Data Element TPLNR

    Hello
    I want to use TPLNR to create data element in Operating Concern but I am not able to because of length of TPLNR (30) in Operating Concern we can create data element only upto 18 char. If i want to create new data element YTPLNR.
    I did following steps
    1. SE11
    2. Data Element
    3. and settings of particular data element what ever is required.
    My question is how can I use YTPLNR as characteristic as same value of TPLNR. I want all data that is available in TPLNR. I am creating new element because of data length issue.
    Table: IFLOT has data element TPLNR. I want all information of TPLNR in YTPLNR how it is possible to use that info in that.
    I tried to create user defined characteristics for operating concern
    i want to use with reference to existing value option in user define
    How can I do that
    thank you

    Hi,
    just a small addition for the Binary Search: The table must be sorted by the field(s) you are looking for:
    Symbolic code:
    read table <itab> with key <field> = <value> binary search.
    will take a record in the middle of the internal table first. If <field> < <value> the next try will be in the middle of the first half and the same procedure is repeated until the searched record is found or not found.
    If the table is not sorted correctly, you will probably miss the matching records.
    The fastest way is to use HASHED tables with unique key. The binary search will take more time when the table grows; hashed table access is (nearly) stable.
    Regards,
    Clemens

  • Creating Data Server with DB2

    Hello Experts,
    I am creating data servers with database DB2 in xMII 12.1
    This is the details:
    Connector : IDBC
    Connector type : SQL
    JDBC driver : com.inet.tds.TdsDriver
    Server Package : com.sap.xmii.Illuminator.connectors.IDBC
    Server Url : jdbc:inetdae:BGC125:5912?database=MD1&sql7=true
    When I am checking the status, it is coming stopped
    I had checked in NWA, and JDBC driver is green.
    Please help me on that.
    Regards,
    Dipak

    Thanks for the quick reply John. I am trying to get user and group information, and also doing some complex manipulation. I need this to verify user access and some other stuff. I will not always have access to HSS and cannot always export the information, thus the need to use the HSS java API.
    I'm trying to pull it out of HSS and put it into an Oracle table in a standard format where I'll use the information and do reporting off of it. I've developed a java class that does migrates the data over, but its crude and I'd like to move it into ODI with some of our projects that are currently doing the same thing with other ERP such as Ebiz and Peoplesoft.
    If I can recode some of the java in ODI, how would I go about doing that. Where would I include the libraries, etc.? is there a tutorial or a place where I can get started on that.
    Thanks for all the help.

  • How create data store with PermSize = 4096MB on HP-UX 64-bit?

    Hi!
    I use TimesTen 7.0.2:
    TimesTen Release 7.0.2.0.0 (64 bit HPUX/IPF) (tt70_1:17001) 2007-05-02T05:22:15Z
    Instance admin: root
    Instance home directory: /opt/TimesTen/tt70_1
    Daemon home directory: /var/TimesTen/tt70_1
    Access control enabled.
    I set PermSize = 4096MB for my new data store. Then I tryid to create it:
    ttIsql -connStr "DSN=tt_rddb1;UID=ttsys;PWD=ttsys;OraclePWD=ttsys;Overwrite=1" -e "exit;"
    But operation was failed:
    836: Cannot create data store shared-memory segment, error 22.
    Can I create data store with such size on HP-UX 64-bit???

    Is largefiles enabled? I believe you can check with fsadm -F vxfs /filesystem
    Also please understand that 'PermSize' is not the only attribute affecting the size of the timesten shared memory segment. The actual resulting size is
    PermSize + TempSize + LogBuffSize + Overhead
    So you would need to configure shmmax to be > 4g. Have you tried setting it to (say) 8g (just for testing purposes to see if it eliminates the error).

  • How create data store with PermSize 512MB on WIN32?

    Hi!
    How create data store with PermSize > 512MB on WIN32? If I set PermSize > 512MB on WIN32, then data store becomes invalid.

    Thanks for the details. As I mentioned, due to issues with the way Windows manages memory and address space it is generally not possible to create a datastore larger than around 700 Mb on WIN32. Sometimes you may be lucky and get close to 1 GB but usually not. The issue is as follows; on Windows, a TimesTen datastore is a shared mapping created from memory backed by the paging file. This shared mapping must be mapped into the process address space as a contiguous range of addresses. So, if you have a 1 GB datastore then your process needs to have a contiguous 1 GB range of addresses free in order to be able to connect to (map) the datastore. Unfortunately the default behaviour of Windows is to map DLLs into a process address space all over the place and any process that uses any significant number of DLLs is very unlikely to have a contiguous free address range larger than 500-700 Mb.
    This problem does not exist with other O/S such as Unix or Linux nor does it exist with 64-bit Windows. So, if you need to use a cache or datastore larger than around 700 Mb you need to use either 64-it Windows or another O/S. Note that even on 32-bit Linux/Unix TimesTen datastores are limited to a maximum size of 2 GB. If you need more than 2 GB you need to use a 64-bit O/S.
    Chris

  • COPA unable to create as charac data element with LIFNR as domain HELP ASAP

    Hi
    We had a data element created with KUNNR as domain.
    We added to PAPARTNER STRUCUTRE and created as characteristics in our operating concern.
    Now there is a need to change to LIFNR as domain instead of KUNNR.
    There we created a new dala element with LIFNR as domain and added to PAPARTNER
    structure and when we tried to create them as characterisc system did not let us transfer to
    our operating concern.
    We do not know why we are unable to create this characterisic.
    When we tried to create the characteristic it was shown under 'Transfer from'
    But when we wanted to move right to left it was shown under 'grey' status and not ready for transfer.
    We need a solution very urgent and any help is greatly appreciated.
    Thanks
    Raj

    Hi
    KEA0 - Display Data Structure
    Now, Extras > Chars > Unlock
    after this try to push from right to left
    br, Ajay M

  • Problem to create data source with OCI type of driver

    Hi Experts
    We are creating an XA datasource with OCI type of driver using an enterprise application with data-sources.xml, the xml is like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE data-sources SYSTEM "data-sources.dtd" >
    <data-sources>
         <data-source>
              <data-source-name>OCI_DS_XA</data-source-name>
              <driver-name>ORACLE_DRIVER</driver-name>
              <init-connections>1</init-connections>
              <max-connections>25</max-connections>
              <max-time-to-wait-connection>120</max-time-to-wait-connection>
              <expiration-control>
                   <connection-lifetime>60</connection-lifetime>
                   <run-cleanup-thread>300</run-cleanup-thread>
              </expiration-control>
              <sql-engine>Vendor_SQL</sql-engine>
              <jdbc-2.0>
                   <xads-class-name>
                        oracle.jdbc.xa.client.OracleXADataSource
                   </xads-class-name>
                   <object-factory>
                        oracle.jdbc.pool.OracleDataSourceFactory
                   </object-factory>
                   <properties>
                        <property>
                             <property-name>serverName</property-name>
                             <property-value><SERVER_NAME></property-value>
                        </property>
                        <property>
                             <property-name>serverPort</property-name>
                             <property-value>1521</property-value>
                        </property>
                        <property>
                             <property-name>databaseName</property-name>
                             <property-value>ORCL</property-value>
                        </property>
                        <property>
                             <property-name>driverType</property-name>
                             <property-value>oci</property-value>
                        </property>
                        <property>
                             <property-name>user</property-name>
                             <property-value>username</property-value>
                        </property>
                        <property>
                             <property-name>password</property-name>
                             <property-value>password</property-value>
                        </property>
                   </properties>
              </jdbc-2.0>
              </data-source>
    </data-sources>
    We have installed oracle client in server M/C and configured all the environment variables. While we are deploying the application from CE developer studio IDE to the CE 7.1 AS, we are getting the  following error:
    Description:
              1. Exception has been returned while the 'sap.com/DS_TEST_EAR' was starting. Warning/Exception :
    [ERROR CODE DPL.DS.6193] Error while ; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5030] Clusterwide exception: server ID 7653550:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot create DataSource "OCI_DS_XA".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1467)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.prepareStart(ContainerImpl.java:468)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:219)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:179)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:419)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesImpl(ParallelAdapter.java:495)
         at com.sap.engine.services.deploy.server.application.StartTransaction.makeAllPhasesImpl(StartTransaction.java:554)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:248)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:389)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3387)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3373)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3276)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3249)
         at com.sap.engine.services.dc.lcm.impl.J2EELCMProcessor.doStart(J2EELCMProcessor.java:99)
         at com.sap.engine.services.dc.lcm.impl.LifeCycleManagerImpl.start(LifeCycleManagerImpl.java:62)
         at com.sap.engine.services.dc.cm.deploy.impl.LifeCycleManagerStartVisitor.visit(LifeCycleManagerStartVisitor.java:34)
         at com.sap.engine.services.dc.cm.deploy.impl.DeploymentItemImpl.accept(DeploymentItemImpl.java:83)
         at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcessLCMDeplItem(DefaultDeployPostProcessor.java:80)
         at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcess(DefaultDeployPostProcessor.java:56)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doPostProcessing(DeployerImpl.java:741)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.performDeploy(DeployerImpl.java:732)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doDeploy(DeployerImpl.java:576)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:270)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:192)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImplp4_Skel.dispatch(DeployerImplp4_Skel.java:875)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
         at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
         at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
         at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
         at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
         at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
         at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
         at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
    Caused by: com.sap.engine.frame.core.database.DatabaseException: Exception of type java.sql.SQLException occurred: Closed Connection.
         at com.sap.engine.core.database.impl.DataSourceAdministratorImpl.createDataSource(DataSourceAdministratorImpl.java:49)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1400)
         ... 33 more
    Caused by: java.sql.SQLException: Closed Connection
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
         at oracle.jdbc.driver.GetCharSetError.processError(T2CConnection.java:3082)
         at oracle.jdbc.driver.T2CConnection.getCharSetIds(T2CConnection.java:2811)
         at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:300)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:344)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:136)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
         at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:194)
         at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:121)
         at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:333)
         at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:84)
         at com.sap.sql.connect.factory.XADSPooledConnectionFactory.getPooledConnection(XADSPooledConnectionFactory.java:27)
         at com.sap.sql.connect.datasource.DBDataSourceImpl.createPooledConnection(DBDataSourceImpl.java:677)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.initConnections(DBDataSourcePoolImpl.java:1099)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.<init>(DBDataSourcePoolImpl.java:49)
         at com.sap.sql.connect.datasource.DataSourceManager.createDataSource(DataSourceManager.java:507)
         at com.sap.sql.connect.datasource.DataSourceManager.createDataSource(DataSourceManager.java:136)
         at com.sap.sql.manager.OpenSQLManager.createDataSource(OpenSQLManager.java:141)
         at com.sap.engine.core.database.impl.DataSourceAdministratorImpl.createDataSource(DataSourceAdministratorImpl.java:42)
         ... 34 more
    But when we are creating the datasource with thin type of driver, it is working fine. We have already created a driver with name “ORACLE_DRIVER” in server using the ojdbc14.jar using Netweaver administrator consol.
    Same this is happening when we are creating the OCI type of datasource by using Netweaver administrator consol by specifying all the parameter as above and also the initial connection pool size is more than zero.
    Same thing is happening for normal (JDBC 1x) datasource creation with OCI type driver.

    Hello,
    I ran a search on SDN, related to your error code, i found the following:
    UnsupportedClassVersionError in NWDS CE
    DeploymentWarning-WebService-Collection
    Maybe its useful to you
    Regards,
    Siddhesh

  • How to create date variable with interval in VC

    Hi Everyone,
    I have 2 questions:
    <u>My scenario:</u>
    I am using a BI 7.0 Query which is having some variables. I want the same variables to be displayed in the VC output.
    <u>Question 1:</u>
    I know that how to bring these variables in variable screen, but when we use these queries, dont the variables in the variable screen automatically ask for the input?
    I tried it but it is not happening automatically.
    There are 2 inputs for queries with variables, i tried using both, but it is not working properly. Can any one tell me is it possible.
    <u>Question 2:</u>
    In this variable screen, I have to select date with interval format. but i dont know how to use variable with interval. ( Date with interval format).
    I hope some one might have come across the same scenario .. If so please share with the solution me ..
    Regards,
    Chan

    Ok .. Let me be very clear .. I think I confused you.
    As you mentioned I have done every thing in query level.
    I have created a query with a variable which is an interval based variable(date).
    When I execute the query it asks for the dates to display the inbetween data.
    I gave the inputs and the data is displayed properly.( So far what I have mentioned is all in Query designer).
    In VC, I have used this query and it is having two ports named INPUT and VARIABLE. I know that I need to give input in variables. I selected the calander month variable from the list to display. After this I deployed the model. In the output screen the table is displayed and 1 text box is also available for the date input. I know that here I have to give date with same format as in Query designer output. I tried so many ways to give input by even selecting some other options like date picker but it is giving the following error - <b>Variable expects interval values; enter an interval.</b>
    The date format which I m using in Query is "MM.YYYY" and I m using the same format in VC too.
    Now I hope that u can understand better.
    I want to know is there any other way through which this can enter interval value or what mistake I m doing in the above explained scenario?
    Regards,
    Chan

  • LabVIEW created .DAT file with saving only new data on existing files

    I can successfully create and save a .DAT file using LabView and Diadem.   The save command I am using (in Labview) only overwrites existing files, I would like it to save only the new data from the last save.  Overall I would like to save the data every 1hr and since my test will last for many hours, the further along in the test the longer it would take to save the full file.  I know Diadem has the capability to save in such a manner, so I have thought about after I write to Diadem have a small Diadem application save periodically, but I haven't found a way to save the .DAT file, with out any signals coming into the save function.  I have attached the example .DAT file creater and saver I am using to figure it out.  thanks for your help!

    Howdy New Guy -
    I am not sure if you are looking to append to a file, or if you would
    like to overwrite a file.  In either case, you can take a look at
    the "Append To File.vi" example for DIAdem. 
    Either way, you may be experiencing problems because you are only using
    the "DIAdem Simple File Write.vi" (found on the DIAdem >> DAT
    Files palette).  Instead, you can use the "DIAdem File Write.vi"
    (located on teh DIAdem >> DAT Files >> DAT Files Advanced
    palette).  This VI can be set to overwrite or append to file.
    I hope this helps in your development!
    Andrew W. || Applications Engineer

  • How to create Date relationship with Fact and DimDate on Tabular model?

    I have two tables in SQL Server 2014 SSAS Tabular model.
    DimDate(defined as data table) have date column (format is 1.7.2010 00:00:00) This table have been impoted from AdventureWorks.
    FactSales have SalesDate column (format is 25.03.2015 18:08:05). This table have been imported from Excel. Colums is defined as date in Excel.
    When I set Data Type as date in Tabular I get error:
    "Datatype conversion failed for table...Value:'25.03.2015 18:08:05'"
    I have tried to create calculated colums like =DATEVALUE([SalesDate]) and =DATE(YEAR([SalesDate]),MONTH([SalesDate]), DAY([SalesDate])), but getting error.
    What should I do so that I can create relationship between Date column?
    Kenny_I

    Hi Kenny_l,
    According to your description, you fail to convert the data type into date after creating calculated column with expression. Right?
    In Analysis Services, the tabular will detect the source data type to determine which data type can be converted to. If you want to convert a data into date type, no matter this data is from database or a file, you must make sure this data can be recognized
    as a date in SQL Server. In this scenario, the format '25.03.2015 18:08:05' can't be recognized as date even you apply DAX functions. So please change the format of the column in excel like "03.25.2015 18:08:05".
    PS: For testing, you can create a temp table and insert sample text into a date column, because the date format in SQL Server depends on the location selection when installing.
    After retrieving data from data source and all values within column are correct format, you can change the data type into Date, and select the format you expect.
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Cannot Create Data Repository with VM Server (3.1.1) Cluster

    Dear All,
    I have 3 Servers (one for VM Manager, two for VM Servers) and 1 Storage (Sun Storage 6180 (Fiber Chanel) and map volume as Default Storage Domain ).
    I try to create my 2 VM Servers as Cluster on VM Manager but it has problem as below:
    Case1. I can create a Server Pool with cluster by select Clustered Server Pool by select physical disk, add 2 servers then create data repository but it got problem: in page Create a Data Repository: Select Physical Disk is shown blank not see a physical disk.
    Case 2. when I create server pool by uncheck Clustered Server Pool box (None Cluster) and add 2 vm servers then create data repository, the physical disk is shown but got error message:
    "OVMRU_002030E Cannot create OCFS2 file system with local file server: Local FS vmserver1. Its server is not in a cluster
    Wed Dec 26 01:27:12 ICT 2012"
    Please kindly give advice for this.
    Thanks and regards,
    Vandy

    1. So you're trying to create a server pool and a storage repository on a single LUN that is direct attached? Don't your software on the 6180 allow you present multiple LUNS from disk group? Think about it. You create a clustered server pool on a single LUN and then try to use that same LUN for repository.....
    2. How are both hosts attached? Are there multiple HBA cards in your 6180? Is so, how many? If you have redundant cards you should be using multipathing for redundancy.

  • Creating a method with ByRef parameter

    Hi All,
    when i am creating a method with parameter as ByRef, i am getting the message as fallows.
    Please use valid signature.
    help me to overcome frojm this.
    Thanks in advance.
    With Regards
    Raju

    Hi,
    strange... I even thought that ByRef is default parameter type for sub... maybe you can try this.
    Or try to create your sub directly in the project file, maybe then you will have a proper error message from MS.
    Regards,
    Wolfhard

  • Create XML-element with different prefixes

    Hello,
    In Infopath 2010 I want to generate a XML-element with C#.
    I've got a XML-structure with following elements:
    /my:meineFelder/my:gruppe1/my:gruppe2/my:unter/my:art
    /my:meineFelder/my:gruppe1/my:gruppe2/ns1:FW1/MANDT
    To fill the field "art" I use this code:
    string myNamespace = NamespaceManager.LookupNamespace("my");
    writer.WriteStartElement("gruppe2", myNamespace);
      writer.WriteStartElement("unter", myNamespace);
        writer.WriteElementString("art", myNamespace, "lets go");
      writer.WriteEndElement();
    writer.WriteEndElement();
    writer.Close();
    This works very well.
    Problem: the code above do not work for the second field MANDT. Error: Error during Schema Validation.
    /my:meineFelder/my:gruppe1/my:gruppe2/ns1:FW1/MANDT
    I tried this:
     writer.WriteStartElement("ns1", "FW1", myNamespace);
            writer.WriteElementString("ns1", "MANDT", myNamespace, "100");
            writer.WriteEndElement();
    As you can see, the problem is ns1:FW1. How to fix it?
    Thank you very much!
    Regards,
    spadmin

    Hi,
    solved with:
    String xpath = "/my:xxx/my:gruppe1/my:gruppe2[last()]";
    XPathNavigator oldGroup = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
    XPathNavigator newGroup = oldGroup.Clone();
    oldGroup.InsertBefore(newGroup);
    Regards

  • How to create XML element with out creating a document

    I ve been looking for hours for a method to create an XML element without the need for the Document. I am trying to create objects that access the database, and I need in each of these objects a method that returns only an element (ie. getXMLData()). And in the class that created these object, I nee to call the getXML() methods and construct a document. However, I am not looking to create the document if I am not going to use it. In the component class I need to be able to traverse the xml element and read and modify the values. Is there a way to do so with sun's JDK ?

    I ve been looking for hours for a method to create an
    XML element without the need for the Document.
    ... I am not looking to create the document if I
    am not going to use it.Hi M-A,
    Though you have been told the solution, let's stick to your original issue, just for the sake of interest. I gather what you have in mind is finding the answer to the following question: is there a way of creating a document without having to bind it to any data source? The answer is yes. What you might need is the createDocument() method of the DOMImplementation interface which offers lightwight document handling by obviating the need to construct a particular DOM instance. (You could also use the getDOMImplementation() method of the DOMImplementationRegistry interface, but it has bugs.) Here's a sample code:DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder parser = factory.newDocumentBuilder();
    DOMImplementation domImpl = parser.getDOMImplementation();
    Document doc = domImpl.createDocument(null, "rootnode", null);The above code produces the following document:<?xml version="1.0" encoding="UTF-8"?>
    <rootnode/>You can make this document even skinnier if you pass null values to all three parameters of the createDocument() method, in which case the document will only contain the prolog. I think both the creation and the structure of this document are simple enough for you to use it as some sort of utility (e.g. by putting the code in a separate class) for creating elements.

  • How to create an element with an ID attribute ?

    Hi,
    first i need to say i searched the web for ~one week now, and couldn't find any good solution.
    Lastly i searched into this forum and, unfortunaly, i couldn't find any good answers to the problem.
    Here are the reference :
    http://forum.java.sun.com/thread.jsp?forum=34&thread=290862 < it's exactly the pb, no answers
    http://forum.java.sun.com/thread.jsp?forum=34&thread=338022 < no answers
    http://forum.java.sun.com/thread.jsp?forum=34&thread=67747 < answer is false
    http://forum.java.sun.com/thread.jsp?forum=34&thread=67683 < same pb, wrong answer
    http://forum.java.sun.com/thread.jsp?forum=34&thread=470003 < a bit far form the initial subject
    so i'll be quick :
    - when you load ur xml DOM, u can use the 'getElementById()' method, and it works very well
    - but when u create a new Element, u can't use the simple 'setAttribute()' method because as said in the doc : "Because the DOM Core is not aware of attribute types, it treats all attribute values as simple strings, even if the DTD or schema declares them as having tokenized types.", therefore, the 'getElementById()' can't work with those newly created Element.
    - same pb arise when u try to modify an ID attribute...
    so, with my investigation, i found that u need to specify to the DOM that the attribute you just set is an 'ID'.
    and that's where i have problems, i tried creating EntityReference and binding that node to the attribute node, the element node and even to the Textnode but couldn't find anything to work...
    Here is my method (which doesn't work) :
    public void setIdAttribute(Element element,String nameAttribut, String dataAttribut)
                    System.out.println("setIdAttribute() : nameAttribut="+nameAttribut+" dataAtribut="+dataAttribut+" user="+element.toString()); //DEBUG
                    Attr attributRef = document.createAttribute(nameAttribut);
                    EntityReference er = document.createEntityReference(nameAttribut); //creating an Reference for the attribute named 'nameAttribut'
                    Text data = document.createTextNode(dataAttribut);
                    //link to the main DOM tree
                    attributRef.appendChild(data); //adding the String data
                    attributRef.appendChild(er); //...then telling DOM that the attribute 'nameAttribut' is an ID
                    //at last linking the attribute node
                    element.setAttributeNode(attributRef);
            }I'm totally lost :/ (help !)
    AciD

    After thinking about it some more, I find that adding a setIdAttribute() method in a DOM level 3 conformant way while at the same time keeping it independent of a particular DOM implementation would take quite some effort. It's easier to add similar functionality into a Document wrapper along these lines:
    public class MyDocument implements Document {
       private Document _doc;
       private Map _eltsById = new TreeMap();
       public MyDocument(Document doc){
          _doc = doc;
       public Element getElementById(String id){
          Element foundElt = _doc.getElementById(id);
          if (foundElt == null)
             foundElt = (Element)_eltsById.get(id);
          return foundElt;
       public void setIdAttribute(String attrName, Element elt){
          String attrValue = elt.getAttribute(attrName);
          if (attrValue != null)
               _eltsById.put(attrValue, elt);
       //...implement all the other Document methods by forwarding to _doc
    test(){
       MyDocument myDoc = new MyDocument(parse(...));
       Element elt = myDoc.createElement(...);
       elt.setAttribute("id", "123");
       myDoc.getDocumentElement().appendChild(elt);
       myDoc.setIdAttribute("id", elt);
       Element foundElt = myDoc.getElementById("123");
       assert elt == foundElt;
    }Unfortunately this simple implementation breaks down if an ID attribute value is later changed, so this is probably a rather dirty hack.
    Some DOM implementations allow you to search for nodes using implementation specific methods or XPath. Oracle's XML does it like this:
    XMLDocument doc = parse(...);
    Element elt = (Element)doc.selectSingleNode("//*[@id='123']");
    Or like this with Xalan:
    CachedXPathAPI xpath = new CachedXPathAPI();
    Element elt = (Element)xpath.selectSingleNode(doc, "//*[@id='123']");
    The XPath based ways of searching for nodes have the benefit of not being dependent on schema validation in the first place (as the ID based mechanisms are). And of course you have many more search options than just attribute values. On the other hand XPath evaluation is hugely slower than most getElementById implementations if it doesn't use some kind of index. So if you want fast (that is index based) XPath queries for in memory XML data, you should probably look at something like XQEngine http://xqengine.sourceforge.net/
    -Alexander

Maybe you are looking for

  • Open and close period

    hi all,          i want the details about opening a period and closing a period, can we post a document which is in previous in previous period... cheers Amith

  • Error while updating Agent to run scheduler.

    Hi, Source: MS SQL Target: Oracle I am new to ODI and I want to know how to setup ODI agent to run particular scheduler. I have created agent at topology-->Physical Architecture--> Agent and assign the respective logical agent in topology-->Logical A

  • Account determination - exchange rate and valuation

    Hello All, we have a problem concerning our account determination for differences in exchange rate and valuation. When clearing open vendor items in foreign currency, a percentage of the difference goes to our exchange rate difference account (correc

  • Can't get on the internet

    I have a very old IBM Thinkpad. My device manager shows no connection to the internet. I don't know what o do. I have a usb to my wireless network, but even with a wire to my router. Anyone help?

  • ACCESS TO BUSINESS SYSTEM ACCESSOR FAILED

    Hi,          We have recently added a new server in our SLD, So, for that I have asked the Basis team to create a new technical system, Business system ....its been created in SLD but when I try to assign(assign new business system) it in Integration