Serializing an XML document

Hello, I recently downloaded the Java XML Pack, which uses the Xerces2 XML Parser. A couple of questions with regards to serializing an XML document to a file:
1) Xerces1 used the org.apache.xml.serialize.* classes to do serialization (such as shown below), but I don't see them in the Xerces2 API. Which packages take over for these in Xerces2?
import org.apache.xml.serialize.Serializer;
import org.apache.xml.serialize.SerializerFactory;
import org.apache.xml.serialize.XMLSerializer;
2) If we use the JAXP wrapper functionality to serialize instead, is the javax.xml.transform package the standard way to do this in 1.2?--from the examples I've seen searching this forum, this appears to be the case.
Thanks,
Glen

If you want to output your XML to a file, say, then yes the Transformer is the way to do it now. Don't know why they did that, it's far from intuitively obvious.

Similar Messages

  • Serializing XML Documents(not Java Serialization)

    Hi,
    Iam looking for a class that can serialize the XML documents.
    Heres the problem in detail:
    - I need to create an XML String from scratch taking data from a database.
    - I created the XML Document adding the childs and attributes.
    - I need an XML string from the document. Iam not exactly sure how to do this. But Apache Xerces package provides an XMLSerializer class where we can convert the document into a string.
    Is there any functionality provided. If so where can i find it.
    Thanks,
    -Rao

    Not sure if this is a bug or not (filing one just in case it is) but the following program demonstrates that with 2.0.2.9 the internal subset is serialized correctly if the document was parsed with validationMode set to true. If set to false only the entities show up in the internal subset.
    package xmlbugs;
    import java.io.*;
    import org.w3c.dom.*;
    import oracle.xml.parser.v2.*;
    public class TestSerializeLocalSubset {
    private static final String xml =
    "<?xml version='1.0' encoding='UTF-8'?>"+
    "<!DOCTYPE bar ["+
    "<!ENTITY bar 'baz'>"+
    "<!ELEMENT foo EMPTY >"+
    "<!ELEMENT bar (foo) >"+
    "]>"+
    "<bar><foo/></bar>";
    public static void main(String[] a_ ) throws Exception {
    System.out.println("Test with parser in validation mode = false");
    DOMParser d = new DOMParser();
    d.setPreserveWhitespace(false);
    d.setValidationMode(false);
    d.parse( new StringReader(xml));
    Document x = d.getDocument();
    XMLDocument xx = (XMLDocument) x;
    xx.print(System.out);
    System.out.println("Test with parser in validation mode = true");
    DOMParser d2 = new DOMParser();
    d2.setPreserveWhitespace(false);
    d2.setValidationMode(true);
    d2.parse( new StringReader(xml));
    x = d2.getDocument();
    xx = (XMLDocument) x;
    xx.print(System.out);
    }

  • Error serializing XML document.

    We are trying to serialize XML document using Oracle XML Parser (9.2.0.5.0).
    Here is the code used for serialization
    public static void write(Document doc, File resultFile) {
    try {
    // Create a TransformerFactory
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    // Create a new Transformer for Identity Transformation
    Transformer transformer = transformerFactory.newTransformer();
    // Make passed document the DOM source
    DOMSource source = new DOMSource(doc);
    // Make result file the Stream Result
    StreamResult result = new StreamResult(new FileOutputStream(resultFile));
    // Write the document by means of Identity Transformation
    transformer.transform(source, result);
    } catch (Exception exc) {
    exc.printStackTrace();
    Document to be serialized
    test.xml
    <?xml version="1.0"?>
    <!DOCTYPE test SYSTEM "test.dtd">
    <!-- This is a comment -->
    <Test>
    <TestElement>Test Data</TestElement>
    </Test>
    test.dtd
    <!-- DTD -->
    <!ELEMENT Test (TestElement)>
    <!ELEMENT TestElement (#PCDATA)>
    The serialized document looked like
    <?xml version = '1.0'?>
    <?#comment This is a comment ?><Test>
    <TestElement>Test Data</TestElement>
    </Test>
    First of all the DOCTYPE declaration was not present in the serialized document.
    Secondly the comments appeared in a wrong way, which even made it an invalid XML document.
    How do we get this to work?
    Thanks
    Sagar

    On 9.2.0.3.0 you can try dbms_xdb.deleteResource(Path,4)

  • Exchange XML document containing serialized DDIC objects

    Hi,
    Suppose you have an itab "z_table" with generic linetype. The table may contain any ddic structure or table.
    Furhter you want to exchange the itab "z_table" between the Systems A and B using XML.
    We are using the following code to serialize the itab "z_table" in system A:
      DATA: g_ixml TYPE REF TO if_ixml,
            g_stream_factory TYPE REF TO if_ixml_stream_factory,
            g_encoding TYPE REF TO if_ixml_encoding,
            ostream TYPE REF TO if_ixml_ostream.
      CONSTANTS: encoding TYPE string VALUE 'utf-8'.
      g_ixml = cl_ixml=>create( ).
      g_stream_factory = g_ixml->create_stream_factory( ).
      g_encoding = g_ixml->create_encoding(
        character_set = encoding
        byte_order = 0 ).
      ostream = g_stream_factory->create_ostream_xstring( string = ex_xml_string ).
      ostream->set_encoding( encoding = g_encoding ).
      CALL TRANSFORMATION id_indent
        SOURCE z_table = z_table
        RESULT XML xml_string
        OPTIONS data_refs = 'heap'
                xml_header = 'full'.
    And the following code to deserialize the itab in system B:
      CALL TRANSFORMATION id_indent
        SOURCE XML xml_string
        RESULT z_table = z_table.
    The serialization in System A creates an XML document containing <dic:z_structure> tags. If you now try to deserialize this document ("z_table")
    in System B, the deserialization fails in case z_table contains DDIC structures which are not known in system B.
    Is there any way to have the definition (e.g. type + length) of those ddic structures included in the XML document, so that
    a deserialization is possible even if the ddic structure is not known in system B? e.g. Rendered into a XML scheme, or directly as an
    attribute into the <dic:..> tag for instance?
    Any ideas are appreciated..
    Best regards,
    Georg

    Hello Raja,
    many thanks first for your answer. I tried the FM and got a table with the definition details I want.
    Unfortunately, I'm not really sure, how to continue working with the definition details. There are still some questions open:
    - How do I proficient include these table details into my xml with my original table z_table? Would it be possible to include the table details in a way, that a "call transformation" can easily deserialize my z_table with this table details?
    - How do I convert the lt_dfies table definition details back to a ddic object that I can use? Can this be done in memory only, so that I don't have to create real ddic objects on the target system?
    Many thanks and kind regards, Oliver<b></b><b></b>

  • Serializing a dom4j-Document to an XML

    Hello everybody,
    I'm trying to serialize a dom4j-Document that I created to an XML-document using an XMLWriter.
    The problem is, the Document got an element with a whitespace/blank as value (  <element> </element>)
    The xmlWriter trimms the blank and so the gets lost.
    How can I keep this whitespace in my XMLWriter?
    best regards
    Adnane
    Edited by: Adnane Elgoute on Jun 17, 2008 8:38 AM

    Hi Adnane,
    as I told you:
    a)
    convert the document to string
    b)
    OutputStream os = null;
    os.write(yourString.getBytes());
    Regards Mario

  • Embedding XSL in XML document

    Hi
    I am new to this particular forum. I had some query regarding embedding XSL .
    Can we embedd the XSL stylesheet in the XML document itself.
    I searched this forum and got some similar queries but the output isn't working. Can anyone put a working example.
    I have got the following XSL stylesheet:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <body>
    <table border="1" width="100%" cellpadding="1">
    <tr bgcolor="#FFFF99">
    <th style="font-family:arial unicode ms;font-size:100%" align="center">Serial number </th>
    <th style="font-family:arial unicode ms;font-size:100%" align="center">Site number </th>
    </tr>
    <xsl:for-each select="Master/RECORD">
    <xsl:if test="SR_NO &gt; 0">
    <tr>
    <td style="font-family:arial unicode ms;font-size:80%" align="right"><xsl:value-of select="SR_NO"/></td>
    <td style="font-family:arial unicode ms;font-size:80%" align="right"><xsl:value-of select="ACR_SNO"/></td>
    </tr>
    </xsl:if>
    </xsl:for-each>
    </table>
    </body>
    </xsl:template>
    </xsl:stylesheet>
    The XML document is as below:
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="archivingmaster.xsl"?>
    <Master>
    <RECORD>
    <SR_NO>1</SR_NO>
    <ACRSNO>1</ACR_SNO>
    </RECORD>
    <RECORD>
    <SR_NO>2</SR_NO>
    <ACRSNO>2</ACR_SNO>
    </RECORD>
    </Master>
    Thanks in advance
    Ameya.

    I have already gone through that link and searched for this on the net. But it doesn't seem to work on my Mozilla Firefox browser.
    Can anybody put a working example if possible.
    Thanks
    Ameya.

  • Filling tab of an XML document created by DOM

    have a problem with filling tab of an XML file created by DOM
    I used this code to create the document:
    public class DOMCreation {
    public void createDOM( String a, String b ) {
              Document doc = new DocumentImpl( null );
              // Il codice che segue � indipendente dal particolare parser utilizzato
              // Creazione dell'elemento root del documento, identificato dal tag <DOCUMENT>
              Element root = doc.createElement("DOCUMENT");
              doc.appendChild(root);
              // Creazione ed inserimento di un nodo
              Element element1 = doc.createElement("USERNAME");
              root.appendChild( element1 );
              // Creazione ed inserimento di un secondo nodo discendente di <DOCUMENT>
              root.appendChild( doc.createElement("PIN") );
    System.out.println( a );
    System.out.println( b );
              try {
                   serializeDocument( doc, new FileOutputStream("d:/doc.xml"));
              } catch (FileNotFoundException e) {}
    private static void serializeDocument(Document doc, OutputStream output) {
              try {
                   DOMSerializer ser = new XMLSerializer( output, null);
                   ser.serialize(doc);
              } catch (IOException e) {
                   System.err.println("I/O exception while serializing document: " + e.getMessage());
    }

    The code lines:
    System.out.println( a );
    System.out.println( b );
    had the purpose to check if these two parameters were passed by another procedure. These two parameters, however, represent the content to be filled in the tag of XML document created by DOM.
    About the other question on "what parser do you use", I'm using Apache's Xerces. However that's the "import" that I include in this procedure:
    import org.apache.xerces.dom.DocumentImpl;
    import org.apache.xerces.dom.NodeIteratorImpl;
    import org.apache.xml.serialize.*;
    import org.w3c.dom.*;
    import org.w3c.dom.traversal.*;
    import java.io.*;

  • Error while loading an XML document using a structured application

    Hi,
    I try to load an XML document using a structured application defined in the default structapps.fm
    My code is shown down, extracted from the FDK API code sample.
    Problem, I always have the same message :
    "Cannot find the file named e:\xml\AdobeFrameMaker10\file. Make sure that the file exists. "
    Where "e:\xml\AdobeFrameMaker10\" is my install directory.
    So I assume that frame try to find the structapps.fm file but does not find it.
    What else can it be ?
    Does anyone knowns how to achieve this simple task using extendScript ?
    Thanks for any comments, Pierre
    function openXMLFile(myLastFile) {
        var filename = myLastFile.openDlg("Choose XML file ...", "*.xml", false);
        if (filename != null) {
            /* Get default open properties. Return if it can’t be allocated. */
            var params = GetOpenDefaultParams();
            /* Set properties to open an XML document*/
            /*Specify XML as file type to open*/
            var i = GetPropIndex(params, Constants.FS_OpenAsType)
            params[i].propVal.ival = Constants.FV_TYPE_XML;
            /* Specify the XML application to be used when opening the document.*/
            i = GetPropIndex(params, Constants.FS_StructuredOpenApplication)
            params[i].propVal.sval = "myApp";
            i = GetPropIndex(params, Constants.FS_FileIsOldVersion)
            params[i].propVal.ival = Constants.FV_DoOK
            i = GetPropIndex(params, Constants.FS_FontNotFoundInDoc)
            params[i].propVal.ival = Constants.FV_DoOK
            i = GetPropIndex(params, Constants.FS_FileIsInUse)
            params[i].propVal.ival = Constants.FV_DoCancel
            i = GetPropIndex(params, Constants.FS_AlertUserAboutFailure)
            params[i].propVal.ival = Constants.FV_DoCancel
            /*The structapps.fm file containing the specified application must have
            already been read. The default structapps.fm file is read when FrameMaker is
            opened so this shouldn't be a problem if the application to be used is
            listed in the structapps.fm file.*/
            var retParm = new PropVals()
            var fileObj = Open(filename, params, retParm);
            return fileObj
        } else {
            return null;

    Pierre,
    Depending on the object "myLastFile", the method openDlg might not even exist (if the myLastFile object is not a File object, for instance). And I do not see any need for the myLastFile anyhow, as you are presenting a dialog to select a file to open. I recommend using the global ChooseFile( ) method instead. This will give you a filename as string in full path notation, or null when no file was selected in the dialog. I am not sure what your ExtendScript documentation states about the return value for ChooseFile, but if that differs from what I am telling you here, the documentation is wrong. So, if you replace the first lines of your code with the following it should work:
    function openXMLFile ( ) {
        var filename = ChooseFile ( "Choose XML file ...", "", "*.xml", Constants.FV_ChooseSelect );
    While writing this, I see that Russ has already given you the same advice. Use the symbolic constant value I indicated to use the ChooseFile dialog to select a single file (it can also be used to select a directory or open a file - but you want to control the opening process yourself). Note that this method allows you to set a start directory for the dialog (second parameter). The ESTK autocompletion also gives you a fifth parameter "helplink" which is undocumented and can safely be ignored.
    Good luck
    Jang

  • Problem replacing Null nodes with real values in XML documents...

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    Our friends in Java land are insisting on passing data between Java and PL/SQL using fairly small XML documents (don't ask). I then need to extract the input parameter values and pass them, on to the stored procedures that actually do the work. These return a result which needs to be returned to the java layer in the output XML document.
    Here is a cut down version of the input XML...
    <ParameterList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Parameter>
    <Id>1</Id>
    <Result xsi:nil="true"/>
    </Parameter>
    <Parameter>
    <Id>2</Id>
    <Result xsi:nil="true"/>
    </Parameter>
    </ParameterList>
    and this is an example of what I am expected to return...
    <ParameterList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Parameter>
    <Id>1</Id>
    *<Result>SUCCESS</Result>*
    </Parameter>
    <Parameter>
    <Id>2</Id>
    *<Result>WARNING</Result>*
    </Parameter>
    </ParameterList>
    i.e. I am expected to replace the value of the Result node with a string indicating the succes or otherwise of the underlying PL/SQL process.
    I am extracting the input values using the DBMS_XMLDOM functions and naively assumed that DBMS_XMLDOM.SETNODEVALUE could be used to update the value in the Result node - It didn't work so I resorted to reading the documentation which revealed that it will not work for a null node.
    Am I going to have to use XSLT to generate the output XML from the Input and incorprate the result? Or is there a simpler way?
    I have used XSLT in Oracle before and still have the nervous tick...

    Thanks A Non,
    With your suggestion and a bit of help from the w3schools.com xml dom tutorial I eventually managed to work out how to do this.
    Here is the code (with all my debug stuff in so it looks worse than it is...)
    create or replace
    PROCEDURE ExtractXMLValues (p_inXml IN CLOB ) IS
    l_string VARCHAR2(4000);
    l_value VARCHAR2(4000);
    l_DOM_doc dbms_xmldom.DOMDocument;
    l_DOM_node dbms_xmldom.DOMNode;
    l_new_DOM_node dbms_xmldom.DOMNode;
    l_new_element dbms_xmldom.DOMElement;
    l_new_DOM_nodevalue dbms_xmldom.DOMNode;
    l_value_Node dbms_xmldom.DOMNode;
    l_parameter_Node dbms_xmldom.DOMNode;
    --l_DOM_nodelist    dbms_xmldom.DOMNodeList;
    l_Result_DOM_node dbms_xmldom.DOMNode;
    BEGIN
    l_DOM_doc := dbms_xmldom.newDomDocument(p_inXml);
    l_DOM_node := dbms_xmldom.makeNode(l_DOM_doc);
    dbms_xmldom.writeToBuffer(l_DOM_node, l_string);
    dbms_output.put_line('1 ' || l_string);
    l_parameter_node := dbms_xslprocessor.selectSingleNode(l_DOM_node,'//Parameter');
    -- get the current values in the XML document for Id and Result
    l_Result_DOM_node := dbms_xslprocessor.selectSingleNode(l_DOM_node,'//Id');
    l_value_Node := dbms_xmldom.getFirstChild(l_Result_DOM_node);
    l_value := dbms_xmldom.getnodevalue(l_value_Node);
    dbms_xmldom.writeToBuffer(l_Result_DOM_node, l_string);
    dbms_output.put_line('2 ' || l_string || ' : ' || l_value);
    l_Result_DOM_node := dbms_xslprocessor.selectSingleNode(l_DOM_node,'//Result');
    l_value_Node := dbms_xmldom.getFirstChild(l_Result_DOM_node);
    l_value := dbms_xmldom.getnodevalue(l_value_Node);
    dbms_xmldom.writeToBuffer(l_Result_DOM_node, l_string);
    dbms_output.put_line('3 ' || l_string || ' : ' || l_value);
    -- create new Result node
    l_new_DOM_node      := dbms_xmldom.makenode(dbms_xmldom.createElement(l_DOM_doc, 'Result'));
    dbms_xmldom.writeToBuffer(l_new_DOM_node, l_string);
    dbms_output.put_line('4 New node : ' || l_string);
    -- create a value for it
    l_new_DOM_nodevalue := dbms_xmldom.makenode(dbms_xmldom.createtextnode(l_DOM_doc, 'SUCCESS'));
    dbms_xmldom.writeToBuffer(l_new_DOM_nodevalue, l_string);
    dbms_output.put_line('5 New node value : ' || l_string);
    -- add the value to the new Result node
    l_new_DOM_nodevalue := dbms_xmldom.appendchild(l_new_DOM_node,  l_new_DOM_nodevalue);
    dbms_xmldom.writeToBuffer(l_new_DOM_node, l_string);
    dbms_output.put_line('6 New node : ' || l_string);
    -- replace the old node with the new one
    l_Result_DOM_node := dbms_xmldom.replaceChild(l_parameter_node, l_new_DOM_node, l_Result_DOM_node);
    dbms_xmldom.writeToBuffer(l_parameter_node, l_string);
    dbms_output.put_line('6 parameter node : ' || l_string);
    dbms_xmldom.writeToBuffer(l_DOM_node, l_string);
    dbms_output.put_line('7 Updated document ' || l_string);
    dbms_xmldom.freeDocument(l_DOM_doc);
    END ExtractXMLValues;
    and the output...
    1 <ParameterList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Parameter>
    <Id>1</Id>
    <Result xsi:nil="true"/>
    </Parameter>
    </ParameterList>
    2 <Id>1</Id> : 1
    3 <Result xsi:nil="true"/> :
    4 New node : <Result/>
    5 New node value : SUCCESS
    6 New node : <Result>SUCCESS</Result>
    6 parameter node : <Parameter>
    <Id>1</Id>
    <Result>SUCCESS</Result>
    </Parameter>
    7 Updated document <ParameterList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Parameter>
    <Id>1</Id>
    *<Result>SUCCESS</Result>*
    </Parameter>
    </ParameterList>
    One question, why do the dbms_xmldom functions return the Old value? I was expecting the returned value to be the updated node.
    Edited by: Lone voice on May 14, 2009 11:24 AM

  • Performance issues with FDK in large XML documents

    In my current project with FrameMaker 8 I'm experiencing severe performance issues with some FDK API calls.
    The documents are about 3-8 MBytes in size. Fortmatted they cover 150-250 pages.
    When importing such an XML document I do some extensive "post-processing" using FDK. This processing happens in Sr_EventHandler() during the SR_EVT_END_READER event. I noticed that some FDK functions calls which modify the document's structure, like F_ApiSetAttribute() or F_ApiNewElementInHierarchy(), take several seconds, for the larger documents even minutes, to complete one single function call. I tried to move some of these calls to earlier events, mostly to SR_EVT_END_ELEM. There the calls work without a delay. Unfortunately I can't rewrite the FDK client to move all the calls that are lagging to earlier events.
    Does anybody have a clue why such delays happen, and possibly can make a suggestion, how to solve this issue? Thank you in advance.
    PS: I already thought of splitting such a document in smaller pieces by using the FrameMaker book function. But I don't think, the structure of the documents will permit such an automatic split, and it definitely isn't an option to change the document structure (the project is about migrating documents from Interleaf to XML with the constraint of keeping the document layout identical).

    FP_ApplyFormatRules sounds really good--I'll give it a try on Monday. Wonder how I could miss it, as I already tried FP_Reformatting and FP_Displaying at no avail?! By the way, what is actually meant with FP_Reformatting (when I used it I assumed it would do exactly what FP_ApplyFormatRules sounds to do), or is that one another of Lynne's well-kept secrets?
    Thank's for all the helpful suggestions, guys. On Friday I already had my first improvements in a test version of my client: I did some (not all necessary) structural changes using XSLT pre-processing, and processing went down from 8 hours(!) to 1 hour--Yeappie! I was also playing with the idea of writing a wrapper to F_ApiNewElementInHierarchy() which actually pastes an appropriate element created in a small flow on the reference pages at the intended insertion location. But now, with FP_ApplyFormatRules on the horizon, I'm quite confident to get even the complicated stuff under control, which cannot be handled by the XSLT pre-processing, as it is based on the actual formatting of the document at run-time and cannot be anticipated in pre-processing.
    --Franz

  • Parse and output XML document while preserving attribute order

    QUESTION: How can I take in an element with attributes from an XML and output the same element and attributes while preserving the order of those attributes?
    The following code will parse and XML document and generate (practically) unchanged output. However, all attributes are ordered a-z
    Example: The following element
    <work_item_type work_item_db_site="0000000000000000" work_item_db_id="0" work_item_type_code="3" user_tag_ident="Step" name="Work Step" gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_site="0000000000000000" last_upd_db_id="0" rstat_type_code="1">
    </work_item_type>is output as:
    <work_item_type gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_id="0" last_upd_db_site="0000000000000000" name="Work Step" rstat_type_code="1" user_tag_ident="Step" work_item_db_id="0" work_item_db_site="0000000000000000" work_item_type_code="3">
    </work_item_type>As you may notice, there is no difference in these besides order of the attributes!
    I am convened that the problem is not in the stylesheet.xslt but if you are not then it is posted bellow.
    Please, someone help me out with this! I have a feeling the solution is simple
    The following take the XML from source.xml and outputs it to DEST_filename with attributes in a-z order
    Code:
    private void OutputFile(String DEST_filename, String style_filename){
         //StreamSource stylesheet = new StreamSource(style_filename);
         try{
              File dest_file = new File(DEST_filename);
              if(!dest_file.exists())
                  dest_file.createNewFile();
              TransformerFactory tranFactory = TransformerFactory.newInstance();
              Transformer aTransformer = tranFactory.newTransformer();
              aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
              Source src = new DOMSource("source.xml");
              Result dest = new StreamResult(dest_file);
              aTransformer.transform(src, dest);
              System.out.println("Finished");
         catch(Exception e){
              System.err.print(e);
              System.exit(-1);
        }

    You can't. The reason is, the XML Recommendation explicitly says the order of attributes is not significant. Therefore conforming XML serializers won't treat it as if it were significant.
    If you have an environment where you think that the order of attributes is significant, your first step should be to reconsider. Possibly it isn't really significant and you are over-reaching in some way. Or possibly someone writing requirements is ignorant of this fact and the requirement can be discarded.
    Or possibly your output is being given to somebody else who has a defective parser which expects the attributes to be in a particular order. You could quote the XML Recommendation to those people but often XML bozos are resistant to change. If you're stuck writing for that parser then you'll have to apply some non-XML processing to your output to fix it up on their behalf.

  • Display xml documents - how to submit a feature request?

    Safari is useless when it comes to render raw xml documents. You have to view the actual source to see the xml.
    Is there an official way to submit a feature request for safari to apple? I would love to see something similar to what firefox does with xml. Safari is such a fast and nice browser, if it only could handle text/xml better...

    As you said Safari simply shows all xml element content concatenated together. But no tags or attribute values. If the ContentType in the http header is set to text/xml Firefox shows an xml tree that you can nicely browse. I think IE5+ and Opera do that too. It is important to set the right content type though. Here is an example that shows nice in FF, but is unreadable in Safari:
    http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=Herbar
    Sure you can look at the source code, but the xml might not be pretty printed.

  • Displaying XML Document in new browser window

    Hi,
    I have a hyperlink on my page. When I click on it, it will open a new IE window and display xml document.
    The new window is displaying some of the xml and at the end displaying the following:
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End element was missing the character '>'. Error processing resource 'http://localhost:28080/benchmark/faces/displayXMLDocu...
    However, I cut and paste the xml String where I write it to the HTTPServletResponse to XMLSPY and it displays correctly.
    Please let me know.
    Rgrds

    Here are the steps:
    1. I created page1 that has a hyperlink.
    2. Hyperlink property are set to display page2 in a new window. (popup).
    3. page2.prerender() method, I set the response to the following:
    public void prerender() {
    javax.faces.context.ExternalContext ec = this.getExternalContext();
    HttpServletResponse response = (HttpServletResponse)ec.getResponse();
    response.setHeader("Cache-Control","no-cache");
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Cache-Control","must-revalidate");
    response.setHeader("Cache-Control","max-age=0");
    response.setHeader("Pragma","no-cache");
    response.setHeader("Expires","0");
    response.setContentType("text/xml");
    response.setBufferSize(5000);
    String xmlString = getRequestBean1().getBookingPnrDetailsXML();
    try{
    xmlString="<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><test1>this is a test</test1><victor>Hello Victor</victor></root>";
    PrintWriter out = new PrintWriter(response.getOutputStream());
    log(xmlString);
    out.print(xmlString);
    }catch(IOException io){
    System.out.println("" + io.getMessage());
    io.printStackTrace();
    4.page2.jsp code is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
    <jsp:directive.page contentType="text/xml;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view/>
    <ui:page binding="#{displayXMLDocument.page1}" id="page1"/>
    <ui:html binding="#{displayXMLDocument.html1}" id="html1"/>
    <ui:head binding="#{displayXMLDocument.head1}" id="head1"/>
    <ui:link binding="#{displayXMLDocument.link1}" id="link1"/>
    <ui:body binding="#{displayXMLDocument.body1}" id="body1"/>
    <ui:form binding="#{displayXMLDocument.form1}" id="form1"/>
    </jsp:root>
    please let me know.
    Rgrds.

  • Error: No valid XML document received*_

    Hi All,
    We are connecting our CCMS system to NetWeaver J2EE engine on which E-Sourcing is running.
    For this we registered java component and hosts in cen.
    But we are getting error as : No valid XML document received
    Please can anyone tell me how to overcome this error.
    Thank you .
    Regards
    Mahesh

    Hi,
    Please re-read the answer from Marc carefully.  He was in the exact same situation as yours: 
    - Monitored system: NW CE 7.1
    - CEN: NW 7.01 (same as NW 7.0 EhP1)
    The link you posted is for CEN with NW 7.3 and monitored systems from NW 7.02 (and up).  Read the paragraph below the Caution sign:
    If you want to centrally monitor any system with a central monitoring system with release SAP NetWeaver 7.0, this procedure is not applicable. In this case, follow the procedure described in the newest Monitoring Setup Guide for SAP NetWeaver 7.0 instead. You can obtain the Monitoring Setup Guide at the Internet address service.sap.com/operationsnw70 in the Monitoring area.
    You should look for (and follow) the right Monitoring Setup Guide as mentioned.
    Regards,
    Dao
    Edited by: Dao Ha on Sep 19, 2011 10:38 AM

  • How to insert data into a table from an xml document

    using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
    if i use the xmlgen.insertXML(....)
    requires a CLOB file, which i dont have, only the xml doc.
    Cant i insert directly from the doc to the table?
    the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
    Isnt there any other way?

    Your question is little perplexing.
    If you're using XML SQL Utility from
    the commandline, just use putXML.
    java OracleXML putXML
    null

Maybe you are looking for

  • Generic extraction- creation of data source

    hi gurus, I am creating a customized table which has both quantity and currency fields. i have given both the reference fields as well. Here the reference table used for quantity is ekko and the field is meins. and the reference table used for curren

  • Need help with SQLite

    I have a SQLite database from with I want to display my results in a form in a Flash movie. I know how to display these results in a datagrid, but I want to display them in seperate texfields. Can anyone help ? My current code for displaying results

  • How to use VirtualizeCurrentThread()?

    Hi, In this article, it's mentioned that you can use the VirtualizeCurrentThread() and CurrentThreadIsVirtualized() functions implemented in the AppEntSubsystems32.dll, however, the function specification (calling convention, etc.). Can anyone provid

  • I Tunes 10.5 Problem

    Hallo habe das Itunes 10.5 heruntergeladen und komme nicht mehr in den I Tunes Shop.Ferner installierte ich auf meinem I Phone 4 das Betriebssystem 5.0.Jetzt ist das Backup nicht mehr da und kann auch nicht mehr synchronisieren.Sämtliche gekauften AP

  • How to replace original photos?

    I am helping my mom set up her iPad. We bought her a used one, generation 1 with ios 5. Every photo editor we have tried saves edited photos as a new photo. It's making tons of copies of photos that she just doesn't need. Even a simple edit, like rot