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.*;

Similar Messages

  • Parse XML document ,create table according to tags &  load data to  table

    Hi All!
    I have one of the most common problem, one faces when dealing with xml stuff and oracle.I get xml documents, with each file having different tags.I want to write a pl/sql procedure such that, the xml file is parsed, a table is created with the tag names becoming the column names and all the nodes' data get inserted into the table as rows.I am using oracle 10g.
    I read a thread at the following url:
    Parse XML and load into table
    But did not get much of it.
    Can anybody please tell me how to accomplish this.
    Thanking in advance.
    Regards,
    Deepika.

    Why do people have such an aversion to the XML DB forum for XML questions...
    See FAQ for XML DB forum here: XML DB FAQ
    Explains all about getting XML into tables in the database.

  • Problem with XML document created by JDBC Sender adapter

    We are using a sender JDBC adapter to publish data out of a DB2 table.  The message generated by the XI sender adapter seems to have 2 extra characters that break our mapper.  You can see the characters (the dashes on lines 2 and 4) in the XML document that I copied from message monitoring.  Once I remove these dashes and test the mapper in test mode, it works.  If I test with the dashes, the mapper fails. Has anybody else seen this issue?
    Regards,
    Ivailo
      <?xml version="1.0" encoding="utf-8" ?>
    - <ns:CUSTOMER_SCOPE xmlns:ns="http://com.gatx/xi/RCRepairEstimate">
    - <row>
      <CM_CUST_GROUP_CODE>2915</CM_CUST_GROUP_CODE>
      <CM_CUST_SUB_CODE>2</CM_CUST_SUB_CODE>
      <CM_CUST_ID />
      <CM_TERMS>30</CM_TERMS>
      <CM_CUST_SHIPTO_GRP>2915</CM_CUST_SHIPTO_GRP>
      <CM_CUST_SHIPTO_SUB>2</CM_CUST_SHIPTO_SUB>
      <CM_BILL_NAME>GATX RAIL/CANADA</CM_BILL_NAME>
      <CM_BILL_ADDR1>540 5TH AVENUE SW SUITE 1225</CM_BILL_ADDR1>
      <CM_BILL_ADDR2 />
      <CM_BILL_ADDR3 />
      <CM_BILL_CITY>CALGARY ALBERTA</CM_BILL_CITY>
      <CM_BILL_STATE />
      <CM_BILL_ZIP5>0</CM_BILL_ZIP5>
      <CM_BILL_ZIP4>0</CM_BILL_ZIP4>
      <CM_FOREIGN_ZIP>T2P 0M2</CM_FOREIGN_ZIP>
      <CM_ATTENTION>AL FREDERIKSEN</CM_ATTENTION>
      <CM_SALESMAN_INI />
      <CM_DB_RATING />
      <CM_CRED_LIMIT>0</CM_CRED_LIMIT>
      <CM_CRED_FLAG />
      <CM_LAST_CHG_DATE>1282005</CM_LAST_CHG_DATE>
      <CM_CHANGED_BY_USER>XSKISSEL</CM_CHANGED_BY_USER>
      <CM_REORG_CODE>N</CM_REORG_CODE>
      <CM_CORP_GROUP_CODE>0</CM_CORP_GROUP_CODE>
      <CM_CORP_SUB_CODE>0</CM_CORP_SUB_CODE>
      <CM_RECORD_CODE />
      </row>
      </ns:CUSTOMER_SCOPE>

    Hi Ivailo,
    I think the problem lies in the way you copy the data from monitor.
    whenever you want to copy data from XI monitor to test in your IB,make sure you select "view source" and then copy the source message otherwise you will get the browser view of the XML document which contain those "-" for expanding and collapsing the document.
    Regards,
    Sridhar

  • How can I create a XML document from a DOM?

    Hello,
    I'm using the parser for C, version 2 in the DOM modus. How can I dump the object model to a (XML) string after changing some field?
    Do I need to create my own function or is there a function in the DOM interface??

    You need to create your own function. The Java XML parser has such a function
    and we'll probably add one in a future release as well.
    Oracle XML Team

  • How To Populate An Advanced Data Grid In Flex With An XML Document Created In JAVA

    Flex Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="856" height="698" initialize="onInitData()">
        <mx:RemoteObject destination="utilityUCFlexRO" id="utilityUCFlexRO">
            <mx:method name="updateStationDetails" result="handleUpdateStationDetailsResult(event)" fault="handleUpdateStationDetailsFault(event)"/>
        </mx:RemoteObject>
        <mx:RemoteObject id="uniqueIdMasterUCFlexRO" destination="uniqueIdMasterUCFlexRO">
            <mx:method name="readByCustomerName" result="handleReadByCustomerNameResult(event)" fault="handleReadByCustomerNameFault(event)"/>
            <mx:method name="getCustomerAcDetails" result="handlegetCustomerAcDetailsResult(event)" fault="handlegetCustomerAcDetailsFault(event)"/>
        </mx:RemoteObject>
        <mx:Script>
            <![CDATA[
                import mx.events.ListEvent;
                import mx.collections.ItemResponder;
                import com.citizen.cbs.model.UniqueIdMaster;
                import mx.managers.PopUpManager;
                import mx.controls.ProgressBarMode;
                import mx.effects.Fade;
                import mx.controls.ProgressBar;
                import com.citizen.cbs.CitizenApplication;
                import mx.core.Application;
                import mx.messaging.messages.ErrorMessage;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                import mx.collections.ArrayCollection;
                import mx.controls.Alert;
                private var moduleCloseFlag:Boolean=false;
                private var v:UniqueIdMaster;
                [Bindable]
                private var customerDetails:ArrayCollection;
                [Bindable]
                private var branch:int=0;
                [Bindable]
                private var XMLDocument:XML;
                [Bindable]
                private var acDetails:XMLList;
                private var _progBar:ProgressBar = new ProgressBar();
                private function showLoading(e:Event = null):void
                    _progBar.width = 200;
                    _progBar.indeterminate = true;
                    _progBar.labelPlacement = 'center';
                    _progBar.setStyle("removedEffect", Fade);
                    _progBar.setStyle("addedEffect", Fade);
                    _progBar.setStyle("color", 0xFFFFFF);
                    _progBar.setStyle("borderColor", 0x000000);
                    _progBar.setStyle("barColor", 0x6699cc);
                    _progBar.label = "Please wait.......";
                    _progBar.mode = ProgressBarMode.MANUAL;
                    PopUpManager.addPopUp(_progBar,this,true);
                    PopUpManager.centerPopUp(_progBar);
                    _progBar.setProgress(0, 0);
                private function onInitData():void
                    utilityUCFlexRO.updateStationDetails(CitizenApplication.menuParameters["modulecode"]);
                private function handleUpdateStationDetailsResult(event:ResultEvent):void
                    if(moduleCloseFlag==true)
                        Application.application.unloadModule();
                private function handleUpdateStationDetailsFault(event:FaultEvent):void
                    var errorMessage:ErrorMessage = event.message as ErrorMessage;
                    Alert.show(errorMessage.rootCause.message);
                private function onSearch():void
                    if(txtName.text=="" || txtName.text==null)
                        Alert.show("Enter a name for search");
                        return;
                    if((txtName.text).length < 4)
                        Alert.show("Search should contain more than 3 alphabets");
                        return;
                    var d:String = txtName.text;
                    branch = CitizenApplication.initInfo.registeredUser.branchDetails.bdBranchNo;
                    uniqueIdMasterUCFlexRO.readByCustomerName(d,branch);
                    showLoading();
                private function handleReadByCustomerNameResult(event:ResultEvent):void                //In handle if record does not exists, dsiplays error message and resets the field
                    customerDetails =ArrayCollection(event.result);
                    PopUpManager.removePopUp(_progBar);
                    if(customerDetails.length==0)
                        Alert.show("Record Not Found, Enter Proper Name ");
                        onReset();
                private function handleReadByCustomerNameFault(event:FaultEvent):void
                    Alert.show(event.fault.faultDetail + " -- " + event.fault.faultString + "handleReadByCustomerNameFault");
                private function onReset():void
                    customerDetails=new ArrayCollection();
                    txtName.text="";
                private function onCancel():void
                    utilityUCFlexRO.updateStationDetails("MM0001");
                    moduleCloseFlag=true;
                private function btnBackClick():void
                    view1.selectedIndex=0;
                private function btnBackClick1():void
                    view1.selectedIndex=1;
                private function onItemClick( e:ListEvent ):void
                    if(dgCustDetails.selectedItem == null)
                        Alert.show("Select Proper Record");
                    else
                        lblId.text = e.itemRenderer.data.uimCustomerId;
                        lblName.text = e.itemRenderer.data.uimCustomerName;
                        var custId:int = Number(lblId.text);   
                        uniqueIdMasterUCFlexRO.getCustomerAcDetails(custId,branch);
                        showLoading();           
                private function handlegetCustomerAcDetailsResult(event:ResultEvent):void               
                    //XMLDocument = event.result as XML;
                    acDetails = new XMLList(event.result.menu);
                    //Alert.show("Name: "+event.result.@name);
                    PopUpManager.removePopUp(_progBar);
                    view1.selectedIndex=1;
                    //adg1.dataProvider=acDetails;
                private function handlegetCustomerAcDetailsFault(event:FaultEvent):void
                    PopUpManager.removePopUp(_progBar);
                    Alert.show(event.fault.faultDetail + " -- " + event.fault.faultString + "handlegetCustomerAcDetailsFault");
            ]]>
        </mx:Script>
        <mx:ViewStack height="688" width="856" id="view1">
            <mx:Canvas>
                <mx:Panel x="51" y="25" width="754" height="550" layout="absolute" title="Customer Search Page">
                    <mx:HBox x="174" y="26" horizontalAlign="center" verticalAlign="middle">
                        <mx:Label text="Enter Name:"/>
                        <mx:TextInput id="txtName" width="228"/>
                        <mx:LinkButton label="Search" click="onSearch()"/>
                    </mx:HBox>
                    <mx:Label text="--" id="lblId" x="40" y="194"/>
                    <mx:Label text="--" id="lblName" x="40" y="226"/>
                    <mx:DataGrid dataProvider="{customerDetails}" id="dgCustDetails" allowMultipleSelection="false" editable="false"
                        showHeaders="true" draggableColumns="false" width="718" height="373" itemClick="onItemClick(event);" x="10" y="61">
                        <mx:columns>
                            <mx:DataGridColumn headerText="Customer Id" dataField="uimCustomerId" width="150"/>
                            <mx:DataGridColumn headerText="Customer Name" dataField="uimCustomerName"/>
                        </mx:columns>
                    </mx:DataGrid>
                    <mx:ControlBar>
                        <mx:Button label="CANCEL" click="onCancel()" width="80"/>
                        <mx:Button label="RESET" click="onReset()" width="80"/>
                    </mx:ControlBar>
                </mx:Panel>
            </mx:Canvas>
            <mx:Canvas>
                <mx:TitleWindow x="10" y="10" width="836" height="421" layout="absolute">
                    <mx:AdvancedDataGrid x="6.5" y="10" id="adg1" designViewDataType="tree" variableRowHeight="true" width="807" height="278" fontSize="14">
                        <mx:dataProvider>
                              <mx:HierarchicalData source="{acDetails}"/>
                        </mx:dataProvider>
                        <mx:groupedColumns>
                            <mx:AdvancedDataGridColumn headerText="Type Of A/c" dataField="@Name" width="150"/>
                            <mx:AdvancedDataGridColumn headerText="Details Of A/c"/>
                        </mx:groupedColumns>
                        <mx:rendererProviders>
                            <mx:AdvancedDataGridRendererProvider id="adgpr1" depth="2" columnIndex="1" renderer="AcDetails1" columnSpan="0"/>
                        </mx:rendererProviders>
                    </mx:AdvancedDataGrid>
                    <mx:ControlBar height="56" y="335">
                        <mx:Button label="BACK" width="80" click="btnBackClick()"/>
                        <mx:Spacer width="100%"/>
                        <mx:Button label="EXIT" click="onCancel()" width="80"/>
                    </mx:ControlBar>
                </mx:TitleWindow>
            </mx:Canvas>
        </mx:ViewStack>
    </mx:Module>
    XML File Generated In JAVA:
    <?xml version="1.0" encoding="UTF-8"?>
    <menu>
    <AcType Name="Savings">
    <SavingAcDetails AcName="Mr. MELROY BENT" AccountNo="4" ClearBalance="744.18" ProductID="SB" TotalBalance="744.18">
    <SavingMoreAcDetails AcStatus="OPERATIVE" AcType="NORMAL" FreezeCode="No Freeze" ModeOfOper="AnyOne Single Or Survivor"/>
    </SavingAcDetails>
    </AcType>
    <AcType Name="TermDeposit">
    <TDAcDetails AcName="Mr. BENT MELROY" AccountNo="1731" ProductID="TD">
    <TDMoreAcDetails AcStatus="OPERATIVE" AcType="NORMAL" FreezeCode="No Freeze" ModeOfOper="Either or Survivor"/>
    </TDAcDetails>
    <TDAcDetails AcName="Mr. BENT MELROY" AccountNo="2287" ProductID="TD">
    <TDMoreAcDetails AcStatus="NEW" AcType="NORMAL" FreezeCode="No Freeze" ModeOfOper="Self"/>
    </TDAcDetails>
    <TDAcDetails AcName="Mr. BENT MELROY" AccountNo="78" ProductID="TD">
    <TDMoreAcDetails AcStatus="OPERATIVE" AcType="NORMAL" FreezeCode="No Freeze" ModeOfOper="Self"/>
    </TDAcDetails>
    </AcType>
    </menu>
    Tried Alot Of Examples Online But In Vain....
    Need Help....
    Thanks In Advance....

    Please help me !!!! I have been stuck up with this issue for the past two days and I need to atleast figure out if this is possible or not in the first place.

  • Blocking of document created by cheque reversal

    Hi Experts,
    I am using transaction fch8 and reversing a cheque.
    The old document is also reversed and amount is reset.
    a new document is generated
    I now want to block the newly created document.
    When i go to FB02 the block field is greyed out and i can only make changes in assignment and text field.
    Can you let me know how to get the block field in edit mode and how i can block the newly created document
    Regards,
    Rishikesh

    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.*;

  • UTL_DBWS, XML Document as a parameter

    I'm struggling with using a fully formed xml document as a parameter to a web service.
    Using this code I'm able to connect to the web service and sans the arg1 argument everything works.
    When I as in the code below use xmltype.toStringValue() or xmltype.toClobValue() charachters like < and > is replaced with the html encoded version (&lt; and &gt;) which does'nt work very well with the recieving web service.
    All three parameters is defined as string on the recieving web service.
    I've been searching this forum and using google, but can't find any examples doing something like this.
    Any help or pointers appreciated.
    procedure forwardToQueue is
    svc_ sys.utl_dbws.service;
    call_ sys.utl_dbws.call;
    svc_qname sys.utl_dbws.qname;
    response sys.xmltype;
    request sys.xmltype;
    utMelding sys.xmltype;
    t1 sys.xmltype;
    t2 sys.xmltype;
    doc xmldom.DomDocument;
    fListe xmldom.DOMNodeList;
    tmpL xmldom.DOMNodeList;
    fElement xmldom.domNode;
    tmp xmldom.domNode;
    meldingId strliten;
    arg0_node xmldom.domnode;
    arg0_elmt xmldom.domelement;
    arg0_text xmldom.domtext;
    arg1_node xmldom.domnode;
    arg1_elmt xmldom.domelement;
    arg1_text xmldom.domtext;
    arg2_node xmldom.domnode;
    arg2_elmt xmldom.domelement;
    arg2_text xmldom.domtext;
    child_doc xmldom.domdocument;
    main_node xmldom.domnode;
    root_node xmldom.domnode;
    root_elmt xmldom.domelement;
    x sys.xmltype;
    c varchar2(32000);
    bs_chr strmax;
    l_service sys.UTL_DBWS.service;
    l_call sys.UTL_DBWS.call;
    l_result ANYDATA;
    l_wsdl_url strmax := 'http://salah-test.sismo.local:8080/SIMSEJB/SIMSFacadeBean?wsdl';
    l_namespace strmax := 'http://salah-test.sismo.local:8080/SIMSEJB/SIMSFacadeBean';
    l_service_qname sys.utl_dbws.qname;
    begin
    procName := 'hentQueue';
    pl('*************** '||procName||' ***************');
    svc_qname := sys.utl_dbws.to_qname(null, 'SIMSFacadeBeanService');
    svc_ := sys.utl_dbws.create_service(svc_qname);
    call_ := sys.utl_dbws.create_call(svc_);
    sys.utl_dbws.set_target_endpoint_address(call_, 'http://salah-test.sismo.local:8080/SIMSEJB/SIMSFacadeBean');
    sys.utl_dbws.set_property(call_, 'SOAPACTION_USE', 'TRUE');
    sys.utl_dbws.set_property(call_, 'SOAPACTION_URI', 'sendMessage');
    sys.utl_dbws.set_property(call_, 'OPERATION_STYLE', 'document');
    x := genererSvar;
    doc := xmldom.newDOMDocument;
    main_node := xmldom.makeNode(doc);
    root_elmt := xmldom.createelement(doc, 'q0:sendMessage');
    xmldom.setattribute(root_elmt, 'xmlns:q0', 'si.sims.intern.service');
    root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
    -- Adding arg 0 as a string
    arg0_elmt := xmldom.createelement(doc, 'arg0');
    arg0_node := xmldom.appendchild(root_node, xmldom.makenode(arg0_elmt));
    arg0_text := xmldom.createtextnode(doc, '2');
    arg0_node := xmldom.appendchild(arg0_node, xmldom.makenode(arg0_text));
                   -- Adding arg 1 as a string
    arg1_elmt := xmldom.createelement(doc, 'arg1');
    arg1_node := xmldom.appendchild(root_node, xmldom.makenode(arg1_elmt));
    arg1_text := xmldom.createtextnode(doc, x.getClobVal());
    arg1_node := xmldom.appendchild(arg1_node, xmldom.makenode(arg1_text));
    -- Adding arg 2 as a string
    arg2_elmt := xmldom.createelement(doc, 'arg2');
    arg2_node := xmldom.appendchild(root_node, xmldom.makenode(arg2_elmt));
    arg2_text := xmldom.createtextnode(doc, 'false');
    arg2_node := xmldom.appendchild(arg2_node, xmldom.makenode(arg2_text));
    request := xmldom.getxmltype(doc);
    pl('Request:');
    pl(request.getStringVal());
    response := sys.utl_dbws.invoke(call_, request);
    pl('Showing respons');
    pl(response.getStringVal());
    doc := DBMS_XMLDOM.newDomDocument(response);
    sys.utl_dbws.release_call(call_);
    sys.utl_dbws.release_service(svc_);
    end forwardToQueue;

    Is the Document well defined via schema? You might be able to use the autotype
    ant task to generate a serializer.
    Otherwise, serialize the document to a string, then wrap it in <[CDATA[...]]>
    on the return. The calling app will need to understand that the string is xml,
    and then desrailize it manually.
    Mike
    "Surya" <[email protected]> wrote:
    >
    I have web service which has to retuen an XML document (org.w3c.dom.Document)
    as
    a paramter. Since this is not a supported data type for in-out paramaters,
    I will
    have to serialize and write my own converter. What is the best solution?
    Is there
    any class/library that can convert the document into String which I can
    return
    as a parameter and again get create a XML document in the client side.
    Thanks -Surya

  • XML document as a parameter while accessing web service

    I have web service which has to retuen an XML document (org.w3c.dom.Document) as
    a paramter. Since this is not a supported data type for in-out paramaters, I will
    have to serialize and write my own converter. What is the best solution? Is there
    any class/library that can convert the document into String which I can return
    as a parameter and again get create a XML document in the client side.
    Thanks -Surya

    Is the Document well defined via schema? You might be able to use the autotype
    ant task to generate a serializer.
    Otherwise, serialize the document to a string, then wrap it in <[CDATA[...]]>
    on the return. The calling app will need to understand that the string is xml,
    and then desrailize it manually.
    Mike
    "Surya" <[email protected]> wrote:
    >
    I have web service which has to retuen an XML document (org.w3c.dom.Document)
    as
    a paramter. Since this is not a supported data type for in-out paramaters,
    I will
    have to serialize and write my own converter. What is the best solution?
    Is there
    any class/library that can convert the document into String which I can
    return
    as a parameter and again get create a XML document in the client side.
    Thanks -Surya

  • String representation of the xml document

    hi, I have created the following xml document using the DOM api. I want to the "function" to return a "string" - which represents the xml document i created. How do u do that?
    As of now it doesnt return anything...
    How do u return the entire xml document as character data..? just like
    <root><elements>data</elements></root>....
    anyhelp would be great.
    import java.io.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.w3c.dom.*;
    public class test1{
    private static void function()throws IOException, DOMException{
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
    DocumentBuilder db = dbf.newDocumentBuilder ();
    Document doc = db.newDocument ();
    Element record = doc.createElement ("record");
    Element name = doc.createElement ("name");
    Element address = doc.createElement ("address");
    Element zip = doc.createElement ("zip");
    Text nameText = doc.createTextNode("bill");
    Text addressText = doc.createTextNode("128, washington");
    Text zipText = doc.createTextNode("10000");
    doc.appendChild(record);
    record.appendChild(name);
    name.appendChild(nameText);
    record.appendChild(address);
    address.appendChild(addressText);
    record.appendChild(zip);
    zip.appendChild(zipText);
    public static void main (String argv [])throws Exception {
    function();
    }

    Brent,
    Looks like you're using the Sun Java Parser. I'll show you how to do it with the Oracle XML Parser and you can extrapolate...
    Document doc = new XMLDocument();
    // Stuff here to build up the DOM Doc
    // with elements, etc.
    // Print the Document to a String
    StringWriter sw = new StringWriter();
    // Wrap the stringwriter in a printwriter
    PrintWriter pw = new PrintWriter(sw);
    // Print to the printwriter
    ((XMLDocument)doc).print(pw);
    // return the string from the stringwriter
    return sw.toString();

  • Big XML document as blob in firebird database

    Hi! I'm having some problems trying to use blob to store an XML document on a Firebird database. I'll try to make this simple: I'm reading a CD and copying the structure to an xml document (org.w3c.dom.Document), and i need to store it on a firebid database. The thing is that the document is really huge and when i try to insert it as text i get an exception:
    org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544726. Error reading data from the connection.
    Reason: Error reading data from the connection.
    Here is the code to insert:
    StringBuffer buffer = new StringBuffer();
            printDOM(catalog.getXMLDom(), buffer);
            new DBInsert("INSERT INTO CD (NAME, CATEGORY, CATALOG_TYPE, CATALOG_DESCRIPTION, CATALOG_UBICATION, CATALOG_FORMAT, XML) VALUES ('" + catalog.getName() + "','" + category + "','" + catalog.getCatalogType() + "','" + catalog.getCatalogDescription() + "','" + catalog.getCatalogUbication() + "','" + catalog.getCatalogFormat() + "','" + buffer.toString() + "')"); The buffer has all the xml structure which i took from the Document object, and when i read from the database it's supposed to restore the document from the xml structure.
    I'd be very happy if someone gives me a clue with that :) I have no idea how to insert and how to read the blob. The database column is defined with this domain CREATE DOMAIN BXML AS
    BLOB SUB_TYPE 1 SEGMENT SIZE 4096 CHARACTER SET NONE;
    Thanks for your time!
    Fede
    Edited by: fedebobbio1 on Dec 5, 2007 6:24 PM

    See the document demo for the XSQL Servlet.
    If it inserts an xml document into the database as a blob.

  • Question about special characters in XML documents

    Hi,
    I need to create some XML documents based on documents containing elements containing strings containing accentuated and special characters such as ��� or Asian characters.
    I have found the following code claiming that XML documents created by the xformer will have a utf-8 format:
    // Write the DOM document to the file
    Transformer xformer = TheTF.newTransformer();
    xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");and I have found the InputSource object to be used to read UTF-8 XML documents:
    InputSource in = new InputSource(new FileReader(filename));
    in.setEncoding("UTF-8");Is this enough to make sure that accentuated and Asian characters (or any other characters) will be converted properly when creating and re-reading the XML document? If one of my elements contain the following text '���33445tata', will the string remain the same when re-read from the XML? Do I need more code to make sure that all conversion will be performed properly and transparently? If yes, can one provide an example?
    Thanks!

    Hi Dr.Clap,
    Thanks for your answer, but I am not really sure I understand you. I have performed a test to generate a simple document containing one element. An attribute containing some special characters is added to the element. The element text also contains specials characters.
    When I generate the XML into a byte array input and print the content, I get:
    <?xml version="1.0" encoding="utf-8" standalone="no"?><UTF8TEST BIBI="��ii��������">tre33������</UTF8TEST>When I parse the document, and print the result, I get:
    -- Begin of Parsing
    Element Name = UTF8TEST
    Attribute Name = BIBI
    Attribute Value = �ii����
    Found text : tre33���
    -- End of Parsingwhich is correct. I am worried by the ��ii� ������-like characters generated in the XML. Should I be worried or shouldn't I? Should I convert these into something looking a more like ASCII, or is this fine?
    I am including the code of my example (excluding imports):
    public class XMLUTF8_Test extends DefaultHandler {
        // Logger
        private final static Logger LOG = Logger.getLogger(XMLUTF8_Test.class.getName());
        // Static
        public static DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY;
        public static DocumentBuilder DOCUMENT_BUILDER;
        public static TransformerFactory TRANSFORMER_FACTORY;
        private static SAXParserFactory FACTORY;
        private static SAXParser SAXPARSER;   
        private static XMLReader XMLREADER;
        static {
            // Preparing the writting
            DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
            try {
                DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder();
            } catch (ParserConfigurationException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
            TRANSFORMER_FACTORY = TransformerFactory.newInstance();
            // Preparing the reading
            try {
                FACTORY = SAXParserFactory.newInstance();
                SAXPARSER = FACTORY.newSAXParser();
                XMLREADER = SAXPARSER.getXMLReader();
            } catch (ParserConfigurationException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
            } catch (SAXException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
        public static void main(String[] args) {
            // Perform test
            new XMLUTF8_Test();
        public XMLUTF8_Test() {
            // Saving to File
            Document NewDoc = DOCUMENT_BUILDER.newDocument();
            Element Root = NewDoc.createElement("UTF8TEST");
            Root.setAttribute("BIBI", "�ii����");
            Root.setTextContent("tre33���");
            NewDoc.appendChild(Root);
            ByteArrayOutputStream TheBAOS = new ByteArrayOutputStream();
            try {
                Source source = new DOMSource(NewDoc);
                Result result = new StreamResult(TheBAOS);
                Transformer xformer = TRANSFORMER_FACTORY.newTransformer();
                xformer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
                xformer.transform(source, result);
            } catch (TransformerConfigurationException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
            } catch (TransformerException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
            // Printing result
            System.out.println(TheBAOS.toString());
            // Parsing the result
            ByteArrayInputStream TheBAIS = new ByteArrayInputStream(TheBAOS.toByteArray());
            XMLREADER.setContentHandler(this);
            try {
                XMLREADER.parse(new InputSource(TheBAIS));
            } catch (IOException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
            } catch (SAXException Ex) {
                Debugger.LogUnreachableCodeReachedSituation(LOG, Ex);
        @Override
        public void startDocument() throws SAXException {
            System.out.println("-- Begin of Parsing");
        @Override
        public void endDocument() throws SAXException {
            System.out.println("-- End of Parsing");
        @Override
        public void startElement(String namespaceURI, String LocalName, String QualifiedName,
                Attributes TheAttributes) throws SAXException {
            String ElementName = LocalName;
            if ("".equals(ElementName)) {
                ElementName = QualifiedName; // namespaceAware = false
            System.out.println("Element Name = " + ElementName);
            if (TheAttributes != null) {
                for (int i = 0; i < TheAttributes.getLength(); i++) {
                    String AttributeName = TheAttributes.getLocalName(i); // Attr name
                    if ("".equals(AttributeName)) AttributeName = TheAttributes.getQName(i);
                    System.out.println("Attribute Name = " + AttributeName);
                    System.out.println("Attribute Value = " + TheAttributes.getValue(AttributeName));
        @Override
        public void endElement(String namespaceURI, String SimpleName, String QualifiedName) throws SAXException {
        @Override
        public void characters(char[] buf, int offset, int len) throws SAXException {
            String s = new String(buf, offset, len);
            System.out.println("Found text : " + s);
    }Thanks!

  • Can't get the DOM to output XML document tags in correct order.

    I'm trying to output an XML document from the DOM using the DOMWriter class: new DOMWriter(document, filename, outputEncoding, encodingTag, getDocTypeString());
    It refuses to output the tags in the correct order so my document always fails validation when it is read back in. I've tried explicitly placing the elements in the correct order into the DOM and it still outputs them the way it wants to. Is there some method I'm missing to set the xsd or dtd to validate the output on. It actually appears as though it has a definite idea as to what order the tags should be output, because no matter what order I append the nodes into the document, it always outputs them in the same incorrect order. I've got the validation working when it reads the document in. Does anyone know what I have to do to get it to output the tags in the correct order?

    Does anyone know what I
    have to do to get it to output the tags in the correct
    order?You have to build the DOM in the correct way. Based on the code you posted it's impossible to tell what you are doing wrong. How about posting some code?

  • Attaching xml document to SOAP body

    Hi,
    i have two question.
    Q1: Is it allowed to attach xml document (org.w3c.dom.Document) to SOAP body when sending request to web service.( I have implemented web service to accept attached xml document.)
    Q2: If it is allowed, how thoes the WSDL look like.
    Thanx,
    Alan.

    Hi,
    I am facing the same issue., I want to transform the xml proxy request to SOAP requesting that the business service expects.
    Did you manage to solve the issue, if so, can you please share your solution?
    Thanks

  • Generating XML Document by giving Object as input

    Hi all,
       I have to give some object as input for generating XML Document.Basing on the data in the object the XML file has to be generated.
    Please give me your guidance in this issue.
    Thanks&Regards
    Madhu

    Madhu,
    You may:
    1. Generate XML Document manually with DOM API
    2. Use some complex lib like implementation of <a href="http://java.sun.com/webservices/jaxb/">JAXB</a> with ad-hoc control over format.
    3. Use some simple library like <a href="http://xstream.codehaus.org/">XStream</a> with minimal format control.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • Create xml document by xpath in java

    as i know, i can navigate existing xml document by xpath in java, i wonder if i can create a xml document framework by xpath in java?
    something like:
    Document doc = someobject.create(xpath expression);
    then i can use DOM to fill the framework?
    Thanks

    Please refer
    http://www.packtpub.com/article/xpath-support-in-oracle-jdeveloper-xdk-11g

Maybe you are looking for

  • Bridge CS6 no inicia camera raw

    hola, tras el cambio del sistema operativo de windos xp a windows 7 (no lo hice yo, no se como reinstalaron los programas), Bridge dejó de abrir camera raw y ajustes de color de la suite, arroja un error que dice que "la aplicacion bridge principal n

  • How do I delete all the emails from the inbox of my ipod touch?

    As a result of my lack of management, I now have 1500 emails in the inbox of my ipod Touch. I know how do delete them using "Edit", selecting each email and then deleting, but I would like to delete them all, in one action. How do I do this, please?

  • User tables disappeared from our Planning SQL table

    All of the user tables in the SQL database associated with our Planning application mysteriously disappeared. We created a classic Planning application and converted it to an EPMA application. We deployed the application in our test environment and t

  • Displays diagonal, jagged, white lines on a gray background

    The eMac (1.25GHz, 512 MB RAM) does the following. It boots (grey rotating spokes), then displays jagged, diagonal, white lines on a gray background. However, when I boot it into target disk mode, there's no problem w/ the display, and I could booted

  • [SOLVED] Vertical titlebar in fluxbox

    Hi all, After the death of compiz, which provided a minimalistic composite WM (https://bbs.archlinux.org/viewtopic.php?id=84617), I have come back to fluxbox with skippy-xd (and compton for transparency ). Things have been virtually perfect, and I'm