Subtags in XML getting removed in servlets

In a servlet when a server is sending back the XML as a String to client, Subtags in XML getting removed in servlets.
Example:
<x>
<a>test</a>
<b>test</b>
<c>test</c>
</x>
When this xml is retured as a string from servlet back to client only a part on xml is reaching client.
<x>
<a>test</a>
</x>
Please advice what could be a problem here.

Welcome to the Sun Forums.
When asking a question, please try and post an sscce. And wrap your code in code tags (select your code while posting and click 'CODE' in the bar above the text-area), this provides formatting that makes it easier for people to read it. Like this:
<x>
<a>test</a>
<b>test</b>
<c>test</c>
</x>How are you generating the XML? It could very well be a loop problem since the opening and closing tags exist. Please post your code and the actual output that you get. And don't paraphrase, copy-paste.

Similar Messages

  • Passing xml as Patameter to servlet  (Catalina)

    I am having problem with passing xml as parameter to a servlet using tomcat 4-0-5 ( it works fine on tomcat 3.2 !)
    The servlet request.getParameter("xmlstring") returns a null.
    If from xml I remove version= form the <?xml version=\�.0\" ?> tag, then request.getParameter("xmlstring") shows the string that I passed correctly. But then my xml string is malformed.
    I have tried passing the xml string to the servlet from browser and by opening a connection & passing in the parameter.
    It gives the same error in both cases
    Also this works fine if I use tomcat 3.2 as the server. I am getting this error in tomcat 4-0-5
    Thanks,
    Ritu

    One or two small changes should help. First, take the XML you've listed as a parameter and place it in it's own file. Put the .xml file in the /WEB-INF directory right next to the web.xml file. Second, create a servlet-param with the name of the file. Third, in the servlet, get the name of the file and use the ServletContext.getResourceAsStream("/WEB-INF/" + filename) to get the file. You can then parse it from there.

  • Using Berkeley XML DB in a servlet

    h2. Problem:
    I have a servlet using Berkeley XML DB as listed in the code snippet below. For simplicity I have removed the exception handling from the code snippet. When I invoke the servlet several times, the memory usage goes high and gets released only when the application is undeployed i.e when the destroy() method is called.
    h2. Questions:
    1. Is this the best way to use Berkeley XML DB in a servlet?
    2. What other techniques can be adopted to release memory held by XmlManager, XmlContainer and Environment?
    Please help!
    Thanks,
    Madhav
    h2. Code Snippet:
    public class MyServlet extends HttpServlet {
    String containerName = "mycontainer";
    String content = "<hello>Hello World</hello>";
    String environmentDir = ".";
    XmlManager mgr = null;
    XmlContainer cont = null;
    Environment env = null;
    public void init(ServletConfig config) throws ServletException {
    EnvironmentConfig config = new EnvironmentConfig();
    env = new Environment( new File(envHome), config);
    XmlManagerConfig mconfig = new XmlManagerConfig();
    mgr = new XmlManager(env, mconfig);
    XmlContainerConfig cconfig = new XmlContainerConfig();
    cont = mgr.createContainer(containerName, cconfig);
    public void destroy() {
    try {
    if (cont != null)
    cont.delete();
    if (mgr != null)
    mgr.delete();
    if (env != null)
    env.close();
    } catch (Exception e) {
    // ignore exceptions in cleanup
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    for (int i =; i < 5000; i++) {
    XmlTransaction txn = mgr.createTransaction();
    cont.putDocument(txn, newDocName, content);
    txn.commit();
    }

    Hi,
    I guess you posted not all code since I can't see for example configuring an environment for transaction support.
    Is your servlet doing only what is described in the doGet() method?
    Did you try to launch a stand-alone application and execute method doGet() multiple times? What happens with memory?
    Maybe you are using in-memory logging?
    Vyacheslav
    UPD: Probably you don't want to create and commit a txn for every small document. Grouping some of documents in the scope of a single transaction might help. I'm not sure about memory, but in terms of efficiency it's faster
    Edited by: detonator413 on Nov 13, 2009 11:38 PM
    Edited by: detonator413 on Nov 14, 2009 12:38 AM

  • Using xml or direct link servlet

    If customers >1000 access the datas in the same time.
    Using GRPS OR CDMA network,
    we should choose xml transactions data or servlet ?
    thanks
    [email protected]

    I think, you are confusing the techniques a bit (or didn't I get the point?).
    You can use Servlet and XML technology at the same time. XML transaction means that you are sending and receiving data in XML format (which is a self describing format). A servlet is a server add-on (like a PERL script), which allows you to receive, process and send data.
    But with J2ME try to use WBXML (WAP Binary XML) instead of plain XML. It will reduce the size of the data streams and possibly the size of the MIDlet.

  • Approvers of Rejected line items not getting removed -Process controlled WF

    I have developed shopping cart approval using process controlled workflow. We are using SRM 7.0, patch level 9.
    Decision set used is item based approval for partial documents (Type 4)
    While testing I observed that when I reject any item, the corresponding approvers of that items are not getting removed.
    As per your requirement, if we create SC with 2 items A and B. Based on various conditions
    2 process levels are determined for item A, say approver X and approver Y at respective level.
    3 process levels are determined for item B, say approver X, approver Z1 and Z2.
    Approver X, rejects item A and approves item B. Since one item is rejected, the work item is sent to requestor for acceptance. All process levels are of type "Approval". Once the requestor clicks on "Accept" button, the item A, which is rejected gets deleted from the shopping cart.
    However now when I see the Approval Process Overview, the current approver shown is Y. The work item is sent to approver Y and the value of the shopping cart is shown as 0.00. Logically the approver Y should have been removed from approval process.
    Could you let me know if I am missing any step or do I need to do some coding to get rid of approvers of rejected items.
    Regards,
    Manish.

    We were using N-step process level on the item level contrast to example provide by SAP of N-step process leve on Header level. SAP uses standard tables /SAPSRM/D_WF_015 and /SAPSRM/D_WF_016 to implement the logic. We have customized the solution with logic on same line of sap but using bespoke tbale ZSAPSRM_D_WF_016. Let me know if anyone needs solution.

  • XML Reading Using Java Servlet

    I need some help in reading xml file using java servlet.
    May i have some sample codes to read xml files?
    I would really appreciate your help. Thanks!!!

    This grabs a url and parses it with a servlet.
    URL befreeUrl = new URL(urlString);
    uri = new URI(urlString);
    URLConnection yc = befreeUrl.openConnection();
    BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser parser = factory.newSAXParser();
    factory.setValidating(true);
    out = new OutputStreamWriter(System.out, "UTF8");
    DefaultHandler handler = new BeFreeRequestSAXParser(); /* custom handler class */;
    parser.parse(uri.toString(), handler);
    in.close();

  • How InDesign comes to know about any changes on document, but not saved. As it shows * on the name of document when it is opened and any changes. And after saving * symbol is get removed from the name of document. How and where indesign@ handles this?

    How InDesign comes to know about any changes on document, but not saved. As it shows * on the name of document when it is opened and any changes.
    And after saving * symbol is get removed from the name of document. How and where indesign@ handles this?

    Are you just asking because you want to know, or do you have a problem you need to solve? I don't know how to write a program, but I think what your are describing is not an unusual thing for a  program to do. The * tells you that changes have been made since the last save, and the program reserves a portion of memory for undo functions. I suppose a coder could tell you how it works, but I don't think it would help an average user to know, but that's just my opinion.

  • Blocking Indicator not getting removed on milestone confirmation in PS

    Dear Experts,
    I have a issue in my project.
    We have a scenario where Preq and PO getting created from PS activity.
    We are using Invoice plan in this scenario. created in the Activity.
    When we create Milestone and Invoice plan it will go for release process to get Preq released. after this PO will be created and GR will be done.
    Problem: When PS confirms the Activity the blocking sign in PO invoicing plan  is not getting removed.
    Please explain me:
    What configuration settings required to remove the blocking sign indicator in PO automatically.
    Tell me Process steps if any.
    Appreciate early response.
    BR,
    Arun

    Awaiting kind replies.

  • How to get absolute in servlet

    how to get absolute in servlet like c:\temp\apache group\tomcat4.1\test\abc.gif, thanks

    do sthing like:
    getServletContext().getRealPath("/abc.gif") in any servlet in 'test' to get the real path of abc.gif - The parameter should be relative to the current context

  • HT4623 if i update my iPhone, does the apps get removed ?

    if I update my iPhone, does the apps get removed ?

    Updating your iPhone may remove the apps if something goes wrong. You should create a backup before your update just to be sure that you can restore everything in case anything gets erased.
    Also, you can sync your apps from iTunes on your computer or re-download the apps if they do get erased for some reason

  • ASP getting removed when updating Template

       Hello,
    I have a strange problem I can seem to find an answer for.
    I'm using Dreamweaver Templates, and on some of my individual pages I am also using ASP code for contact forms.
    In theory this code is outside the template and shouldn't be removed when I do a template update because codeOutsideHTMLIsLocked is set to false.
    The bolded line of code is the ASP code on my child pages, and everytime I update the template this line of code gets removed. It seems that if I remove the @ symblo the code doesn't get removed. But I don't think it's valid ASP anymore.
    <%@ Page Language="C#" CodeFile="default.aspx.cs" Inherits="contactform" ResponseEncoding="utf-8" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="../Templates/Main.dwt.aspx" codeOutsideHTMLIsLocked="false" -->
    Now when I run an update on my main template, and check my child page, the ASP code will be removed.
    The strange thing is that if I use placeholder text instead, it won't be stripped/removed out of the template.
    The pain is I have about 10 pages (for now) to add this line to everytime I update the template, which is actually happening more and more now.
    Does anyone know why this particular ASP code gets removed any time I update my Main template?
    Thanks,
    M
    /edit: It seems that if I remove the @ from this line, I can the code to "stick" and not be removed.

    If I understand correctly, Dreamweaver will treat the area outside the HTML as an editable region when codeOutsideHTMLIsLocked is set to false?
    If my maintemplate has this code: /Templates/mainTemplate.dwt
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    And my child page has this code: /products/index.php
    <%@ Page Language="C#" ContentType="text/html"  CodeFile="default.aspx.cs" inherits="contactform" ResponseEncoding="utf-8" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="../Templates/B2B.dwt.aspx" codeOutsideHTMLIsLocked="false" -->
    Theoretically now when I update the mainTemplate.dwt Dreamweaver shouldn't strip this code out. Correct?
    If this being correct, when I use Dreamweaver and update the mainTemplate.dwt it strips this editable region out of the child pages. This is not excepted result, I was excepting that Dreamweaver to leave this code alone in its editable region.
    Thanks in advance David,
    -M.

  • I have an app in my App Store under updates under purchased that I'd like to get removed from my phone. How do I do that?

    I have an app in my App Store under updates under purchased that I'd like to get removed from my phone. How do I do that?

    In the Home screen, tap and hold the app until it wiggles. Then tap the minus red icon placed in the top of the icon. Deleted

  • How to Create an XML document from XSQL servlet which follows a particular DTD struct

    how to Create an XML document from XSQL servlet which follows a particular DTD structure.Could anyone send me a sample code for this.

    You'll need to associate an XSLT transformation with your XSQL page that transforms the canonical result into your DTD-valid format.
    For example, given an XSQL page like:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="rss.xsl" ?>
    <xsql:query max-rows="3" connection="demo" xmlns:xsql="urn:oracle-xsql">
    select title,id,description,url,to_char(timestamp,'Mon DD') timestamp
    from site_entry
    order by id desc
    </xsql:query>and an "rss.xsl" stylesheet that looks like this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" doctype-system="rss-0.91.dtd"/>
    <xsl:template match="/">
    <xsl:for-each select="ROWSET/ROW">
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    <xsl:for-each select="ITEM">
    <item>
    <title><xsl:value-of select="TITLE"/></title>
    <link><xsl:value-of select="URL"/></link>
    <description><xsl:value-of select="DESCRIPTION"/></description>
    </item>
    </xsl:for-each>
    </channel>
    </rss>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>You produce DTD-valid output against the rss-0.91.dtd DTD that looks like:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE rss SYSTEM "rss-0.91.dtd">
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>

  • Milestone Billing - Block getting removed before full confirmation.

    Hi friends,
    i am facing a problem in Milestone billing.
    I have attached a milestone to an activity.The milestone is considered in Sales order.
    When the activity will be fully confirmed the BLOCK will get removed from the Sales Order & down payment can be made.
    But the fact is when I am confirming the activity partially , the actual date is getting picked up in the milestone and the BLOCK is getting removed from the Sales Order.
    If I remove the automatic tab from the confirmation in SPRO, then during confirming of the activity a pop-up is coming ' want to consider the actual date" . If I select NO then the actual date is not coming in the milestone. This case is OK. But the end-user wants it to be automatic.
    How to prevent the actual date from getting picked up in the milestone till the activity is fully confirmed?
    I have defined the Usage & considered "2" in S/F (Milestone at the end of the activity).
    Thanks a lot.
    Regards ,
    Abhra Bose

    Hi there,
    I'm not sure if it solves the problem, but I have one remark. If you set the S/F value to 2 in SPRO it is only informative meaning. please see extract from SAP documentation:
    +Milestone at the start or finish of an activity
    This key determines whether the milestone should have  the start date ot the finish date of an activity.
    Dependencies
    Please note that this key is not used in the extended milestone functions from Release 3.0. The key just helps you to edit milestones correctly, which were created before Release 3.0.+
    What you need to do, is setting the offset directly in standard milestone in CN12 in block 'Offset to activity'.
    Rgds, Aleksandra

  • When and how does the message context get removed from the message when we use pass thru send port

    Friends,
    i have a doubt regarding message context.
    Assume i have used XMLRecieve pipeline in the receive side to receive the message so that the message context is created. I.e properties are promoted/written.
    now if we use pass thru transmit pipe line at send side, how and when does the message context get removed from the message?? Since pass thru does not have any stages/components, how does the message context removed and sent out a pure message to destination???
     i mean what exactly happens here to remove the context??
    Ravindar

    Thanks for the reply.
    "The Context is created by the Adapter, regardless of any Pipeline or Pipeline Component.  It has nothing to do with PassThrough vs. XmlReceive, although XmlReceive will write Promoted Properties to the existing Context,
    as can any other Component."
    yeah yeah, adapter does create some properties in context. You are right, i am aware of it. I just missed to explain it clearly. what i meant is addition of context properties will not happen if pass thru used. Thanks its clear.
    "No.  The Context already exists on the Message when it comes from the MessageBox and
    is equally available to any Component in any Stage.  The Context that hits the Pipeline is whatever was last Persisted, either by a Receive Port or Orchestration.  It is not created by the XmlAssembler (XmlTransmit)"
    You are right , the context already exists on the message while it leaves the receive port, and once it persists
    to message box the context and message context gets stored in messages in relative tables.
    Now as you said the components get the message from the last persistence, assume i have a send port(with passthru)
    subscriber and a orchestration subsrciber for this message.
    Orchestration gets the message with context right!!
    if the send sendport(with passthru) also gets message along with context, then where is this context removed/demoted
    while sending it out?.  i guess as per SAAkhlaq said,
    here sendport(with passthru) should get a pure message without context as passthru used. 
    or is it that ultimately send adapter removes the context completely?
    or is it something like biztalk run time load the context from database into cache and both orchestration and send port gets pure message, and if needed they use context from cache???
    sorry i may be troubling you, but i am confused. i hope i am not creating any nuisance with this
    post.
    Ravindar

Maybe you are looking for