Converting XML data string in to file object to parse

Hi
I have XML in the form of String .. i just want to convert this string in to a file to parse.. how can i do that ..<p>
Here is my xml string<p>
String str = "<?xml version="1.0"?>
<!DOCTYPE some SYSTEM "some.dtd">
<firsttag>
     <childtag>
          <name>some name</name>
          <age>age</age>
     </childtag>
</firsttag>";<p>
if u have code that would be great
Thanks in advance

Hi
I have XML in the form of String .. i just want to
convert this string in to a file to parse.. how can i
do that ..<p>
Why not to use RandomAccessFile to write string to file(you need to do this? is i'm right?)

Similar Messages

  • Need to have  'variable name' node in the converted XML data.

    i am converting the abap data to xml using cl_xml_document. in the converted xml data, i need to have one more node. in the below example, i want a node  <variable name="productionOrderDetails"> to come after the Data node.
    ?xml version="1.0"?>
    <Data>
         <item>
              <DISPO>100</DISPO>
              <PLNBEZ>F126</PLNBEZ>
              <GAMNG>300.000</GAMNG>
              <ERFMG>285.000</ERFMG>
              <PRE_PROD>100.000</PRE_PROD>
              <PRE_BLOG>0.000</PRE_BLOG>
              <BLOG_MTD>144.000</BLOG_MTD>
              <BAL_PLAN>144.000</BAL_PLAN>
         </item>
    </Data>
    thanks in advance

    Hi ,
    you can use class  IF_IXML_NODE, first you need to read (go thru ) XML then need to Insert a New Node.
    ref SAP Program BCCIIXMLT1/BCCIIXMLT*
    regards
    Prabhu

  • Converting any date string to GMT standard

    Hi All,
    I want to convert any date string to GMT standard.
    The date string may be like this.
    "Sat Sep 15 14:23:40 IST 2001"
    I have tried to change my defaultTimeZone .
    But I don't know why it's not working.
    Is there something to do with Locals?
    Can anyone please tell me the way to
    accomplish that ?
    Thanks in advance.
    Sujoy

    Java stores all the dates in GMT Format , considering the machines TimeZone Setting ....and also i guess date has methods like toGMTString() and toLocaleString() . To convert the date to GMT i guess u can just say toGMTString() of the date . If u have the stringified version of date
    just make a new Date(String) and then calling toGMTString of it .

  • Want help in converting XML Document to a postscript file

    I want to convert XML Document to a postscript file in Java, not from command line. Any help is appreciated.

    well, you first need an XML parser, which is easy to implement
    then you need to either write the postscript out bit by bit or use a Java API that writes PostScript for you.
    It's really simple, the trick is HOW you decide to write out the PS

  • Convert XML data to byte array...

    Hello All,
    In my application, i have an XML file and the corresponding XSD file. This XML file is having some date, which i want to convert into an byte[] and then save it in a file. 
    How i can convert the XML data in the byte[]? Here as an example of the xml file and the byte[] data which i want to save in a file.
    <?xml version="1.0" encoding="utf-8"?>
    <HeadersInfo>
    <header>
    <id>0</id>
    <Name>H1</Name>
    </header>
    <header>
    <id>1</id>
    <Name>H2</Name>
    </header>
    </HeasersInfo>
    In the above example 'id' field is of type 'uint' and 'name' field is of type 'string' with max length of '5'. So in this case my byte array should be as shown below:
    00 00 00 01 48 31 00 00 00
    00 00 00 02 48 32 00 00 00
    Here underlines values are for the 'id' parameter where as values in bold are for 'Name' parameter for all the header values in sequence. Name parameter is null (0x00) padded.
    Thanks in advance,
    IamHuM

    Hi,
    the following example extract the id, name values using LINQ To Xml and writes it to a memory stream using a binary writer and returns the result as a byte array:
    internal static byte[] GetXmlAsByteArray()
    var document = XDocument.Parse("<HeadersInfo>"
    + " <header><id>1</id><Name>H1</Name></header>"
    + " <header><id>2</id><Name>H2</Name></header>"
    // additional testing
    + " <header><id>32767</id><Name>H1234</Name></header>"
    + " <header><id>305419896</id><Name>H56789</Name></header>"
    + "</HeadersInfo>");
    const int NameLength = 5; // Max length for a name
    byte[] zeroBytes = new byte[NameLength]; // Helper to fill name
    using (var ms = new MemoryStream())
    using (var writer = new BinaryWriter(ms))
    // write each header
    foreach (var header in document.Root.Elements("header"))
    int id = (int)header.Element("id");
    string name = (string)header.Element("Name");
    byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes(name);
    Console.WriteLine("id: {0}, Name: {1}", id, name);
    // Write id
    writer.Write(GetUIntBytes((uint)id));
    // Write name NameLength (5) max, otherwise padded
    if (nameBytes.Length > NameLength)
    writer.Write(nameBytes, 0, NameLength);
    else
    writer.Write(nameBytes, 0, nameBytes.Length);
    if (nameBytes.Length < NameLength)
    writer.Write(zeroBytes, 0, NameLength - nameBytes.Length);
    byte[] result = ms.ToArray();
    // dump array
    foreach (var value in result)
    Console.Write("{0:X2} ", value);
    Console.WriteLine();
    return result;
    public static byte[] GetUIntBytes(uint value)
    if (BitConverter.IsLittleEndian)
    // swap bytes
    value = ((value & 0x00ff) << 24)
    | ((value & 0xff00) << 8)
    | ((value & 0x00ff0000) >> 8)
    | ((value & 0xff000000) >> 24);
    return BitConverter.GetBytes(value);
    For a general purpose solution you should create a class and split the example into separate methods to extract the data and write the values (integers, strings).
    Regards, Elmar

  • How To Convert XML into String?

    Hi,
    I have a requirement in which I need to convert the data from XML file to string.
    E.g.
       <Drawing>
          <DrawingSpecification>
             <Header>
                <SoldTo>SDN</SoldTo>
                <SoldToName>SAP</SoldToName>
                <Date/>
                <Manager>CEO</Manager>
                < Plant>INDIA</Name>
                <Items>
                   <Item>
                       < MaterialNumber>MatNum12</ MaterialNumber>
                       <ProductNumber>ProName12</ ProductNumber>
                   </Item>
               </Items>
               < ClientId>ClientID123</ ClientId>
               <FileName>FileName123</FileName>
               <Type/>
               < TemplateName/>
          </DrawingSpecification>
          <Image contentType=""/>
       < /Drawing>
    Output should be like:
       < File>
          < Content> SDN SAP CEO INDIA MatNum12 ProName12 ClientID123 FileName123</Content>
       < /File>
    Please provide solution for the same.
    Thanks,
    Abhishek.

    what about something like this
    package test;
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class Test {
         public static void main(String args[]) throws Exception {
              DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
              DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
              Document doc = docBuilder.parse(new File("test.xml"));
              StringBuffer buffer = new StringBuffer();
              appendChildren(buffer, doc.getChildNodes());
              System.out.println(buffer.toString());
         private static void appendChildren(StringBuffer buffer, NodeList list) {
              for (int i = 0; i < list.getLength(); i++) {
                   Node node = list.item(i);
                   if (node.getNodeValue() != null) {
                        if (node.getNodeValue().trim().length() > 0) {
                             buffer.append(node.getNodeValue()).append("|");
                   appendChildren(buffer, node.getChildNodes());
    ...btw: IMHO the use of this forum is to get an answer to an particular question - not to ask for complete solutions - create the solution yourself an ask if you are stuck somewhere (with a bit of research (google) it is not hard to find a solution for your problem)
    regards franz
    ...close thread if question is answered

  • Is there a tool to convert XML data model into berkeleydb automatically?

    Hi all,
    Is there already a tool which convert a xml data model definition file into C++ source code with berkeleydb as underlying db implementation?
    If there is already one, I don't need to spend the time to code it.
    Regards,
    -Bruce

    Hello,
    One suggestion is to take a look at the Berkeley DB XML documentation at:
    http://docs.oracle.com/cd/E17276_01/html/toc.htm
    and see if you find what you are looking for.
    Thanks,
    Sandra

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • Converting XML to String in OSB

    Hi All,
    Is there any function (apart from fn-bea:serialize function) for converting XML payload to a String in OSB. Please let me know.
    Thanks,
    Bpeltechie

    That's how it's worded by W3C
    http://www.w3.org/TR/REC-xml/#syntax
    The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment,
    a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the
    strings " &amp; " and " & lt; " respectively. The right angle bracket (>) may be represented using the string " & gt; ", and must, for compatibility, be
    escaped using either " & gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end
    of a CDATA section.Note that it says left angle bracket must not appear in their literal form, but the right angle bracket may be represented using the string " &amp;gt; "
    Cheers,
    Vlad

  • Read/get xml data (string)

    Hi
    I have a XML string that I get from a TCP transfer, I have attached a received string.
    I have no experience in reading XML data, I have tried looking in the forums and some of the examples in LV, but I cannot get it to work, so I hope that someone could help me out. All I need to get from the XML data are the names e.g. Station1 and Station2 perhaps putted into a string array. If so it wouldn't hurt to get all the rest parameters and attributes as well. I thought about doing some string searches to get what I need, but thought again that it might be easier/better in some way to take advantage of the data being arranged as XML.
    Hope that someone can help.
    Thanks in advance
    Best regards
    Simon
    LabVIEW 8.6 / 2009 / 2010
    Vision Development Module 8.6 / 2009 / 2010
    VBAI 3.6 / 2010
    Attachments:
    testmap.txt ‏1 KB

    Hi all
    falkpl wrote:
    The easy way is if you know that this string is not changing much you treat it as a formated string and parse it using simple string functuions
    ie first parse %s and %s The two slashes will cancle the escape clause of the string parser.  Repete this process to get each station and attributes.
    The harder way is to use an activeX or .net XML parser.
    Paul
    I am not sure what you mean about the parser, well I get the concept, but is there a specific string function that can do that for me?
    I got something working with the Match Pattern vi, please the attached. This actually works for my current needs, but I still would be able to get data from more complex XML data.
    Hi A.K. and J.K.
    Thank you for the link.
    EasyXML looks like a nice and handy tool for handling XML data. I ran in too some problems though when running the VI Package Manger. When I check the network for new packages it says that there was an error, please check the network connection or settings. I have internet connection (I am writing this post ) and I am not using a proxy server. What could be wrong and how do I install EasyXML then, is there another way?
    Best regards
    Simon
    LabVIEW 8.6 / 2009 / 2010
    Vision Development Module 8.6 / 2009 / 2010
    VBAI 3.6 / 2010
    Attachments:
    my_get_xml_data.vi ‏15 KB

  • Converting xml data in to comma separated values in bpel

    Is there a way to covert generic xml data to comma separated value in BPEL? i have tried using createDelimitedString but no luck.
    Please guide me on this issue.
    Thanks!
    Shan
    Edited by: 876372 on Aug 3, 2011 6:58 AM

    Hi,
    Have a luk at the below link it has many examples:
    http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/nfb.htm

  • Can LabVIEW convert XML data in Excel

    I am using XML files to store the data regarding my work. Now I have to display the data to the end user as a preview of the data. it could be in any readable format like HTML,MS-Excel or MS-Word.
    Can any one tell me how to convert the XML file in above format

    Hi,
    Inorder to convert a XML file to HTML you need to write an XSL script (EXtensible Style sheet Language).  This script parses the XML file with a particular schema and shows the XML file in a browser.
    Just open the XML file in Excel (2003 or above).  It automatically parses the XML schema type and provides it as worksheet!
    With regards,
    JK
    (Certified LabVIEW Developer)
    Give Kudos for Good Answers, and Mark it a solution if your problem is solved.

  • Extracting XML Data to a flat file

    I have an application which is puting an XML string into a field in the database... now my problem is that I have to extract that information and put it in either 1. a flat file, or 2. a seperate table containing a column for each XML attribute... Does anyone know of the best way to approach either solution?
    cheers.

    And your Oracle version is?
    There are many different ways to put something into a file. How about UTL_FILE?http://www.psoug.org/reference/utl_file.html
    How to get it out of the table in the first place?
    I usually try a SELECT statement. They seem to work.
    PS: Databases don't have fields ... table's don't either. Check your verbiage.
    Try looking of the word "FIELD" in the Oracle docs. Then try "COLUMN."

  • How can I convert output data (string?) from GPIB-read to an 1D array?

    Hello all,
    I am reading a displayed waveform from my Tektronix Oscilloscope (TDS3032) via the GPIB Read VI. The format of the waveform data is: positive integer data-point representation with the most significant byte transferred first (2 bytes per data point).
    The output data of GPIB-Read looks like a string(?) where the integer numbers and a sign like the euro-currency sign are seperated by spaces e.g. #5200004C3 4 4 4 4 3C3C3........ (C represents the euro-currency sign).
    How can I convert this waveform data into a 1D/2D array of real double floatingpoint numbers (DBL) so I can handle the waveform data for data-analysis?
    It would be very nice if someone know the solution for this.
    t
    hanks

    Hi,
    First of all, I'm assuming you are using LabVIEW.
    The first you need to do is parse the string returned by the instrument. In this case you need to search for the known symbols in the string (like the euro sign) and chop the string to get the numeric strings. Here are some examples on parsing from www.ni.com:
    Keyword Search: parsing
    Once you parse the numeric strings you can use the "String/number conversion VIs" in the String pallette.
    Hope this helps.
    DiegoF.Message Edited by Molly K on 02-18-2005 11:01 PM

  • Unable to see XML data in the zip file

    Hi folks,
    Willing to think about a way to automate the setup migration, I'm looking at the iSetup functionnalities in 11i.
    Technically speaking, we upgraded iSetup to 11i.AZ.H.delta.2.
    I did a simple extract of an FNDLOAD API (flex values) , everything works fine. At the end I got a zip file which contains several files including the ldt file containing my data.
    Having done this, I wanted to test an XML API (chart of accounts, GL currencies), both completed without errors but when looking at the zip file, no xml file containing my data exists !
    I'm quite sure that it exists because I can report on those data.
    is this a bug ?
    Thanks for your answer.
    Franck James

    Franck:
    This could be an issue with the zip tool you are using. You can ignore this as long as you can load and report on the given extract.
    Thanks,
    Lokesh

Maybe you are looking for

  • Tr  SQVI  RESULTING IN ERROR MESSAGE.

    Tr   SQVI   is executed and table join selected and enter ,  it gives the following error (  The current application triggered  a termination with a short dump   ). what is the solution , pl let know.

  • JMS using JBoss !!!

    Hey, ich just have a problem realizing jms over the jboss server. Actually, if you want to implement a JMS-Producer or JMS-Consumer you need to define a �*-servie.xml� file which hast to be copied in the deployed directory of the server and it has to

  • Is it possible to write a Java program to turn off the computer

    Is it possible to write a Java program to turn off the computer

  • Windows XP mode Freeze

    Hello,       I installed VS 2008 within Windows XP Mode running under Win 7. The installation successfully completed. I closed the final window. After that, when I click on anything there is no response. As if the whole XP mode windows is like a pict

  • Iweb doesn't recognize saves site

    I was working on two separate projects. When I wanted to work on one i would close iweb. Go to iweb folder, remove it! and drag in other site. This has been working for months, and than suddenly when dragged a copy over it didn't recognize the pr exi