DOM nodes serialized using LSSerializer.writeToString() looses formatting

Hi All,
I am trying to serialize DOM nodes into a serialized string, and facing the below problem,
where I am loosing all the formatting ( new lines, spaces ) in the process.
Basically here is how the whole process can be outlined:
1. I take a formatted xml request sample String:
<Batch>
<Request1>
<Content>abc</Content>
</Request1>
<Request2>
<Content>efg</Content>
</Request2>
</Batch>
2. Feed it into a Dom parser to parse the xml string and convert it into DOM objects
public void parse( String xmlModel ) throws Exception {     
          if( xmlModel == null ){
               throw new Exception( "No xml model string was supplied for parsing");
          else{
               this.xmlModel = xmlModel;
          // Now try building the document
          try{
               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
               dbf.setNamespaceAware(true);
               //parse the xml file.
               DocumentBuilder parser = dbf.newDocumentBuilder();
               parser.setErrorHandler(new ErrorHandlerImpl());
               // ByteArrayInputStream extends from inputstream
               InputStream is = new ByteArrayInputStream(xmlModel.getBytes());
               setDoc(parser.parse(is));
( Continued in 3 .... )
3. Then once the Document Object Model is ready, I try to serialize the object
using the LSSerializer API interface to convert the DOM Node to an XML string,
as below in the method implementation continued from above ..
( Continued from above here .... )
               //write the output to the specified String variable
               DOMImplementation impl = doc.getImplementation();
               DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS","3.0");
               LSSerializer writer = implLS.createLSSerializer();
               writer.getDomConfig().setParameter("error-handler",new DOMErrorHandlerImpl());
               // This is to suppress the xml header, with version and the encoding being automatically generated
               writer.getDomConfig().setParameter("xml-declaration", false);
4. Assume the Node object got from the main DOM object is represented as "node"
and if we try
// Basically calling - LSSerializer.writeToString( Node node )
               String xmlSerialized = writer.writeToString(node);
System.out.println(xmlSerialized);
The output would look like this:
<Batch> <Request1> <Content>abc</Content> </Request1> <Request2> <Content>efg</Content> </Request2> </Batch>
Basically lost all the formatting.
Can someone suggest how to fix this ?
Thanks

I'm having the same problem. I think it's a bug with the LSSerialized. My code:
    Document doc = myElement.getOwnerDocument();
    ProcessingInstruction pi = doc.createProcessingInstruction(
        "xml-stylesheet",
        String.format(" type=\"%s\" href=\"%s\"", type, href));
    doc.insertBefore(pi,doc.getFirstChild());returns the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<windsor><queen favorite-dog="corgis"><name>Elizabeth</name><count>II</count></queen></windsor><?xml-stylesheet  type="text/xsl" href="mystylesheet.xsl"?>Interestingly, if I print out the nodes in order, using this code:
NodeList nl = doc.getChildNodes();
    for(int i = 0 ; i < nl.getLength() ; i++) {
      System.out.println("NODE: " + nl.item(i));
    }They are in the correct order:
NODE: [xml-stylesheet:  type="text/xsl" href="mystylesheet.xsl"]
NODE: [windsor: null]I think I'm going to have to switch to using the transform framework for output serialization. sigh

Similar Messages

  • Problem of using "org.w3c.dom.Node" class

    I try to use removeChild(child) method of "org.w3c.dom.Node" object. it don't work.
    is it better to do child=null;

    child=null does nothing to the dom object
    removeChild works fine. You're just confused.
    You would need more info to have any chance of fixing the problem.

  • I'am having problem with a graph property node by using format & precision

    I would like to display an amount of data in a waveform graph and to choose the X scale to display absolute time (whitout date information) or scaled decimal value.
    Absolute time is a must because the scaling should reflect the acquisition time and not only a value in hour, minute and second.
    Using the property node I can choose between 10 differents formats (0-Decimal, 1-Scientific, 2-Engineering, 3-Binary, 4-Octal, 5-Hexadecimal, 6-Relative Time, 7-Time and Date, 8-SI, and 9-Custom).
    Format 7 - Time and Date should be a good choice but LabVIEW set automatically system time AND system date without any possibilities to change anything.
    Trying format 9 - Custom ends everytime with error 1077 (invalid property value).
    Any help to explain me how to use the format Custom or to give me a solution to switch between time (no date) and decimal scaling is appreciate.
    Thank 

    In addition to the Xscale.Format property node, you also need to set the XScale.FormatString (see a little below the Format entry).
    Use %<%.0X>T as format string.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to add node value using org.w3c.dom.Document?

    Hi ,
    I'm using org.w3c.dom.Document to deal with xml files. I could successfully add nodes , and their attributes. However I could not add a value of the node. (e.g. <myNode>I couldn't add this value</myNode>)
    does anyone know how to deal with this?
    I tried subNode.setNodeValue("the value i can't add"); whereas the subNode is an instance of org.w3c.dom.Node... i know this is interface i of course used the concrete class
    org.apache.crimson.tree.ElementNode
    but when I used the subNode.getNodeValue() i simply got null?
    can u plz help me?
    thanks in advance

    Reading the API documentation for the Node interface might help. At least you wouldn't be surprised when the results are exactly what the documentation says they will be.
    What would really help would be forgetting the idea that an Element can have a value. Text nodes have values, though, so create a Text node and make it the child of the Element node.

  • "XSL Error: Cannot use a DTMLiaison for a input DOM node"

    This code:
    Writer writer = new StringWriter();
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    // Note: event.getDocument() returns a
    // org.apache.xerces.dom.DocumentImpl
    // sourced from xlms.jar
    processor.process(new XSLTInputSource(event.getDocument()),
    new XSLTInputSource(new FileReader(GDS_XSLT_STYLESHEET)),
    new XSLTResultTarget(writer));
    Gives this stacktrace:
    XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a weblogic.apache.xalan.xpath.xdom.XercesLiaison
    instead!
    XSL Error: SAX Exception
    weblogic.apache.xalan.xslt.XSLProcessorException:
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1756)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1648)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:876)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:600)
    1. All XML/XSLT classes are being sourced from weblogic.jar or xmlx.jar
    2. Both jar files come from the WLS installation (WLS6.0 + SP2)
    3. There are no other XML class providers on my class path
    4. This is a standalone application, not running within WLS; I'm using weblogic
    jarfiles here purely so I use the same XML implementation both inside and outside
    WLS. Is this a sensible approach?
    Any help, anyone?

    All works fine in WLS6.1, with this extra code:
    System.setProperty("javax.xml.transform.TransformerFactory",
    "weblogic.apache.xalan.processor.TransformerFactoryImpl");
    (or you could use -D)
    No longer concerned; we've moved off WLS6.0
    "Simon Spruzen" <[email protected]> wrote:
    >
    Interestingly, expanding the code to (the very verbose):
    Document sourceDocument = event.getDocument();
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    StringWriter source = new StringWriter();
    XMLSerializer sourceSerializer = new XMLSerializer(source, new OutputFormat(sourceDocument));
    sourceSerializer.asDOMSerializer();
    sourceSerializer.serialize(sourceDocument.getDocumentElement());
    StringWriter output = new StringWriter();
    processor.process(new XSLTInputSource(source.toString()),
    new XSLTInputSource(new FileReader(GDS_XSLT_STYLESHEET)),
    new XSLTResultTarget(output));
    (i.e. document -> string -> transform -> string)
    works just fine, but this code is far too long-winded for me to be happy
    with.
    (Note that one of XSLTInputSource's ctors does take a Node, so I'm assuming
    that
    it should be perfectly safe to pass a Document here)
    (Note also, that for various reasons at the moment, using JAXP's transformer
    factory
    is difficult for us)
    "Simon Spruzen" <[email protected]> wrote:
    This code:
    Writer writer = new StringWriter();
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    // Note: event.getDocument() returns a
    // org.apache.xerces.dom.DocumentImpl
    // sourced from xlms.jar
    processor.process(new XSLTInputSource(event.getDocument()),
    new XSLTInputSource(new FileReader(GDS_XSLT_STYLESHEET)),
    new XSLTResultTarget(writer));
    Gives this stacktrace:
    XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a weblogic.apache.xalan.xpath.xdom.XercesLiaison
    instead!
    XSL Error: SAX Exception
    weblogic.apache.xalan.xslt.XSLProcessorException:
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1756)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1648)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:876)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:600)
    1. All XML/XSLT classes are being sourced from weblogic.jar or xmlx.jar
    2. Both jar files come from the WLS installation (WLS6.0 + SP2)
    3. There are no other XML class providers on my class path
    4. This is a standalone application, not running within WLS; I'm using
    weblogic
    jarfiles here purely so I use the same XML implementation both inside
    and outside
    WLS. Is this a sensible approach?
    Any help, anyone?

  • Unexpected behaviour from LSSerializer.writeToString

    I was trying to use LSSerializer to serialize a fragment of a larger XML document when I ran into some odd behaviour from Oracle's implementation.
    This sample code shows LSSerializer being used to write a org.w3c.dom.Element XML fragment in both Oracle and Xerces:
    <pre>
    import java.io.ByteArrayInputStream;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.ls.DOMImplementationLS;
    import org.w3c.dom.ls.LSSerializer;
    public class Test
    public static final String xml = "&lt;foo>&lt;bar>abc&lt;/bar>&lt;baz>xyz&lt;/baz>&lt;/foo>";
    public static void main(String[] args) throws Exception
    // Oracle
    System.out.println("Oracle LSSerializer:");
    test(new oracle.xml.jaxp.JXDocumentBuilderFactory());
    System.out.println();
    // Xerces
    System.out.println("Xerces LSSerializer:");
    test(new com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl());
    private static void test(DocumentBuilderFactory fac) throws Exception
    DocumentBuilder b = fac.newDocumentBuilder();
    Document d = b.parse(new ByteArrayInputStream(xml.getBytes()));
    Element e = d.getDocumentElement();
    System.out.println("Document root element: " + e.getNodeName());
    DOMImplementationLS di = (DOMImplementationLS) d.getImplementation();
    LSSerializer ser = di.createLSSerializer();
    System.out.println(ser.writeToString(e));
    </pre>
    Here's the output:
    <pre>
    Oracle LSSerializer:
    Document root element: foo
    &lt;bar>abc&lt;/bar>&lt;baz>xyz&lt;/baz>
    Xerces LSSerializer:
    Document root element: foo
    &lt;?xml version="1.0" encoding="UTF-16"?>
    &lt;foo>&lt;bar>abc&lt;/bar>&lt;baz>xyz&lt;/baz>&lt;/foo>
    </pre>
    As you can see, Oracle's LSSerializer implementation serializes the children of the org.w3c.dom.Element, but not the element itself.
    It's not hard to work around, but it really doesn't seem like the correct behaviour. It's certainly doesn't behave the way a reasonable developer would expect it to.

    The XDK 10g implementation is slightly different from the Xerces implementation.
    In XDK 10g, the node previous to the node to be output should be specified in the
    writeToString() method.
    Also in XDK 10g, SHOW_ELEMENT does not output the element text, in Xerces the element text is output.
    Refer
    http://www.oracle.com/technology/pub/notes/technote_dom.html

  • RE: (forte-users) XMLParser-Node : Serializing parts of aDOM across par

    I managed to solve this problem with the help of
    Sanjeev Sondur and Girish Nair from Sun.
    The Solution suggested is as follows :
    Whenever a node is supposed to passed as a parameter
    for an inter-partition call. We have marshal and
    UN-Marshalling :
    - Create a new document.
    - Clone the node in the context on the new document
    - Append the node to the new document
    - Serialize the document into a MemoryStream which is
    a attribute of the object (SerializedNode) that
    is passed in Lieu of a Node.
    - On the other end UnMarshall by DeSeralizing the Document
    and then reading the node.
    Code Follows :
    SerializedNode::SerializeNode(pNode);
    NewDoc : document = new();
    lNode : node;
    if pNode <> nil then
    -- This clones the node from an old document and creates it
    -- in the context of the new document.
    lNode = NewDoc.ImportNodeFromDocument(pNode, deep = true);
    -- You can then attach to the any part of DOM (I am using
    child of root)
    NewDoc.appendchild(lNode);
    end if;
    -- _mStream is MemoryStream
    mStream.Open(Framework.SPAM_WRITE, IsBinary = TRUE);
    _mStream.seek(0);
    _mStream.WriteSerialized(NewDoc);
    _mStream.close();
    On the other end I Unmarshall it
    SerializedNode::GetNode()
    mStream.Open(Framework.SPAM_READ, IsBinary = TRUE);
    _mStream.seek(0);
    NewDoc : document = (Document)(_mStream.ReadSerialized());
    lNode : node = NewDoc.getFirstChild();
    if lNode = NIL then
    task.lgr.putline(' In GetNode : Node was NIL');
    end if;
    return lNode;
    Note : This can use used for read-only access to parts of the DOM.
    across partitions.
    Thanks to all who responded.
    Vivek Shetty
    vivekvi-corp.com vivek.shettyLibertyMutual.com
    978-884-9942 (cell) 978-750-3639 x 202 (Liberty Mutual)
    -----Original Message-----
    From: Shetty, Vivek [mailto:Vivek.ShettyLibertyMutual.com]
    Sent: Thursday, December 21, 2000 10:04 AM
    To: 'forte-userslists.xpedior.com'
    Subject: (forte-users) XMLParser-Node : Serializing parts of a DOM
    across partitions
    I am modeling an Insurance-Policy as a XML document.
    One of my requirement was to pass pieces of this Policy (Node)
    to a service object for processing.
    I have discovered that the Node cannot be serialized across partitions.
    I can serialize the whole document using the exportDocument and send
    it across the partition and import it on the other end. This is fine when
    large pieces of the document have to be sent over.
    When smaller pieces of this information has to sent to a service object,
    I was planning to create a new document, extract the required nodes
    from the old document create in the new document and send the
    new document (which is a subset) across.
    I am having problems extracting a node from one document and
    creating it another document.
    I have tried node.clonenode, document.importnodefromdocument without much
    success.
    I have a choice of writing a method that creates a structure in the new
    document by
    recursively navigating the old tree and creating new nodes in the new
    document from scratch.
    Have any of you faced similar situations and come up with a more elegant
    solution.
    Please share.
    Thanks
    Vivek Shetty
    vivekvi-corp.com vivek.shettyLibertyMutual.com
    978-884-9942 (cell) 978-750-3639 x 202 (Liberty Mutual)
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

  • Cost of creating org.w3c.dom.Node

    I am trying to create an xml of cached data at run time. I need to know if this would increase the response time considerably ..?
    Is there any documents which talk about the cost of creating nodes(e.g.within loops) ..?
    public Node createnode(Document d, String node_name, int node_value) {
    org.w3c.dom.Node temp_element_node, temp_text_node;
    temp_element_node = d.createElement(node_name);
    temp_text_node = d.createTextNode(node_name);
    temp_text_node.setNodeValue(node_value + "");
    temp_element_node.appendChild(temp_text_node);
    return temp_element_node;
    Has anybody implimented a pool of nodes(like pool of database connections). Any information is appreciated!

    It would certainly depend somewhat on which parser you were using, but i can't imagine it would be any more costly than any other type of object.

  • Casting a org.w3c.dom Node to a org.dom4j Node

    Does anybody know how I can cast (convert) a w3c.dom Node to a dom4j Node?
    If I just trying casting the w3c node "(org.dom4j.Node)" it throws an exception...

    I have a org.w3c.dom.Node after calling HttpUnit's getDOMSubtree() method.
    Now I would like to change that Node to an org.dom4j.Node so i can use dom4j's Node.valueOf() method on it.
    Any idea how?

  • DOM Node

    Suppose i parsed in the following XML file using DOM. How can i GET the name values under the first "food" and display them(system.out.println)
    and how can i store that value in a variable so that i can reference it elsewhere?? how about the second "food" type? third?
    how can i extract that information?
    what if our menu contains 10 food types?
    how can i store them?
    code examples please. THANKS
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <!-- Edited with XML Spy v2006 (http://www.altova.com)
    -->
    - <breakfast_menu>
    - <food>
    <name>Belgian Waffles</name>
    <price>$5.95</price>
    <description>two of our famous Belgian Waffles with plenty of real maple syrup</description>
    <calories>650</calories>
    </food>
    - <food>
    <name>Strawberry Belgian Waffles</name>
    <price>$7.95</price>
    <description>light Belgian waffles covered with strawberries and whipped cream</description>
    <calories>900</calories>
    </food>
    - <food>
    <name>Berry-Berry Belgian Waffles</name>
    <price>$8.95</price>
    <description>light Belgian waffles covered with an assortment of fresh berries and whipped cream</description>
    <calories>900</calories>
    </food>
    - <food>
    <name>French Toast</name>
    <price>$4.50</price>
    <description>thick slices made from our homemade sourdough bread</description>
    <calories>600</calories>
    </food>
    - <food>
    <name>Homestyle Breakfast</name>
    <price>$6.95</price>
    <description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description>
    <calories>950</calories>
    </food>
    </breakfast_menu>

    you can create node by using Document object as below
    Document doc = ....
    and then
    document.createElement(String name) which returns Element (a subclass of Node)

  • Unmarshalling a DOM node to an XML file with JAXB

    I'm trying to unmarshall a DOM node to an XML file using JAXB. However I keep receiving a NullPointerException. This only seems to occur when I create the DOM Node from scratch. The stack trace looks like the following:
    java.lang.NullPointerException
            at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.startElement
    (SAXUnmarshallerHandlerImpl.java:87)
            at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:109)
            at com.sun.xml.bind.unmarshaller.DOMScanner.parse(DOMScanner.java:64)
            at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(Unmarshaller
    Impl.java:149)
            at Main.main(Main.java:103)(If I unmarshal an XML file into a DOM node, I can successfully marshall the DOM node out to a new XML file using JAXB without error.)
    Any insight into what I am doing wrong would be greatly appreciated!
    Sample code and XSD follow...
    Sample Code:
    import itemlistsample.*;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.bind.JAXBContext;
    import javax.xml.bind.JAXBException;
    import javax.xml.bind.Marshaller;
    import javax.xml.bind.Unmarshaller;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.Text;
    public class Main
      public static void main(String[] args)
          try
              JAXBContext jc = JAXBContext.newInstance( "itemlistsample" );
              Unmarshaller u = jc.createUnmarshaller();
              * Set up DOM Node Document Object.
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              dbf.setNamespaceAware(true);                   
              DocumentBuilder db = dbf.newDocumentBuilder(); 
              Document doc = db.newDocument();
              System.out.println();
              System.out.println();
              System.out.println("Create a DOM Node and unmarshall to an XML file");
              * Generate elements within DOM document
              Element itemListElt = (Element)doc.createElement("item_list");
              Element itemInfo = (Element)doc.createElement("item_info");
              Element name = (Element)doc.createElement("name");
              Element price = (Element)doc.createElement("price");
              * 3-Ring Binder @ 4.99
              name.appendChild(doc.createTextNode("3-Ring Binder"));
              itemInfo.appendChild(name);
              price.appendChild(doc.createTextNode("4.99"));
              itemInfo.appendChild(price);
              itemListElt.appendChild(itemInfo);
              * Large Paper Clips @ 1.23
              itemInfo = (Element)doc.createElement("item_info");
              name = (Element)doc.createElement("name");
              price = (Element)doc.createElement("price");
              name.appendChild(doc.createTextNode("Large Paper Clips"));
              itemInfo.appendChild(name);
              price.appendChild(doc.createTextNode("1.23"));
              itemInfo.appendChild(price);
              itemListElt.appendChild(itemInfo);
              doc.appendChild(itemListElt);
              * Display DOM document as a sanity check
              itemListElt = doc.getDocumentElement();
              System.out.println(itemListElt.getTagName());
              NodeList nl = itemListElt.getElementsByTagName("item_info");
              traverse("  ", nl.item(0));
              * Use JAXB to unmarshal the DOM document into
              * an instance of the generated JAXB class for
              * the root element.  Stack trace occurs here!
              ItemListType il = (ItemListType)u.unmarshal(doc);
              * Marshal to an XML file
              Marshaller m = jc.createMarshaller();
              m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
              m.marshal( il, new FileOutputStream("item_new.xml") );
          catch (Exception e)
         e.printStackTrace();
      public static void traverse(String indent, Node n)
        if (n != null)
          if (n.getNodeName() != null)
            System.out.println(indent + n.getNodeName());
            traverse(indent + "  ", n.getFirstChild());
          if (n.getNodeValue() != null)
            System.out.println(indent + n.getNodeValue());
          traverse(indent, n.getNextSibling());
    }Sample XSD:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:element name="item_list" type="ItemListType"/>
         <xsd:complexType name="ItemListType">
              <xsd:sequence>
                   <xsd:element name="item_info" type="ItemInfoType" maxOccurs="unbounded"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="ItemInfoType">
              <xsd:sequence>
                   <xsd:element name="name" type="xsd:string"/>
                   <xsd:element name="price" type="xsd:double"/>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>

    Modified schema
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="item_list">     
    <xsd:complexType>          
    <xsd:sequence>               
    <xsd:element ref="item_info" maxOccurs="unbounded"/>     
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="item_info">
         <xsd:complexType>          
    <xsd:sequence>               
    <xsd:element name="name" type="xsd:string"/>     
         <xsd:element name="price" type="xsd:double"/>     
         </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

  • Calculated Percentage Columns in Pivot Table loose formating in Excel

    I have a simple report built using pivot table ( OBIEE 11.1.1.5.0)
    1 Metric and 1 dimension using pivot table. and I duplicated the metric column and change it to % column.(Show data as % of column). SO far so good. Below is the snapshot
    http://tinypic.com/r/2s14xa9/7
    Now i download the report in excel and all the % values are messed up . Below is how it looks
    http://tinypic.com/r/bede90/7
    I tried messing with data formats etc..nothing works.. I cannot add a custom column format to the metric column since it will impact the derived % column.
    Is this a bug ?Any pointers ..
    Thanks

    Hi,
    Follow up this SR:
    SR 3-5060435331: Calculated Percentage Columns in Pivot Table loose formating in Excel
    Workaround: (not sure may be give a try)
    also give a try like below one then try to download it may work.
    In that % column -->add the below statement in the Custom CSS section of the column properties:
    mso-number-format:"\@"
    Refer snapshot here:
    http://i53.tinypic.com/a09kqv.jpg
    This will treat the data in the column as text while downloading to excel, hence retaining any leading or trailing spaces.
    Thanks
    Deva

  • Error converting DOM nodes into SOAP nodes

    Hi,
    i am doing an http call using http binding activity in oracle soa suite 11g.The http call requires some header information.When I pass the header information through headers in invoke activity and invoke the http call,I get an error " Error converting DOM nodes into SOAP nodes".What might be the reason and how to solve it.
    Naresh

    Hello,
    It appears your code is trying to repeat messagePart itself. Split Joins strictly adheres to a WSDL definition for incoming and outgoing messages.
    Instead of repeating <RootElement> which is defined as single occurance in your message definition within WSDL, you should find a way to tweak the WSDL to have "repetitive node which will become single message after split" within 1 Root element.
    This will call for having need of implementing transformation within split join based on need of target input message. Below is the example:
    WSDL contains:
    <wsdl:message name="inputMessageName">
         <wsdl:part name="partInput" element="rootElement"/>
    </wsdl:message>
    What your current xml structure is(please note how message itself is repeating below while it has been defined as single in wsdl, unfortunately there is nothing maxOccurs for message in WSDL definition , although you can define multiple parts but that is not case here):
    <soap:Body>
    <rootElement>
    </rootElement>
    <rootElement>
    </rootElement>
    <rootElement>
    </rootElement>
    </soap:Body>
    What Split-Join expects(If you have existing wsdl then you need to tweak it to conform to below kind of structure then use transformation within split join to convert it into correct xml structure for outgoing):
    <soap:Body>
    <rootElement>
         <repetitiveElementSpecificToIndividualSplitRequest/>
         <repetitiveElementSpecificToIndividualSplitRequest/>
         <repetitiveElementSpecificToIndividualSplitRequest/>
    </rootElement>
    </soap:Body>
    I hope this helps.
    Regards,
    Ankit

  • Soft-restart of Java node by  using command line utility

    Hello,
    Could anyone advise whether there is a way to soft-restart the java node by using a command line utility (if there is one)?
    I would like to script to run in unix.
    Kind regards,
    Murad.

    Thank you for all your reply.
    Does Jcmon issue soft-restart?
    We have problem with Veritas Cluster. When there failover occurs, Java nodes appears to be online when we check from SMICM, but in fact it looses connection to the central instance. We have to issue a soft-restart for each java node to create connection again. It is a known bug and this only can be fixed by using replicated enqueue server. This only available in SP, which we can not apply right now. What I want to do is to create a script to automate the soft-restart which will be run just after failover.
    Thanks,
    Murad

  • ORA-31185 DOM NODES DO NOT BELONG TO THE SAME DOCUMENT

    Hi all,
    I developed an Oracle function that returns a XMLTYPE. In this function, I first created a node <ROOT> and I would like to append children nodes to this root node.
    To create children nodes I loop on a cursor and each iteration of this loop "build" a XMLTYPE node. I would like append this XMLTYPE node to the root node but for now I get the ORA-31185 error !
    Here is the code of my function (simplified version (without use of cursor)):
    CREATE OR REPLACE
    FUNCTION GET_MEDOC2 RETURN XMLTYPE IS
          parent_document DBMS_XMLDOM.DOMDOCUMENT;
       parent_rootnode DBMS_XMLDOM.DOMNODE;
       child_document  DBMS_XMLDOM.DOMDOCUMENT;
       child_rootnode  DBMS_XMLDOM.DOMNODE;
       rootXML XMLTYPE;
       subXML XMLTYPE;
       countLOOP NUMBER;
    BEGIN
        SELECT XMLELEMENT("ROOT") INTO rootXML FROM DUAL;
        parent_document := DBMS_XMLDOM.newDOMDocument(rootXML);
        parent_rootnode := DBMS_XMLDOM.makeNode(DBMS_XMLDOM.getDocumentElement(parent_document));
         FOR countLOOP IN 1..10 LOOP
            SELECT XMLELEMENT("CHILD", countLOOP) INTO subXML FROM DUAL;
            child_document  := DBMS_XMLDOM.newDOMDocument(subXML);
            child_rootnode  := DBMS_XMLDOM.makeNode(DBMS_XMLDOM.getDocumentElement(child_document));   
            child_rootnode := DBMS_XMLDOM.appendchild(parent_rootnode, child_rootnode);  
         END LOOP;
         RETURN rootXML;
    END GET_MEDOC2;When I execute the following :
    SELECT GET_MEDOC2() FROM DUAL;I get the beautiful ORA-31185 DOM NODES DO NOT BELONG TO THE SAME DOCUMENT
    What I expect is an XML like this :
    <ROOT>
        <CHILD>1</CHILD>
        <CHILD>2</CHILD>
        <CHILD>3</CHILD>
        <CHILD>4</CHILD>
        <CHILD>5</CHILD>
        <CHILD>6</CHILD>
        <CHILD>7</CHILD>
        <CHILD>8</CHILD>
        <CHILD>9</CHILD>
        <CHILD>10</CHILD>
    </ROOT>Can someone help me please ? (I'm on Oracle 10.1.0.5.0)
    Thanks

    Hi,
    I get the beautiful ORA-31185 DOM NODES DO NOT BELONG TO THE SAME DOCUMENTYou need function importNode (or adoptNode) to copy nodes across different documents.
    But, do not use DOM manipulation in this case.
    A single query using SQL/XML functions is certainly simpler and more performant :
    SELECT XMLElement("ROOT",
             XMLAgg(
               XMLelement("CHILD",
                 XMLForest(
                   empno
                 , ename
               ) order by empno
           ) as result
    FROM (
      -- your query goes here, e.g. :
      SELECT empno, ename
      FROM scott.emp
    <ROOT>
      <CHILD>
        <EMPNO>7369</EMPNO>
        <ENAME>SMITH</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7499</EMPNO>
        <ENAME>ALLEN</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7521</EMPNO>
        <ENAME>WARD</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7566</EMPNO>
        <ENAME>JONES</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7654</EMPNO>
        <ENAME>MARTIN</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7698</EMPNO>
        <ENAME>BLAKE</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7782</EMPNO>
        <ENAME>CLARK</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7839</EMPNO>
        <ENAME>KING</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7844</EMPNO>
        <ENAME>TURNER</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7900</EMPNO>
        <ENAME>JAMES</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7902</EMPNO>
        <ENAME>FORD</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7934</EMPNO>
        <ENAME>MILLER</ENAME>
      </CHILD>
    </ROOT>

Maybe you are looking for

  • Unable to display the pricing conditions for a product.

    Hi All,     I have created a product with help of function modules.The problem is that i am able to populate the pricing conditions data into internal table,but the pricing conditions  is not being displayed in the Masterdata->Products-> Maintain Pro

  • Trying to capture audio from the computer output.

    I'm trying to figure out how to capture the sound output, and either record it as a .wav, .mp3, or garage band track. The end goal(s): 1. Full screen video and audio capture -- for example, capture a window as a video, and any sound effects generated

  • SMP SAP Work Manager 6.1 multi language

    Hi all, we have installed SMP 3.0 SP5 with SAP Work Manager 6.1. We would like to use multi-language functionality but field labels do not translate after our configuration changes. We have created "localization" folder under "server\configuration\co

  • Reconcilation procedure

    hi  friends can  anybody  pls  come up with what is "<b>reconcilation</b>" and <b>standard procedure</b> to do  reconcilation thanks in advance venkat

  • Cyrillic font in google and some other sites like Wikipedia are looking different in Win XP and Win 7

    Good day, gents. Yesterday I installed 4 beta on my desktop after succesfull using it on laptop. But when i opened google (and some other sites) i found that fonts are looking different with the same settings. Here screens: http://i52.tinypic.com/33x