Question about well formatted xml

Does anyone know how to make a xml stream to be well formatted?
For example, if I got a String like:
String a = "<person><name>Jack</name><age>16</age></person>";
And I need to convert it to be well formatted like
<person>
<name>Jack</name>
<age>16</age>
</person>
Any idea?
Thanks

AllenZhao wrote:
Does anyone know how to make a xml stream to be well formatted? "well formatted"? You're confusing this with "well formed".
For example, if I got a String like:
String a = "<person><name>Jack</name><age>16</age></person>";
And I need to convert it to be well formatted like
<person>
<name>Jack</name>
<age>16</age>
</person>
Any idea?
ThanksYeah, get something that will "pretty print" the XML for you. I believe JDOM can do it out of the box.
%

Similar Messages

  • How to convert well format xml in coldfusion?

    Hi,
    I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.
    Please suggest me how to convert to well format xml.
    Advance Thanks,

    chandra12345 wrote:
    I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.
    Please suggest me how to convert to well format xml.
    Technically speaking, a piece of text must be well-formed before it can be called an XML document. So you cannot yet say the returned text is XML.
    The first thing to do is to check whether it is. Use, for example, isXml(someString) to check whether someString is well-formed XML.
    There is no one standard way to convert text to well-formed XML. This is because there are infinitely many ways in which text can fail to be well-formed. The easiest solution for you will be to learn the rules for well-formed XML.
    Any elementary book on XML will teach you that. If you find books old-fashioned, then you could instead google well-formed xml .

  • Question about the format of an external drive.....

    Ok quick question...
    my external is formatted mac OS extended journaled. I need to create a new partition in FAT so that it can be read when I use bootcamp. However when I use disk utility to create a partition it says it would have to format the whole harddrive and I'd lose what is currently on there..
    Is there anyway that I can do this without losing what I currently have on there?
    I only need to have about 50 gigs read/writeable in windows running on bootcamp.

    You might want to try out MacDrive, which will allow Mac OS formatted drives to be read from and written to in Windows. That could save you having to repartition your external drive completely. There's a five-day free trial available so you could try it out first.
    Intel Mini 1.66 GHz, Mac Pro 2.66 GHz   Mac OS X (10.4.8)  
    Vista and XP running under Parallels

  • Integration strategies - Questions about using IDOC XML?

    Hello. First time poster here.  I am looking for some information for a project for a client and I am hoping someone can give me a pointer to where to start.
    I need to connect my clients SAP system to an XML based software package.  I have heard about IDOC XML and I hope I can use this technology to do the following:
    1. Extract PO's from SAP
    2. Insert PO changes to SAP (Price, Delivery, Quantity, etc.)
    3. Extract RFQ information from SAP
    4. Insert vendor quotations for those RFQ's
    Are there existing IDOC XML document types for these transactions?
    Does SAP have a tool that generates the IDOC XML and makes the data available as a disk file?
    Does SAP have a tool that can read an IDOC XML from a disk file and submit it for insertion into SAP?
    Would I need to do any programming on the SAP side to accept the data into SAP or are there, for instance, specific IDOC XML documents for uploading changes to existing PO's?
    Is there documentation avaialble that will answer these kinds of questions?
    Thank you in advance
    David Kuehner

    >
    dkuehner wrote:
    > Hello. First time poster here.  I am looking for some information for a project for a client and I am hoping someone can give me a pointer to where to start.
    >
    > I need to connect my clients SAP system to an XML based software package.  I have heard about IDOC XML and I hope I can use this technology to do the following:
    >
    > 1. Extract PO's from SAP
    > 2. Insert PO changes to SAP (Price, Delivery, Quantity, etc.)
    > 3. Extract RFQ information from SAP
    > 4. Insert vendor quotations for those RFQ's
    >
    > Are there existing IDOC XML document types for these transactions?
    > Does SAP have a tool that generates the IDOC XML and makes the data available as a disk file?
    > Does SAP have a tool that can read an IDOC XML from a disk file and submit it for insertion into SAP?
    > Would I need to do any programming on the SAP side to accept the data into SAP or are there, for instance, specific IDOC XML documents for uploading changes to existing PO's?
    >
    > Is there documentation avaialble that will answer these kinds of questions?
    >
    > Thank you in advance
    >
    > David Kuehner
    You can use XML port for IDOC xml output to file disk or XML-HTTP port to send and receive message through HTTP protocol.
    Search for SAP Help ALE

  • Question about final format for integrated film clips and moving images in webpages created by Muse

    About a year ago I gave up even trying to construct websites. There were too many new factors and technical aspects of correct scripts and coding to make it interesting for a designer with no interest in programming. It´s understandable that all new gadgets such as mobile surf panels, mobile internet on different cell phones, lap tops and stationary computers and a lot of different browsers made it impossible to run with just plain html. But when I found out that many viewers couldn´t even watch Flash movies or solutions with flash components I said enough is enough.
    Now a while ago when HTML5 was released I heard that it made it possible to create films and almost identical content as with Flash films without using them. Bought some templates and realized that it really worked. So here are my questions:
    What format does Adobe Muse CC use when I add films and stuff into it, and what format will come out of it when it´s an official website?
    Do Adobe Muse CC convert film formats so they will be visualized correctly on the end viewers browser, computer or phone?
    Will Adobe Muse CC advice me of what film or animation format will be the best for my viewers on the web or on a mobile internet?
    Are there any guidelines available for how I shall save and export filmclips or animations before they are imported into Adobe Muse CC?
    Regards
    Jack

    Hello Jack,
    Currently, you can only import an swf file or you can embed videos from youtube, vimeo etc. into Muse / add HTML5 Video to Your Website.
    Take a look at these simple videos that explain the currently available processes for adding videos in Muse, in a step by step method:
    1. http://tv.adobe.com/watch/learn-adobe-muse-cc/inserting-a-youtube-flic kr-or-hulu-video/
    2. http://www.youtube.com/watch?v=5in4swnIFsw
    3. http://www.youtube.com/watch?v=KnBFLQheOk4
    Hope this helps.
    Cheers
    Parikshit

  • A few questions about using an XML file to add text into a TextArea component set as html

    I'm using AS2 in Flash CS3.
    I have a TextArea component in the stage that's loading its text from an XML and I've been able to use the ul and li tags to create lists. However, when I try to include a nested list it just inserts a line break between the nested list and the main list rather than indent it further. Is there a solution for this issue?
    Failing that, how would I be able to add non-breaking spaces into the XML so they will render inside the TextArea component? I've tried   and &#160; without success. I scoured the net for some help with this and found some information about modifying the font embedding xml file with a new entry for the non-breaking space and that didn't work either, so that leaves me somewhat stumped.

    flash doesn't handle nested lists (as you now know).  you can work-around that limitation using css and creating your own indent styles.  css have a marginLeft property you can use.

  • Question about 3D and XML

    Hallo,
    I want to embed in a custom java Application, 3D visualizations that represents some data stored in xml form.
    Does any body knows if there is any existing opensource (java) API that uses XML to produce 3D visual graphs(any, ex. 3D balls,...)?
    Thanks

    I'm trying to put the data I get from the javabean into a file and read this file in the program I create the xml format. But I get an ClassCastException on the javabean class.
    Please help!!!*********Its URGENT***************

  • Question about javabeans and xml !!!

    Hi all,
    I created a java bean in which I will read data from the database and create a table of that data. Now I need to transform this data into xml format. Please can anyone give me some idea how to transform it.
    Thanks a lot.
    Jahnavi.

    I'm trying to put the data I get from the javabean into a file and read this file in the program I create the xml format. But I get an ClassCastException on the javabean class.
    Please help!!!*********Its URGENT***************

  • Question about  Java and XML  rendering for Word 97 upwards.

    Without using the apache POI library, and by sticking to non-pay products,
    is it possible to use java or XSLT/XML to turn
    an xml formatted file into a
    Microsoft Word/Excell/PDF file within one framework?

    Look into Apache FOP. But be warned: it will most likely use POI to do any excel conversions. That's how (sane) software development works: you don't reinvent the wheel, you effectively reuse what is already there.

  • Generic question about generating & saving XML

    I need to write a process that will generate an invoice as XML, then store this entire XML document in a CLOB. I will have multiple stored functions and/or procedures that build various sections of the invoice. The process needs to be flexible enough to allow new functions to be added and old ones removed at any time with little impact.
    My question is, what is the best way to implement this? Is it possible to use XSQL pages and use the <xsql:ref-cursor-function> to retrieve each function's data then insert this in a table after applying a style-sheet? I need something that is fairly efficient. Also, it needs to be compatible with an 8.1.6 database. I'm fairly new to all this Oracle XML stuff, so any additional pointers would be appreciated. Thanks.
    Shane

    one solution i can think of is to use SQLX operator instead of dbms_xmlgen.
    here is a sample example.
    declare
      l_xmltype xmltype;
      l_deptno  emp.deptno%type;
    begin
      for i in (select * from emp order by deptno)
      loop
        select xmlconcat(
                    xmlelement("ename", i.ename)
                   ,xmlelement("sal", i.sal)
                   ,xmlelement("detpno", i.deptno))
          into l_xmltype from dual;
        dbms_output.put_line(l_xmltype.GetClobVal());
      end loop;
    end;
    /Now here you can open the query once, keep writing to the file till the deptno
    is same, when the deptno changes, close the file and open a new file with new
    deptno and start writing.
    Note : in this way you will have to add the xmlprolog manually to each of the file which should not be an issue. after opening the file add the prolog string manually.
    Hope this helps.

  • Question about AMF format archives

    Hi everybody.
    I need help with archives with format amf. My Knowledge on
    the subject is too poor and I would like more about it. How could I
    create this kind of archives and it is posible convert the archives
    in to a txt archives??
    Please any help... Really appreciate it.

    Hello Jack,
    Currently, you can only import an swf file or you can embed videos from youtube, vimeo etc. into Muse / add HTML5 Video to Your Website.
    Take a look at these simple videos that explain the currently available processes for adding videos in Muse, in a step by step method:
    1. http://tv.adobe.com/watch/learn-adobe-muse-cc/inserting-a-youtube-flic kr-or-hulu-video/
    2. http://www.youtube.com/watch?v=5in4swnIFsw
    3. http://www.youtube.com/watch?v=KnBFLQheOk4
    Hope this helps.
    Cheers
    Parikshit

  • A Question about Date Format

    Hi All!,
    I need to store date in the form " MM/dd/yyyy HH:mm:ss a " .
    I tried DateFormat, SimpleDateFormat, and Calendar classes but could not achieve that format.
    Can any one suggest how to store date in the above said format?
    Thanking You in advance,
    MJ

    Hi All!,
    I need to store date in the form " MM/dd/yyyy
    HH:mm:ss a " .
    tried DateFormat, SimpleDateFormat, and Calendar
    classes but could not achieve that format.
    Can any one suggest how to store date in the above
    said format?
    Thanking You in advance,
    JStore where? Are we talking about a database? You should in that case let the driver handle the conversion and use a PreparedStatement.
    Kaj

  • Question about struts-config.xml

    Hi,
    In the struts-config.xml,
    What is the difference about "redirect="true" and redirect="false" ?
    thanks,
    happybaobao

    Hello,
    redirect = truemeans that the ActionForward () statement in your execute method of the Action class will perform a response.sendRedirect. You can see that the URL is getting altered in the clients browser
    redirect = false means the vice-versa.
    I would recommend that you go through the Struts official site and see the DTD specifications in the URL
    http://struts.apache.org/dtds/struts-config_1_2.dtd
    for more details.
    Thanks and regards,
    Pazhanikanthan. P

  • Question about creating multiple XML files from same query

    I have a query like this:
    select * from emp;
    ename empno deptno
    Scott 10001 10
    Tiger 10002 10
    Hanson 10003 20
    Jason 10004 30
    I need to create multiple output files in xml format for each dept
    example:
    emp_dept_10.xml
    emp_dept_20.xml
    emp_dept_30.xml
    each file will have the information for employees in different departmemts.
    We are using DBMS_XMLGEN package to generate XML.
    The reason I need to do this is to avoid executing the same query 200 times for generating the same output for different departments. Please let me know if it is practically possible to do this.
    Any input is greatly appreciated.
    Thanks a lot!!

    one solution i can think of is to use SQLX operator instead of dbms_xmlgen.
    here is a sample example.
    declare
      l_xmltype xmltype;
      l_deptno  emp.deptno%type;
    begin
      for i in (select * from emp order by deptno)
      loop
        select xmlconcat(
                    xmlelement("ename", i.ename)
                   ,xmlelement("sal", i.sal)
                   ,xmlelement("detpno", i.deptno))
          into l_xmltype from dual;
        dbms_output.put_line(l_xmltype.GetClobVal());
      end loop;
    end;
    /Now here you can open the query once, keep writing to the file till the deptno
    is same, when the deptno changes, close the file and open a new file with new
    deptno and start writing.
    Note : in this way you will have to add the xmlprolog manually to each of the file which should not be an issue. after opening the file add the prolog string manually.
    Hope this helps.

  • Question about video formats

    Can Macs run .avi or .wmv files? I plan on getting a Mac soon and this is a huge part of what I am putting into consideration. All of my animations are .avi and .wmv files.

    AVI is not a format (codec) at all . It, like Quicktime, is a container with a codec in it. Some play, some don't. You will find a lot of AVI with XVid and DivX for example.
    Flip4mac (free) plays back most recent Windows Media, e.g. 8 and 9. Perian (free) plays a LOT of files you will find from the interweb which means Windows users made them.
    You can also run Windoze on a mac so that mean you can have WMP from MS as well.

