Escape XML problem

Hi,
This is a FAQ, however, I did a search before posting to the forum but could not find a definite solution. Here is what I am trying to do:
A webservice is returning a response XML and I am trying to display it on client console. I am able to display it properly on server side. The response is received by client of type 'Document'.
I create a transformer to get a string and display it on the console, and this is how it is done:
TransformerFactory tFactory =
    TransformerFactory.newInstance();
  Transformer transformer = tFactory.newTransformer();
  DOMSource source = new DOMSource(document);
  StreamResult result = new StreamResult(System.out);
  transformer.transform(source, result);I get the writer out of the result and do 'toString()' to get the text. but the output shows & lt; instead of <  and similarly of > alsoWhat am I missing? and how do I fix this? Can anyone help me with this? Many of the posts direct to using the parser, i hope they refer to using DocumentBuilderFactory and then factory.parse(..) to get the document... but as I already have the document I did not use it...
Thanx in advance.

What you are missing is the explanation of why that is a problem.
It's normal to escape "<" as "&lt;" if you are talking about data in a text node. But it is not normal to escape the "<" that starts a tag... unless you have an XML document embedded as a text node in an envelope-type document, in which case its tags are treated as text. This sort of thing happens in web services.
So, do you have a problem? I'm not convinced you do.

Similar Messages

  • Escape XML.vi bug?

    When I convert an empty 2D array of I32 to XML using Flatten To XML then run it through the Escape XML.vi the ouput string contains NULLs.
    It seems that the tags with no actual value in between causes a NULL (\00) character to be produced between the tags. Is this right or is it a bug?
    Test by sending the constant "" through the "Escape XML.vi" that comes with LabVIEW 6.1.

    Yes, this is a bug. The problem is in xml.llb\EscapeChars.vi. The problem is that when the XML In string is empty the while loop still runs once...which produces 0, the default value for a U8. This \00 is now added in between the val tags. To fix this VI just add a case to the case structure for 0 and pass the array straight through.
    This bug will be fixed in the next version of LV.

  • How to avoid escaped XML in "Set Workflow Variable" | "By Composing"

    Hi, I have a proplem building an XML document using the action : "Set
    Workflow Variable" | "By Composing" dialog.
    The value of an element on the left pane is a variable in the right pane.
    This variable contains a snippet of XML.
    The problem is that when I print out the newly created document the XML I
    added to it from the variable has been escaped :
    In the example below I created a new xml document called new XML in its
    child_2 element I set its value to the XML String "xml".
    As you can see, the value of child 2 has been escaped. Is there a way to
    turn this feature off ??
    <Jan 30, 2002 10:02:35 AM GMT+10:00> <Info> <WLPI> <<wlpirequest>
    <started>2002-01-30 10:02:35.009</started>
    <requestor>wlpisystem</requestor>
    <templateid>17</templateid>
    <template-name>TEST ESCAPE XML</template-name>
    <templatedefinitionid>17</templatedefinitionid>
    <instanceid>10005</instanceid>
    <actions>
    <activatetask time="2002-01-30 10:02:35.009" taskid="2" name="Task 1"/>
    <setvariable time="2002-01-30 10:02:35.009" variable="xml">
    <StartActivity><businessRef>bus ref</businessRef><orderRef>order
    ref</orderRef><activityId>Activity ID</activityId></StartActivity>
    </setvariable>
    <setvariable time="2002-01-30 10:02:35.011" variable="newXML">
    <Root>
    <Child_1>Child 1 data</Child_1>
    <Child_2><StartActivity><businessRef>bus
    ref</businessRef><orderRef>order
    ref</orderRef><activityId>Activity
    ID</activityId></StartActivity></Child_2>
    </Root>
    </setvariable>
    <marktaskdone time="2002-01-30 10:02:35.011" taskid="2" name="Task 1"/>
    <workflowdone time="2002-01-30 10:02:35.032" name="TEST ESCAPE XML"/>
    </actions>
    <completed>2002-01-30 10:02:35.037</completed>
    </wlpirequest>
    >

    Hi,
    I also have this problem. It seems that a crude way around it, is to use a quick
    fix via calling a business operation that performs string substitution to replace
    the escaped entity references (<) and (>) with "<" ">". I have done this
    and the approach works for me. Just be careful and make sure that the xml string
    your are cleaning up doesn't contain any of these entity reference that you would
    like to keep. Otherwise it will definitily break your xml. I hope you have that
    luxury.
    The easiest way to do is is to write a StringUtil class with a static replace
    function, replace(source, old, new), expose this method as a business operation,
    then call twice to convert your xml string.
    I know this is pretty pathetic, but might help in the meanwhile until BEA provides
    this functionality.
    Lukas
    "Smita Agarwal" <[email protected]> wrote:
    >
    Hi Paul,
    I am getting the exact same problem , have you found a solution for
    it??
    It will be great to know if this problem is solved.
    I am using WLI2.1 sp1 and WLS6.1 sp2, even with these two configuration
    this problem
    is occuring
    cheers,
    Smita
    "Paul Rooney" <[email protected]> wrote:
    Hi, I have a proplem building an XML document using the action : "Set
    Workflow Variable" | "By Composing" dialog.
    The value of an element on the left pane is a variable in the rightpane.
    This variable contains a snippet of XML.
    The problem is that when I print out the newly created document theXML
    I
    added to it from the variable has been escaped :
    In the example below I created a new xml document called new XML inits
    child_2 element I set its value to the XML String "xml".
    As you can see, the value of child 2 has been escaped. Is there a way
    to
    turn this feature off ??
    <Jan 30, 2002 10:02:35 AM GMT+10:00> <Info> <WLPI> <<wlpirequest>
    <started>2002-01-30 10:02:35.009</started>
    <requestor>wlpisystem</requestor>
    <templateid>17</templateid>
    <template-name>TEST ESCAPE XML</template-name>
    <templatedefinitionid>17</templatedefinitionid>
    <instanceid>10005</instanceid>
    <actions>
    <activatetask time="2002-01-30 10:02:35.009" taskid="2" name="Task
    1"/>
    <setvariable time="2002-01-30 10:02:35.009" variable="xml">
    <StartActivity><businessRef>bus ref</businessRef><orderRef>order
    ref</orderRef><activityId>Activity ID</activityId></StartActivity>
    </setvariable>
    <setvariable time="2002-01-30 10:02:35.011" variable="newXML">
    <Root>
    <Child_1>Child 1 data</Child_1>
    <Child_2><StartActivity><businessRef>bus
    ref</businessRef><orderRef>order
    ref</orderRef><activityId>Activity
    ID</activityId></StartActivity></Child_2>
    </Root>
    </setvariable>
    <marktaskdone time="2002-01-30 10:02:35.011" taskid="2" name="Task
    1"/>
    <workflowdone time="2002-01-30 10:02:35.032" name="TEST ESCAPE XML"/>
    </actions>
    <completed>2002-01-30 10:02:35.037</completed>
    </wlpirequest>
    >

  • IOError in IE but not in Firefox (possible crossdomain.xml problem)

    Yesterday, I hopefully debugged a problem that is occuring for our application in IE but not in Firefox.
    It has to do with accessing remote content from a separate domain.
    In every aspect it APPEARS to be a crossdomain.xml issue but the fact that this issue only arrises in IE is what has prompted me to post here.
    We have a solution in the works (bureaucratically speaking) but I want to double check here.
    Our application is on domain "a.domain".
    It access an xml file on "b.domain/xml/".
    And finally (this is the tricky part) it also accesses an xml file at "b.domain/forwardingPath/" which is actually forwarded to "c.domain/xml/".
    The crossdomain.xml is located at "b.domain/crossdomain.xml".
    The request for "b.domain/xml/anXMLFile.xml" works without any problem.
    The request for "b.domain/forwardingPath/anotherXMLFile.xml" succeeds in Firefox but not in IE (remember, the ACTUAL request is forwarded to "c.domain/xml/anotherXMLFile.xml").
    In IE I get an IOError.
    I believe we need an appropriate crossdomain.xml file also located at "c.domain/crossdomain.xml" and have put in that request.  What I want to confirm is whether this understanding is correct.  I am not a server-side person at all.  It's all elves and fairies to me.  And then finally, why the hell is this behavior inconsistent between IE and Firefox?  Is the Firefox version of flash player violating its own security standards?!
    I am cross-posting this at stack overflow.  http://stackoverflow.com/questions/7395931/ioerror-in-ie-but-not-in-firefox-possible-cross domain-xml-problem

    I've pinged our developers about this and here's what they have to say:
    "We did some work for the plugin around redirects andhence the correct behavior on Firefox.
    AFAIK, on IE we don't get notified of the redirect and can't participate in making security decisions during redirect scenarios. This behavior is out of our control.
    There is a workaround documented in the AS3docs here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/LoaderCont ext.html#checkPolicyFile
    Here is the pertinent paragraph:
    Be careful with checkPolicyFile if you are downloading anobject from a URL that may use server-side HTTP redirects. Policy files arealways retrieved from the corresponding initial URL that you specify inURLRequest.url. If the final object comes from a different URL because of HTTPredirects, then the initially downloaded policy files might not be applicableto the object's final URL, which is the URL that matters in security decisions.If you find yourself in this situation, you can examine the value ofLoaderInfo.url after you have received a ProgressEvent.PROGRESS orEvent.COMPLETE event, which tells you the object's final URL. Then call theSecurity.loadPolicyFile() method with a policy file URL based on the object'sfinal URL. Then poll the value of LoaderInfo.childAllowsParent until it becomes true."
    Chris

  • How to escape XML in BPEL?

    I have a part of a outputmessage in an element HTML of xsd:any. This element contains HTML which i have to transform to escaped XML.
    Therefore i created the following embedded java code.
    String htmlContent = ((oracle.xml.parser.v2.XMLElement)getVariableData("l_GetBericht_Output","reply","/ns5:GetBerichtResponse/ns14:Bericht/ns14:HTML")).getFirstChild().getNodeValue() ;
    htmlContent.replaceAll("<","&lt;") ;
    htmlContent.replaceAll(">","&gt;") ;
    setVariableData("TestHTMLContent",htmlContent);
    Message in l_GetBericht_Output starts with;
    <l_GetBericht_Output>
    <part name="reply">
    <sbtn:GetBerichtResponse>
    <ns3:Bericht>
    <ns3:Onderwerp>sdjasldjalsda</ns3:Onderwerp>
    <ns3:Tekst/>
    <ns3:HTML>
    <HTML>
    <div>
    <p>Data</p>
    <p>
    <p>
    de heer ...
    The result of the selection in BPEL variable TestHTMLContent is empty though.
    Anyone any thoughts ?
    Is there a better way to transform XML to escaped XML ?
    Why is my selection null ?
    Cheers,
    Peter

    Try this.
    xpath query for BPEL,  escaping double quotes
    Should work.
    Thanks,
    Vijay

  • Web.xml problem in Enterprise Manager 10g

    I got an error while deploying to Enterprise Manager 10g
    My platform: Windows XP
    OC4J 9.0.4
    Enterprise Manager 10g
    And I even have the web.xml in the correct directory. i.e
    cpd.ear
    ./META-INF/application.xml
    ./cpd-ejb.jar/WEB-INF/web.xml
    ./cpd-webapp.war/WEB-INF/web.xml
    ./cpd-webapp.war/WEB-INF/classes
    The error I get while deploying on a Enterprise Manager 10g is:
    Invalid J2EE application file specified - Jar file: :\WINNT\TEMP\jar47575.tmp is missing its standard xml descriptor located at WEB-INF/web.xml
    Incidently the *.ear file built by my fellow's machine is deploying perfectly. I've compared the directories n useful files of both the *.ears down to the very last bit n they are the same.
    I can imagine that guys with only high IQ can solve this mystery

    The above message is a duplicate of another message by Sim.
    web.xml problem in Enterprise Manager 10g

  • Escape XML Strings with JDK class

    Hi,
    can anyone tell me how to escape XML-Strings with classes of the JDK?
    When searching I only was pointed to StringEscapeUtils from apache.commons.lang, but we would prefer to use the JDK instead of integrating an external lib.
    Our aim is to escape an XML attribute, so a CDATA is not applicable for us in this case.
    Thanks
    Jan

    I implemented it by myself:
    public static String escapeXmlAttribute(String attributeValue) {
            StringBuffer result = new StringBuffer();
            for (int c = 0; c < attributeValue.length(); ++c) {
                if (attributeValue.charAt(c) == '"') {
                    result.append("&#34;");
                } else if (attributeValue.charAt(c) == '&') {
                    result.append("&#38;");
                } else if (attributeValue.charAt(c) == '<') {
                    result.append("<");
                } else if (attributeValue.charAt(c) == '>') {
                    result.append(">");
                } else {
                    result.append(attributeValue.charAt(c));
            return result.toString();
        }{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Escape key problems.

    My escape key has been freaking out on me lately. It seems to randomly decide to press itself down very rapidly, and it continues to do so until I press the key myself, fairly hard. The key isn't jammed or anything. Is there anything I can do to fix this, short of paying a rediculous price to get a new keyboard. This escape key problem makes even the most simple action a chore.
    By the way, I'm using a Lenovo 3000 n100.
    Message Edited by PSOCecil on 05-23-2008 06:12 PM

    Yes, they told me they didn't do any laptop work. And I sent it in when it was still under warenty, asking them to look at both my non-working USB drives (that were causing a odd power problem and causin the computer to not start), and my weird escape key. They seemed to of forgotten the escape key, and just looked at the USB drives. It's not under warenty any more, and I don't want to send it back to them again, after the ordeal I had to go through last time.

  • Log-Configuration.xml Problems

    Hi, I have been trying to use log-configuration.xml but it seems like i cannot get it to work at all.
    From what i understand, once i deploy my application, i should be able to edit the config via the Visual Administrator. However, after i deploy my app, i am still unable to see it with visual administrator. furthermore, i cannot find the file anywhere on the sever. Also, my settings are not reflected in the behaviour of the defaultTrace.
    Am i suppose to be able to find the "log-configuration.xml" file in the server if i have done the correct steps? If so, what are the likely mistakes i have made? I am at my wits end, anyone can help me?
    Just to add, this post seems to describe exactly my situation except i have no idea how to "manually" correct it... log-configuration.xml outside META-INF due to NWDS
    TIA!
    Ah Beng
    Message was edited by: ah beng

    Hi Rajeshkr,
    Sorry, i am kinda new to web dynpro and sap in general so i may need you to be more explicit
    I am not quite sure what this part means or how to check "...has been deployed successfully in the deploy node of the visual Node and check for the Log Configuratior Node and check for your deployed application...."
    What i did do is go to the server to and search the entire directory structure for the log-configuration.xml but could not find it. Also, the config cannot be seen via the log-configurator in visual administration engine which its supposed too i think. and lastly the behavoiur i set in the log-configuration.xml is not reflected in the defaultTrace
    Then i saw this post so i went to check the EAR file in my workspace and found that it was just like Manik described.
    Maybe u could check this link where i posted more about my problem Log-Configuration.xml Problems
    I would love to award points if it helps

  • XML Problem - Markup not well-formed? (kinda long)

    Hello, I'm working on my first AIR app and I've run into a bit of a snag.  The app is intended to allow users of our system to create a Word document, save it as XML, and then load it into the AIR app and have some manipulation performed to extract data, and finally store the data in a database.  The reasons for this app to exist are pretty irrelevant for the particular problem that I'm having, but a little background on my development efforts might help shed light on my situation, and with luck one of you might be able to help me figure this out.
    I started on this app using the URLLoader and URLRequest objects to load a Word document saved as XML from a server.  This worked fine, I created logic to distinguish between Word 2007 and Word 2003 XML formats and using the E4X XML and XMLList objects I was able to load that XML into an XML object, change it to a string, grab the document body, strip out namespaces and such (formatting is mostly irrelevant here too, only the actual data is of importance) amd eventually get a much simpler XML object or list that contained just the data relevant to the purpose at hand.  This was all working fine, I managed to get both Word XML formats to process as I wished and spit out new XML that will serve as the basis for another application that we run.  Great! 
    The problem was that in order to use this method in a distributed way I needed to have the original Word documents accessible to the code, which meant having the user upload their Word file (saved as XML) and then retrieving it with the URLLoader and URLRequest.  I actually implemented this method using the FileReference object in AS3 and using some simple PHP code to store the file in a server directory that was accessible to the client.  Unfortunately, this lead me to thinking about the security issues involved and how allowing PHP to write to a directory would open it to potential malicious attacks, yada yada yada, you all know the issues.  So I thought that I might be able to read the file before uploading it in the kind of circular logic that sometimes happens.  When I started into the AS3 docs to check on classes to help, I realized that my initial suspicions were correct and that in order to load and read the file locally, I could use AIR, have the user load up their XML file, process it and then send the resulting XML and info to the database directly (eliminating the need to send files to the server AND preventing the need to allow PHP to write to the server in this instance).
    So after a bit of reading and testing, I managed to modify my FLA to publish an AIR file, and started debugging.  My Word 2007 document worked fine - I create a File object and a FileStream object and they are easily able to access the file the user selects via the File.browseForOpen method.  I then run the processing code, which begins by creating an XML object from the data read from the file.  What's happening now is that while the Word 2007 document loads and processes without an issue, the Word 2003 document is causing a 1088 error: The markup in the document following the root element must be well-formed.
    I don't understand why this is happening since the same document in the same format was able to be loaded into an XML object when I used the URLLoader to grab the file.  The only thing I can conclude is that somehow the FileStream.readUTFBytes() method is somehow causing an issue.  I am able to trace out what is being read, but the file is lengthy and I haven't completed my analysis to see if and where the changes are occuring.
    If anyone has any experience with this type of situation, I'd really appreciate hearing about it.  Thanks in advance for any help you can provide.

    OK, it turns out that for some reason the Word 2003 XML document was being read with an extra character preceding the actual markup.  By dumping the stream into a string and then clipping the first character I was able to get the app running again.  Thanks for taking the time to read this thread! 

  • Conversion of FMB to XML problem

    Forms [32 Bit] Version 9.0.4.0.19 (Production)
    I am in the middle of a conversion project where we are converting fmb files to xml, making the required changes to the xml files using a conversion program, and then converting them back to fmb. When compiling the the fmb files, I noticed that there were compilation errors in a few of the forms. Checking original xml code for one of the forms that did not compile, it did not contain the trigger text for one of my post-change triggers. The block actually contains two items with the same identical post-change trigger. Only the trigger text for one of the items is written. The following shows the trigger for the "RECEIVED_TODAY" written properly, but the next item with the identical trigger does not have the trigger text:
    <Item Name="RECEIVED_TODAY" FontName="Arial" .... MaximumLength="10">
    <Trigger Name="POST-CHANGE"
    TriggerText=":in_po_detail.qty_received :=
    :in_po_detail.qty_received + nvl(:in_po_detail.received_today,0);
    &#10; &#10;get_due;" DirtyInfo="true" />
    </Item>
    <Item Name="RETURNED_TODAY" FontName="Arial" .... MaximumLength="10">
    <Trigger Name="POST-CHANGE" DirtyInfo="true" />
    </Item>
    If I delete and re-create the trigger for the item that is not written, it will write the corresponding xml out properly.
    Does anyone know why this is happening?

    Peter,
    sound strange and my guess is that this should be looked at by customer support. Is the Forms module originally build in Forms 9.0.4 or is it upgraded from a previous version of Forms?
    I found bug 2923866 that reports a similar case where the trigger was subclassed from a form or library. In this case the trigger text wasn't in the XML output and showed only if created in the Forms. Not sure if this is the same problem you are facing.
    Frank

  • Report with subreports. Web Service/XML problem. Please help!

    Hi,
    I have a composite report (main report with 9 subreports). The report uses web service as datasorce and is provided with single xml file containing the schema and all the tables for the main reports and its subreports.
    The problem I encounter is that i have to establish a connection for each subreport in order to get it work and it is the same connection. Moreover, I have observed that each time a subreport is drilled there is distinct call to the web service.
    So, i end up having a single .rpt file which makes up to 10 unnecessary calls over http just get the same xml data ???
    I've tried everything to solve this problem without any success.
    Option 1: Removing subreports. Not posible because main report can not handle multiple detail section separately.
    Option 2: Using multiple detail section in main report and conditionally suppress rows. Not possible
    Option 3: Removing datasource from subreports and pass array variables instead. Not posible
    Option 4: Remove subreports and use crosstabs in main report. Not posible
    Any ideas?
    Please I would greatly appreciate any input, I am getting quite desperate about this.
    Thank you very much.

    Subreports make their own data connection, the reason why subreports are used for other data sources.
    Post to the Report Design forum to help on redesigning the report

  • VAT declaration in XML - Problem with report RFASLDPC

    Hello all,
    I have a problem with the report RFASLDPC. We use it to download an XML file that we generated which contains the VAT declaration.
    In the report RFASDLPC, there is a FORM named QUELLFILE_PRUEFEN which stop the report and display a message : "Data file FILE_NAME is not correct".
    The reason is that QUELLFILE_PRUEFEN checks (for Belgium) that the beginning of my document starts with '000000' (six times zero). But this is impossible for an XML file to begin with '000000'. An XML file must begin with "<?xml version="1.0" ?>" or a least "<".
    Here is the code :
    FORM QUELLFILE_PRUEFEN.
      OPEN DATASET PAR_PATH FOR INPUT IN BINARY MODE.
      IF SY-SUBRC NE 0.
        MESSAGE E306 WITH PAR_PATH.        ''Quellfile nicht vorhanden
      ENDIF.
      READ DATASET PAR_PATH INTO HLP_RECORD.
      CASE PAR_FTYP.
        WHEN 'AT'.                         ''ASL Österreich
          IF HLP_RECORD(1) NE 'I' OR HLP_RECORD+46(2) NE 'ZM'.
            MESSAGE A185(FR) WITH PAR_PATH.
          ENDIF.
        WHEN 'BE'.                         ''ASL Belgien
          IF HLP_RECORD(6) NE '000000'.
            MESSAGE A185(FR) WITH PAR_PATH.
          ENDIF.
        WHEN 'ES'.                         ''ASL Spanien
    *     IF HLP_RECORD(1) NE '1' OR HLP_RECORD+104(3) NE '349'.
          IF HLP_RECORD(1) NE '1' OR HLP_RECORD+1(3) NE '349'.
            MESSAGE A185(FR) WITH PAR_PATH.
          ENDIF.
        when 'FI'.
          if hlp_record(3) ne '000'.
            MESSAGE A185(FR) WITH PAR_PATH.
          ENDIF.
      ENDCASE.
      CLOSE DATASET PAR_PATH.
    The line :
    READ DATASET PAR_PATH INTO HLP_RECORD.
    Put the 128 first character of the XML file in HLP_RECORD because HLP_RECORD is defined as :
    HLP_RECORD(128) TYPE C
    So as I work in Belgium, it is the condition :
    WHEN 'BE'.                         ''ASL Belgien
          IF HLP_RECORD(6) NE '000000'.
            MESSAGE A185(FR) WITH PAR_PATH.
          ENDIF.
    which is checked. But this condition cleary check if the beginning of the XML is '000000' and if it is not, it stop the program.
    I searched for all the SAP notes about RFASLDPC but I found none about this problem.
    Did someone else have also this problem ? Did you find a way to solve this ?
    Thank you in advance for your help.
    Best Regards.
    Gregory Pierre.

    anyone has an idea ? ...

  • XML Problem: I can't open my Word 2007 docx file (Start/Endtag Problem) - Fixit doesn`t work

    Hi there,
    I have a big problem and I hope there is somebody who could repair my Word-Document (or at least save the text somehow).
    After my flash drive crashed, I used a data restoring software and managed to get back this important Word-File, but now I can't open it ((Start/Endtag Error)
    The Fixit solution of Microsoft didn't work. I read about fixing the problem with an XML-Editor, but I have no experience with that.
    The most important thing would be just the text. It would be fantastic if someone could restore this work (which took me nearly two weeks).
    I uploaded the docx and the xml file here:
    http://www.file-upload.net/download-8602999/Studienarbeit_-_Anw._Fallstudienseminar_-_Robert_Fromm_-_32874.docx.html
    http://www.file-upload.net/download-8603008/document.xml.html
    Thanks a lot in advance! You would save me a lot of time.
    greetings Robert

    Hi,
    I had download the file ,but your second link was invalid. I tested to open it, and got the error message:"The name in the end tag of the element must match the element type in the start tag."
    This issue is related strictly to oMath tags and occurs when a graphical object or text box is anchored to the same paragraph that contains the equation.
    Please try to fix it with the KB:
    http://support.microsoft.com/kb/2528942/en-us
    Here is a similar issue:
    http://answers.microsoft.com/en-us/office/forum/office_2010-word/cant-open-word-file-because-of-end-tagstart-tag/581159d0-9ebc-4522-b30c-53e33e8268e1
    Regards,
    George Zhao
    TechNet Community Support

  • XML problem with getPayload

    Hi,
    I have come across an obscure but annoying xml bug in the bpel (collaxa?) implementation. I need to use xs:extension elements in the schema for the payload contents, which then of course requires a declaration of the xsi namespace. The payload is saved fine, and when I view the contents in the bpelconsole, it is there (as shown below). However, when I get the task and call getPayload, the xsi declaration is missing from the element, which then crashes JAXB.
    This is what is shown in the BPELConsole audit:
    <payload>
      <process-request xmlns="urn:ch.bedag.pef.iflow.process" user="ea91" process-name="Wohnadresse">
        <person xmlns="urn:ch.bedag.pef.iflow.core">
          <angestellter>
            <anstellung/>
            <wohnadresse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:AdresseSchweiz">
              <adresszusatz>c/o Bedag Informatik</adresszusatz>
              <strasse>Gutenbergstrasse 1</strasse>
              <ort>Bern</ort>
              <plz>
                <plz>3000</plz>
              </plz>
            </wohnadresse>
          </angestellter>
          <name>Prince</name>
          <personalnummer>
            <personalnummer>111111</personalnummer>
          </personalnummer>
          <vorname>John</vorname>
        </person>
      </process-request>
    </payload>And this is what I get when I call getPayload:
    <process-request xmlns="urn:ch.bedag.pef.iflow.process" user="ea91" process-name="Wohnadresse">
      <person xmlns="urn:ch.bedag.pef.iflow.core">
        <angestellter>
          <anstellung/>
          <wohnadresse type="ns1:AdresseSchweiz">
            <adresszusatz>c/o Bedag Informatik</adresszusatz>
            <strasse>Gutenbergstrasse 1</strasse>
            <ort>Bern</ort>
            <plz>
              <plz>3000</plz>
            </plz>
          </wohnadresse>
        </angestellter>
        <name>Prince</name>
        <personalnummer>
          <personalnummer>111111</personalnummer>
        </personalnummer>
        <vorname>John</vorname>
      </person>
    </process-request>The only difference is in the wohnadresse element, which has the correct xsi:type attribute, but the xsi: namespace declaration is missing.
    Any chance of fixing this? Otherwise I will have to convert the payload to a string, fix the problem, back to xml and then pass it off to jaxb. Very irritating...
    I don't know if it will help, but I did see the same problem when I tried converting a string to xml using a DOMResult and a Transformer. I switched to DOMParser and and InputSource and the problem went away.
    Thanks
    John

    Hi
    After a lot of experimenting, it looks like there are two problems:
    1. If I call IDeliveryService.post with a NormalizedMessage constructed with a String, bpel is not completely reliable with the namespaces (it converts them all to default namespaces defined on particular elements, but it missed the namespace within the xsi:type declaration). I fixed this by using DOMUtil to convert the string to a CubeDOMElement, which is then correctly converted to the input variable.
    2. The CubeDOMElement also makes mistakes if you use Element.getElementsByTagNameNS(ns, name). Even when all the information was there, the method removed one of the namespace declarations (actually a duplicate, but necessary because the prefix was used in the document).
    I got round this by calling the CubeDOMElement method getContentAsXml, which bizarrely returns the full xml of the child nodes, with all namespaces correctly defined and used, and then converting the xml string into a normal org.w3c.Element.
    It looks like a few more test cases are needed for the collaxa xml implementation...
    Best wishes
    John

Maybe you are looking for