Need suggestion on JAXP DOM

My tool is JAXP DOM. My idea is this: to realize XML file transfer between
two sockets. I finished several step so far at the sender side:
1. use DocumentBuilder to generate a new Document.
2. insert a root Element into the Document.
3. add new nodes into the root Element.
My question is how to do:
4. how to convert the Document type into OutputStream so I can send it out
using the socket. Maybe I should convert the Document into byte[] first or
something else, but how?
Thank you very much.

Thanks dude. Do you think I can do in this way:
TransformerFactory xformFactory = TransformerFactory.newInstance();
Transformer transformer = xformFactory.newTransformer();
DOMSource input = new DOMSource(myDocToSendOnSocket.getDocumentElement());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult output = new StreamResult(baos);
transformer.transform(input, output);
SSLSocket socket = (SSLSocket) SocketFactory.createSocket (address, port);
OutputStream out = new socket.getOutputStream();
out.write (baos.toByteArray());
out.flush();
out.close();
socket.close();
If the code is right, my question is: can I use baos.toByteArry(); directly? I mean baos is just one parameter in output's constructor. Does its value change after transform is called? Thank you.

Similar Messages

  • Need XML (JAXP DOM) creating/parsing sample coding

    Where to find some sample code of XML document creating and parsing with JAXP DOM? Thanks.

    Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("c:/myfile.xml");

  • Need suggestion on Multi currency and Unicode character set use in ABAP

    Hi All,
    Need suggestion. In one of the requirement I saw 'multi-currency and Unicode character set experience in FICO'.
    Can you please elaborate me how ABAPers are invlolved in multi currency as I think this is FICO fuctional area.
    And also what is Unicode character set exp.? Please give me some document of you have any.
    Thanks
    Sreedevi
    Moderator message - This isn't the place to prepare for interviews - thread locked
    Edited by: Rob Burbank on Sep 17, 2009 4:45 PM

    Use the default parser.
    By default, WebLogic Server is configured to use the default parser and transformer to parse and transform XML documents. The default parser and transformer are those included in the JDK 5.0.
    The built-in WebLogic Server DOM factory implementation class is com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.
    The DocumentBuilderFactory.newInstance method returns the built-in parser.
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

  • JAXP DOM - I can get children fine, just not nested children!

    Hi,
    I have a problem with JAXP dom. I cannot get the nested children associated.
    Here is my code:
    try {
    DOMParser parser = new DOMParser();
    String url = "file:/myxml.xml";
    parser.parse(url);
    Document doc = parser.getDocument();
    //Get the filename
    NodeList FileNameNodeList = doc.getElementsByTagName("filename");
    //Get the duration
    NodeList DurationNodeList = doc.getElementsByTagName("duration");
    //Get the headline
    NodeList HeadLineNodeList = doc.getElementsByTagName("headline");
    //Get the description
    NodeList DescriptionNodeList = doc.getElementsByTagName("description");
    //Get the keywords
    NodeList KeyWordsNodeList = doc.getElementsByTagName("keywords");
    //Get the link order
    //Read all values for every "File Name"
    for(int i=0; i<FileNameNodeList.getLength(); i++){          
    //Get the values
    Node FileNameNode = FileNameNodeList.item(i);
    Node DurationNode = DurationNodeList.item(i);
    Node HeadLineNode = HeadLineNodeList.item(i);
    Node DescriptionNode = DescriptionNodeList.item(i);
    Node KeyWordsNode = KeyWordsNodeList.item(i);
    //File name
    if(FileNameNode.getFirstChild() != null){
    Message += "<br><b>Filename:</b> " + FileNameNode.getFirstChild().getNodeValue();
    //Duration
    if(DurationNode.getFirstChild() != null){
    Message += "<b>Duration:</b> " + DurationNode.getFirstChild().getNodeValue();
    //Head line
    if(HeadLineNode.getFirstChild() != null){
    Message += "<b>Head Line:</b> " + HeadLineNode.getFirstChild().getNodeValue();
    //Description
    if(DescriptionNode.getFirstChild() != null){
    Message += "<b>Description:</b> " + DescriptionNode.getFirstChild().getNodeValue();
    //Key words
    if(KeyWordsNode.getFirstChild() != null){
    Message += "<b>Key Words:</b> " + KeyWordsNode.getFirstChild().getNodeValue();
    //Build the string
    String MessageTemp = Message;
    Message = "<font size=-1>" + MessageTemp + "</font>";
    return Message;
    } catch (Exception ex) {
    System.out.println(ex);
    return Message + ex.toString();
    Here is part of my XML File:
    - <article storyorder="1" pubdate="11/6/02 3:28:27 AM" source="MSNBC Video" topnews="1">
    <filename>vh</filename>
    <duration>00:01:58</duration>
    <headline>MSNBC&#146;s Video Headlines</headline>
    <description>The latest news from MSNBC.com</description>
    <keywords>headlines, news headlines</keywords>
    <photographer />
    <aspect>4:3</aspect>
    - <linkinfo>
    - <link order="1">
    <linkurl>http://www.msnbc.com/news/828323.asp</linkurl>
    <linktext>Republicans win control of Congress</linktext>
    </link>
    - <link order="2">
    <linkurl>http://www.msnbc.com/news/828325.asp</linkurl>
    <linktext>Republicans widen House majority</linktext>
    </link>
    - <link order="3">
    <linkurl>http://www.msnbc.com/news/828326.asp</linkurl>
    <linktext>Democrats retake some statehouses</linktext>
    </link>
    </linkinfo>
    - <categories>
    - <category id="News">
    - <topics>
    <topic>International</topic>
    <topic>US</topic>
    </topics>
    </category>
    </categories>
    </article>
    I can get filename, duration, etc. But I cannot get the multiple link URLs associated with the filename. How can I get that?
    Thanks

    Call getDocumentElement() on the document to obtain the root node. Then call getChildNodes() on the root node to get its children, each individual child can be accessed by looping, as follows :
    // Get the Document object.
    Node node = document.getDocumentElement();
    NodeList childNodes = node.getChildNodes();
    for(int i = 0; i < childNodes.getLength(); i++) {
        Node childNode = childNodes.item(i);
        // Perform some action on the node, or get its children to burrow
        // further down the DOM tree.
    }If you know how many levels you need to go down then you'll need that many nested for loops but recursion is a far more elegant solution.

  • Need Suggestion for Archival of a Table Data

    Hi guys,
    I want to archive one of my large table. the structure of table is as below.
    Daily there will be around 40000 rows inserted into the table.
    Need suggestion for the same. will the partitioning help and on what basis?
    CREATE TABLE IM_JMS_MESSAGES_CLOB_IN
    LOAN_NUMBER VARCHAR2(10 BYTE),
    LOAN_XML CLOB,
    LOAN_UPDATE_DT TIMESTAMP(6),
    JMS_TIMESTAMP TIMESTAMP(6),
    INSERT_DT TIMESTAMP(6)
    TABLESPACE DATA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 1M
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    LOB (LOAN_XML) STORE AS
    ( TABLESPACE DATA
    ENABLE STORAGE IN ROW
    CHUNK 8192
    PCTVERSION 10
    NOCACHE
    STORAGE (
    INITIAL 1M
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOCACHE
    NOPARALLEL;
    do the needful.
    regards,
    Sandeep

    There will not be any updates /deletes on the table.
    I have created a partitioned table with same struture and i am inserting the records from my original table to this partitioned table where i will maintain data for 6 months.
    After loading the data from original table to archived table i will truncating the original table.
    If my original table is partitioned then what about the restoring of the data??? how will restore the data of last month???

  • I want to set up the Time Machine and I would love to use the Time  Capsule but since I already have a wireless router I need suggestions on  what other external disks Apple could recommend to use with the Time Machine and  how to configure that disk

    I want to set up the Time Machine and I would love to use the Time
    Capsule but since I already have a wireless router I need suggestions on
    what other
    external disks Apple could recommend to use with the Time Machine and
    how to configure that disk.
    A complication that I need to resolve is the fact that I am using Vmware
    Fusion to be able to use Windows on my Mac. Now it seems that Time
    Machine is not backing up my files
    on that virtual Windows without additional configuration and my question
    is whether you can advise me here or whether this is only a matter for
    the Fusion virtual machine.

    If you want to use Time Capsule you can.. you simply bridge it and plug it into the existing router.. wireless can be either turned off or used to reinforce the existing wireless.. eg use 5ghz in the TC which is much faster than your 2.4ghz.
    You can also use a NAS.. many brands available but the top brands are synology, qnap and netgear readynas  series. These will all do Time Machine backups although how well always depends on Apple sticking to a standard. There are cheaper ones.. I bought a single disk zyxel which was rebadged and sold through my local supermarket. It actually works very well for TM at least on Snow Leopard. Major changes were made in Lion and again ML so do not instantly think it will work on later versions. I haven't tried it yet with those versions.
    Any external drive can be plugged into the mac. Use the one with the fastest connection or cheapest price according to your budget. USB2 drives are cheap and plentiful. But no where near as fast as USB3 or FW800. So just pick whichever suits the ports on your Mac. Interesting Apple finally moved to USB3 on their latest computers.
    TM should exclude the VM partition file.. it is useless backing it up from Mac OS side.. and will slow TM as it needs to backup that partition everyday for no purpose.. TM cannot see the files inside it to backup just the changes.
    You need to backup windows from windows. Use MSbackup to external drive.. if you have pro or ultimate versions you can backup to network drive. But MSbackup is a dog.. at least until the latest version it cannot restore the partition without first loading windows. There are about a zillion backup software versions for windows.. look up reviews and buy one which works for you. I use a free one Macrium Reflect which does full disk backups and is easy to restore.. to do incremental backups though you have to pay for it.

  • Need suggestion on how to do 3D spinning title animation

    Hello all experts,
    I need suggestion on how to do 3D rotating title animation. Let me explain what i wanted to do.
    The end product is the word WELCOME.
    But I want to animate it in such a way that the alphabelt W first appear as nothing from inside the screen to appear in the screen (that means zoom from small to big, is it called zoom out ?). In the process of zooming out, I want the W to have a thickness & it spins very fast along the horizontal X-axis and stops at the screen with the alphbelt W.
    Then the whole process repeat with E, and I have WE. It then repeats with L and I have WEL. This whole thing repeats until it forms the word WELCOME.
    Any suggestions ? Is there an inbuilt preset for this ?
    If not, if I do from scratch, do I need a separate track for each alphabelt ?
    Thank you very much.
    Cheers.

    Nick Holmes wrote:
    You would have to build this one from scratch, but it's pretty easy.
    Work on the whole word first to get the basic movement, then play with the Timing settings in the Inspector. To have the letters do this one after the other use the Sequence setting. Typically you would set it to the number of letters in your word plus 1 -so your welcome should have a Sequence value of 8. You can of course set it to whatever you think looks best.
    Give it a go and let us know how you get on. Don't forget to save your new effect!
    Thanks Holmes but where do I find the Sequence settings ?
    Thanks

  • Need suggestion in getting data using JDBC

    Hi all need suggestion,
         i had a VO corresponding to database table.
         when i am try to get the records from that table,
         how can i initialize the particular column value to the
         corresponding VO setter method.
         please do the needful.

    Hello inform2csr,
    Your question is not so clear.
    Can you be more precise?
    What is VO?

  • Need suggestion for designing a BEx report

    Hi,
    I need suggestions for designing a BEx report.
    Iu2019ve a DSO with below structure:
    1. Functional Location u2013 Key
    2. Maintenance Plan u2013 Key
    3. Maintenance Item u2013 Key
    4. Call # - Key
    5. Cycle u2013 Data Field
    6. Planned Date u2013 Data Field
    7. Completion Date u2013 Data Field
    This DSO contains data like:
    Functional -
    Plan --- Item -
    Call# --- Cycle -
    Planned Dt -
    Completion Dt
    Location
    11177 -
         134 -
         20 -
         1 -
    T1 -
         02-Jan-2011 -
         10-Jan-2011
    11177 -
         134 -
         20 -
         2 -
    T2 -
         15-Feb-2011 -
    11177 -
         134 -
         20 -
         3 -
    T1 -
         15-Mar-2011 -
    11177 -
         134 -
         20 -
         4 -
    M1 -
         30-Mar-2011 -
    25000 -
         170 -
         145 -
         1 -
    T1 -
         19-Jan-2011 -
         19-Jan-2011
    25000 -
         134 -
         145 -
         2 -
    T2 -
         20-Feb-2011 -
         25-Feb-2011
    25000 -
         134 -
         145 -
         3 -
    T1 -
         14-Mar-2011 -
    Now Iu2019ve to create a report which will be executed at the end of every month and should display the list of Functional Locations whose Cycles were planned in that particular month, along with the last completed Cycle/Date.
    Thus based upon above data, if I execute report at the end of (say) March then report must display:
    Functional ---     Curr. Cycle --- Planned Date --- Prev. completed Cycle --- Prev Completed Date
    Location
    11177 -
         T1 -
         15-Mar-2011 -
    ---     T1 -
    --     10-Jan-2011
    11177 -
         M1 -
         30-Mar-2011 -
    ---     T1 -
    --     10-Jan-2011
    25000 -
         T1 -
         14-Mar-2011 -
    ---     T2 -
    --     25-Feb-2011
    Any idea how can I display Previous Completed Cycle and Completion Date (i.e. the last two columns)?
    Regards,
    Vikrant.

    hi vikrant,
    You can a Cube at the reporting layer  which gets data from DSO and which has these 2 extra characteristics completion date and previous cycle along with other chars and keyfigures from DSO.
    You can populate these  based on your logic in the field routine.
    Hope it helps.
    Regards
    Dev

  • Need Suggestion about Solman support & testing E CATT feature

    Hi Solman Experts .
    I need your Strong suggestion. Actually i am working in  ABAP module , I recently joined as a fresher in small company,  I got opportunity to  go Saudi for  "Solman support & testing ,E CATT"  in big MNC . Now i need suggestion , If i go and work there in these areas , If i return to India  will i get Good Job  and Salary here .
    Please suggest me. please it my career issue.

    hi Gafoor,
    I too had this kind of oppurtunity and now i am in abhudabi in crm and solman testing. No problem in this , So you can go to saudi as your wish and the future and scope for the solman is very good. So it s reasonable to go saudi .
    Regards,
    Prabhushankar

  • Need Suggestion​: buy ThinkPad Edge E540 or wait for Edge E550?

    Hello Everyone,
    I need suggestion what to do: buy ThinkPad Edge E54020C6003AGE (i7 4702MQ & GF 740M 2GB) or wait for Edge E550?
    http://www.notebookcheck.net/Review-Lenovo-ThinkPa​d-Edge-E540-20C6003AGE-Notebook.114194.0.html in Germany is price about 830 Euros
    I use ThinkPads in last 10 years for study and gaming (R60, SL510, Edge 520) and wish sell my Edge E520 replace it with new one due stuck with old Radeon 6630M drivers (I cannot use a new AMD drivers when I try I getting mostly BOSD errors and latest Official Lenovo driver is from 2012) second reason is that E520 fan cannot be accessed & cleaned on easy way.
    In which month Lenovo mostly release new Edges, What is your option are Broadwell CPU + GeForce 840/940M in Edges worth to wait?
    In future I try to avoid AMD GPU due poor drivers support.
    I know that there is much better notebooks for gaming but I like ThinkPads

    To support it the model you're buying should be equiped with the :
    Intel® Dual Band Wireless-N 7260
    Intel® Dual Band Wireless-AC 7260 
    Wireless network adapters and core i5/i7 cpu's . But careful, not all E540s come with the intel wireless card
    Just check this and you're good to go.

  • Need suggestion-abap+bi

    Dear gurus,
    I need suggestion before learning new module. I did ABAP and having good experience. Now I want to update my skill please suggest me wat I should learn. I want to upgrade my skill only in technical side. Few of them suggested me BI but dont know how good it will be in US market.
    Any help will be appreciated.
    Regards
    Dave

    Hi Aasim,
    Even the carrer growth in ABAP is very Good.
    IN BW project, there is requirement of ABAPer. So if you are BW+ABAP, you will be getting paid more. Your value would be more.
    Now, making a shift, even you want to change from ABAP to BW, you need to take some training. Because BW abap is a bit different thatn general ABAP.
    The DW experience is not needed very much.but yes, its better to have knowledge in DW.
    I'll suggest you to work for 6 months in ABAP and then take a training in BW. Because its more BW than ABAP in BW.
    Hope you would have got some idea.
    Please revert for any other questions.
    Thanks..
    Shambhu

  • Need suggestion

    hi....i need suggestion on my problem.i've been given a complete atand-alone java application.my assignment is to make the system,a web-based system so that when we want to make a demo we did not need to bring an installer.just show to from the browser.i thought of using java web start.it's just my opinion.so,i want to hear others opinion......
    Tq

    Java Web Start is the solution I would choose. You must bear in mind that a browser is not enough to run Java Web Start - the client PC must have the correct version of the run-time environment (JRE) installed as a minimum - which, I think, is somewhere about a 10-15 megabyte installation.
    The run-time environment for end-users is best/readily installed from the http://www.java.com site. Click the "get it now" button and away you go!
    Alternatively, I think some PCs actually recognise when you've clicked on a JNLP link and automatically check your to see if you have a version of the JRE and download it if necessary - but I'm not 100% sure if this can be relied upon across all platforms/browsers...
    I think you can also program your JNLP file as to where to look for the JRE installer (ie: maybe on your LAN instead of www.java.com), but I haven't researched that one yet.

  • Need suggestion whether to use ATM or MPLS in DSL implementation

    Presently i am working in ISP, and we are providing internet access via simple dialup, ISDN and IVS. and now we want to implement DSL i ve talk with few peoples regarding whether to use ATM or MPLS in DSL implementation but because they are solution providers so i think they are giving me expensive solution. as long as i know about this is,whole world is shifting from ATM to MPLS Technology. ATM implementation cost is very high. so i need suggestion from u because you also have practical exposure.

    I believe ATM is soon getting obsolete...

  • Need suggestion for new laptop

    Hi, everyone I'm needing suggestions. I had a touchsmart tx2z however after nearly 4 years it has bit the dust couldn't be saved after its last crash computer would turn on but screen would stay black and ome of the keys like the caps lock would flash. Computer guys say my motherboard has gone bad.  I'm looking for another computer now but would like one that is similar to the hp touchsmart but does not cost a lot of money.  

    Here is the current line-up of HP Touchscreen Laptops. Prices start at about $650 and go up from there. $650 sounds OK to my for a touchscreen laptop, but price is a subjective item. If these are too rich for you, you could always look at regular laptops.
    Please send KUDOs
    Frank
    {------------ Please click the "White Kudos" Thumbs Up to say THANKS for helping.
    Please click the "Accept As Solution" on my post, if my assistance has solved your issue. ------------V
    This is a user supported forum. I am a volunteer and I don't work for HP.
    HP 15t-j100 (on loan from HP)
    HP 13 Split x2 (on loan from HP)
    HP Slate8 Pro (on loan from HP)
    HP a1632x - Windows 7, 4GB RAM, AMD Radeon HD 6450
    HP p6130y - Windows 7, 8GB RAM, AMD Radeon HD 6450
    HP p6320y - Windows 7, 8GB RAM, NVIDIA GT 240
    HP p7-1026 - Windows 7, 6GB RAM, AMD Radeon HD 6450
    HP p6787c - Windows 7, 8GB RAM, NVIDIA GT 240

Maybe you are looking for

  • My Art work on I-tunes doesn't match

    Hi. Hope you can help. Not sure if this is going to mean anything to you but I'll do my best. I've made my I-tunes look like a jukebox with my artwork(Hope that makes sense?) My problem is, the artwork that is corrent isn't showing up as the right co

  • Not able to connect remote oracle database over VPN

    I can not connect remote oracle database over VPN. tnsping is ok and it shows the server information of remote database. i can also telnet the 1521 port of remote database server. I can connect the same server when it is located in the same LAN. Plea

  • Report RSMIPROACT gives Customer could not be determined for IDOCs

    Hi Friends, I am executing the report RSMIPROACT in ECC 6.0 system to publish Demand and Stocks into the SCM 7.0 system. The IDOC is processed without any errors in ECC 6.0 . However, in the SCM 7.0 system , the IDOC fails with the error. I have noti

  • Can I use mini dvd's in my new imac?

    Have several movies made with sony mini dvd camcorder, can I put the mini-dvd in the dvd slot of my imac, or will it get stuck? Thanks, Dan

  • Macbook pro 13" broken videocard

    my macbook pro 13" 2012 is broken. the videocard is down. someone the same problems? the macbook pro 15" and 17" will be reimbursed but de 13" not.