Maybe you are looking for

  • Contacts only sync partly from McBook to the iPad.

    My Adress Book on the iMac is complet. But after the sync to the iPad via iCloud there are missing adresses on the iPad. Can anyone tell me how to sove this problem?

  • Query on time field.

    Hi, I have a column "Date1" in a table. On the form I define it as Datetime datatye. I have the format mask of 'HH24:MI' on that column. Iam not able to query on that field. Tried adding the foll. code ' AND TO_CHAR(MY_TABLE.MY_TIME, ''HH24:MI'') = T

  • HT5661 How to transfer iPad with downloaded apps to another person?

    Hi, Could you please advise how do I transfer my iPad2 with many downloaded apps to my son, i.e. re-register the iPad2 with my son's own Apple Id so that he could sync his iPhone stuff with iPad2?  I don't need the iPad2 anymore but would like him to

  • I can't get started

    Hello I purchased an Airport Express to play iTunes on my home stereo. When I plug it in it will not connect and always blinks amber. I have a Linksys 2.4 GHz wireless router model # WRT54G. My iPod touch has no problems getting web info from the rou

  • ITunes sharing problem

    I use iTunes 7.6 on my iMac and macbook and after updating to this latest version of iTunes have not been able to share my iMac iTunes library using my macbook. Every time I tried a message that says "The Shared Library ... is not responding (-3259).