Error in Creating a XML Doc

i am having a error in the fellowing program.
When i create a xml file.Entire XML file is printed in a single line.
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
class CreateDomXml
public static void main(String[] args)
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = factory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element root = doc.createElement("root");
doc.appendChild(root);
Comment comment = doc.createComment("This is comment");
root.appendChild(comment);
Element childElement = doc.createElement("Child");
childElement.setAttribute("attribute1","The value of Attribute 1");
root.appendChild(childElement);
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer aTransformer = tranFactory.newTransformer();
Source src = new DOMSource(doc);
Result dest = new StreamResult(System.out);
Result dest = new StreamResult(new File("hello.xml"));
aTransformer.transform(src, dest);
}catch(Exception e){
System.out.println(e.getMessage());
OUTput
*<?xml version="1.0" encoding="UTF-8" standalone="no"?><root><!--This is comment--><Child attribute1="The value of Attribute 1"/></root>*
Edited by: psathishcs on May 29, 2008 6:24 PM

what do you expect it to print?
your output is set to System.out, not a file.

Similar Messages

  • Error while creating the Excise Doc in J1IIN

    Hi Friends,
    When we are trying to create an excise doc using J1IIN, we are getting error:
    "Error updating table J_1IPART2."
    What could be the possible reason for this?
    Regards,
    Abhishek

    Dear Abhishek
    Go to IMG Path -- Logistics-General --> Tax on Goods Movements --> India --> Account Determination --> Specify G/L Accounts per Excise Transactions.
    Here check whether you have maintained G/L Accounts in all the columns starting from RG23A BED.
    thanks
    G. Lakshmipathi

  • Xerces: Creating large XML docs

    Hi
    I am using the Xerces DOM parser to create large XML files. However, I need to flush the output every now and then to a file since I don't want the memory to keep growing. I tried doing the following:
    _domWriter->writeNode(fileFormatTarget, domDocument);
    fileFormatTarget->flush();
    But if I do a flush many times, the whole XML file is written again to the file.
    Is there a way to keeping flushing the memory to the file and releasing the memory after flushing ?
    I tried:
    _domWriter->release()
    But I can't use the DOMWriter any longer.
    Thanks
    Bijal

    Bijal,
    "Bijal Vora" <[email protected]> wrote in message news:19360326.1100183759055.JavaMail.root@jserv5...
    I am using the Xerces DOM parser to create large XML files. However, I need to flush the output every now and then to a file sinceI don't want the memory to keep growing. I tried doing the following:
    >
    _domWriter->writeNode(fileFormatTarget, domDocument);
    fileFormatTarget->flush();
    But if I do a flush many times, the whole XML file is written again to the file.
    Is there a way to keeping flushing the memory to the file and releasing the memory after flushing ?
    I tried:
    _domWriter->release()
    But I can't use the DOMWriter any longer.XML in general and DOM in particular is not suitable for processing
    large amounts of data. For your case the only feasible option could
    be using custom SAX handler, IMHO.
    Regards,
    Slava Imeshev

  • Error when creating new XML-Form

    Hi everybody!
    We are using XML-Forms to create/edit/display FAQs out of the KM-Content. We have created our own XMLForms for that and it worked fine. After our last upgrade (NW 7.0 SP-Stack 16) we have the following problem:
    clicking the "new FAQ" link in the portalruntime doesn't start the XML-Form anymore but displays an java error:
    java.lang.RuntimeException: Context is unavailable!
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMConnection.(DMSRMConnection.java:83)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMR3FunctionCalls.getGenericValueList(DMSRMR3FunctionCalls.java:6598)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMR3FunctionCalls.getLaboratoryList(DMSRMR3FunctionCalls.java:6426)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMR3FunctionCalls.getLaboratoryDescription(DMSRMR3FunctionCalls.java:6451)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMLaboratoryValueProvider.getValueLabel(DMSRMLaboratoryValueProvider.java:47)
         at com.sapportals.wcm.service.propertyconfig.config.MetaValue.getValueLabel(MetaValue.java:53)
         at com.sapportals.wcm.service.propertyconfig.config.MetaValue.getValueLabel(MetaValue.java:79)
         at com.sapportals.wcm.service.xmlforms.validation.PropertyLocalizer.getLocalizedPropertyValue(PropertyLocalizer.java:294)
         at com.sapportals.wcm.service.xmlforms.validation.PropertyLocalizer.localize(PropertyLocalizer.java:208)
         at com.sapportals.wcm.service.xmlforms.transformation.TransformationHelper.localizeProperties(TransformationHelper.java:64)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.render(Transformation.java:438)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.renderTemplate(Transformation.java:318)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.renderItemOrTemplate(Transformation.java:332)
         at com.sapportals.wcm.app.xmlforms.EditServlet.doGetAction(EditServlet.java:348)
         at com.sapportals.wcm.app.xmlforms.XFBaseServlet.doGet(XFBaseServlet.java:241)
    I don't have that behaviour when i try to edit an existign FAQ. But I have the same problem with any other XML-form i'm using to create KM-docs.
    to me it seems that the creation-context is somehow not valid. But what does that mean? and what can I do about it?
    Regrads, Alex

    Hi Alexander
    I think this thread might help you as it helped me, and it is the exact same error that you get
    https://www.sdn.sap.com/irj/sdn/thread?messageID=2943423#2943423
    Best regards,
    Martin Søgaard

  • Error while printing generated XML doc using DBMS_OUTPUT

    while generating XML document using XDK for PL/SQL i am getting " ORU-10027: buffer overflow, limit of 1000000 bytes " error even though i had set DBMS_OUTPUT to 1000000.
    Is there any way to getrid of this problem .
    i am using this code ..
    CREATE OR REPLACE procedure SQLToXML1 is
    queryCtx DBMS_XMLquery.ctxType;
    result CLOB;
    begin
    DBMS_OUTPUT.ENABLE (1000000);
    queryCtx := DBMS_XMLQuery.newContext ('select * from depolib_library' )
    result := DBMS_XMLQuery.getXML(queryCtx);
    printClobOut(result);
    DBMS_XMLQuery.closeContext(queryCtx);
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    end;
    urgent help is needed
    Thanks
    null

    No, It is a PO Print only. Only for changes to PO that do not affect the value of the PO,this error occurs. When i select the entry for the PO and click on Output message, the output message fails. On clicking Display Message, it shows the message - No schedules exist for the Scheduling Agreement XXXXXX(the PO number".
    So,it is not for Scheduling Agreements but for PO only. I know it is weird to see such an error on the PO output message in ME9F.
    Pls help.

  • Problem inserting XML doc (character set)

    Hi all,
    I'm having trouble trying to insert XML either "posting" it (xsql) or "putting" it
    (OracleXML putXML).
    The error that I get: "not supported
    oracle-character-set-174".
    The environment is:
    Oracle 8i 8.1.5
    (NLS_CHARACTERSET EL8MSWIN1253 for greek)
    JDK 1.2.2
    Apache Web Server 1.3.11
    Apache JServ 1.1
    XSQL v 0.9.9.1 and
    XMLSQL, XML parser v2 that comes with it.
    I had dropped all java classes and reloaded
    them using oraclexmlsqlload batch file.
    But still getting the same error.
    The thing that is that I am
    able to insert XML doc that was generated
    with an authoring tool called W4F that extracts data from HTML pages and map them to
    XML document, even with greek characters
    in it. But when XML is generated using
    an editor or the servlet like the following:
    newschedule.xsql like
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="latestschedules.xsl"?>
    <page connection="dtv" xmlns:xsql="urn:oracle-xsql">
    <xsql:insert-request date-format="DD'/'MM'/'YYYY" table="schedule_details_view"
    transform="request-to-newschedule.xsl"/>
    <xsql:query table="schedule"
    tag-case="lower" max-rows="5" rowset-element="latestschedules"
    row-element="schedule">
    select *
    from schedules
    order by schedule_id desc
    </xsql:query>
    </page>
    request-to-newschedule.xsl like
    <?xml version = '1.0'?>
    <ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
    <xsl:for-each select="request/parameters">
    <ROW>
    <SCHEDULE_ID><xsl:value-of select="Schedule_id_field"/></SCHEDULE_ID>
    <DESCRIPTION><xsl:value-of select="Description_field"/></DESCRIPTION>
    <DETAILS>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_1"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_1"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_2"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_2"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_3"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_3"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_4"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_4"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_5"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_5"/></DURATION>
    </DETAILS_ITEM>
    </DETAILS>
    </ROW>
    </xsl:for-each>
    </ROWSET>
    Hope that someone could help me on this ...
    Any advice is highly appreciated.
    Thanks in advance
    Nicos Gabrielides
    email: [email protected]

    Hi,
    How about applying an XSL on the existing XML doc to create another XML doc to filter out the table column not found in the target db table, so that all the columns are matched and then use putXML to load?
    Hope that helps.
    OTN team@IDC

  • Problem inserting xml doc into tables

    I'm trying to load and xml doc into a table/columns using putXML. I clearly have elements in my xml doc that I do not want to load into the table. I am receiving the following error: The XML element tag 'VERB' does not match the name of any of the columns/attributes of the target database. I'm having difficulty figuring out how to exclude of ignore these elements.
    Any help would be greatly appreciated.
    Thanks,
    John

    Hi,
    How about applying an XSL on the existing XML doc to create another XML doc to filter out the table column not found in the target db table, so that all the columns are matched and then use putXML to load?
    Hope that helps.
    OTN team@IDC

  • Heap space error while creating XML document from Resultset

    I am getting Heap space error while creating XML document from Resultset.
    It was working fine from small result set object but when the size of resultset was more than 25,000, heap space error
    I am already using -Xms32m -Xmx1024m
    Is there a way to directly write to xml file from resultset instead of creating the whole document first and then writing it to file? Code examples please?
    here is my code:
    stmt = conn.prepareStatement(sql);
    result = stmt.executeQuery();
    result.setFetchSize(999);
    Document doc = JDBCUtil.toDocument(result, Application.BANK_ID, interfaceType, Application.VERSION);
    JDBCUtil.write(doc, fileName);
    public static Document toDocument(ResultSet rs, String bankId, String interfaceFileType, String version)
        throws ParserConfigurationException, SQLException {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.newDocument();
            Element results = doc.createElement("sims");
            results.setAttribute("bank", bankId);
            results.setAttribute("record_type", "HEADER");
            results.setAttribute("file_type", interfaceFileType);
            results.setAttribute("version", version);
            doc.appendChild(results);
            ResultSetMetaData rsmd = rs.getMetaData();
            int colCount = rsmd.getColumnCount();
            String columnName="";
            Object value;
            while (rs.next()) {
                Element row = doc.createElement("rec");
                results.appendChild(row);
                for (int i = 1; i <= colCount; i++) {
                    columnName = rsmd.getColumnLabel(i);
                    value = rs.getObject(i);
                    Element node = doc.createElement(columnName);
                    if(value != null)
                        node.appendChild(doc.createTextNode(value.toString()));
                    else
                        node.appendChild(doc.createTextNode(""));
                    row.appendChild(node);
            return doc;
    public static void write(Document document, String filename) {
            //long start = System.currentTimeMillis();
            // lets write to a file
            OutputFormat format = new OutputFormat(document); // Serialize DOM
            format.setIndent(2);
            format.setLineSeparator(System.getProperty("line.separator"));
            format.setLineWidth(80);
            try {
                FileWriter writer = new FileWriter(filename);
                BufferedWriter buf = new BufferedWriter(writer);
                XMLSerializer FileSerial = new XMLSerializer(writer, format);
                FileSerial.asDOMSerializer(); // As a DOM Serializer
                FileSerial.serialize(document);
                writer.close();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            //long end = System.currentTimeMillis();
            //System.err.println("W3C File write time :" + (end - start) + "  " + filename);
        }

    you can increase your heap size..... try setting this as your environment variable.....
    variable: JAVA_OPTS
    value: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

  • Error While Loading XMl Doc into Oracle Database 10g

    Hi all,
    I have a task that , I have to make a utillity by which we can load XML Doc into a Table. While searching on Internet i found following Procedure on ASK Tom
    CREATE OR REPLACE
    procedure insert_xml_emps(
    p_directory in varchar2, p_filename in varchar2, vtableName in varchar2 )
    as
    v_filelocator bfile;
    v_cloblocator clob;
    l_ctx dbms_xmlsave.ctxType;
    l_rows number;
    begin
    dbms_lob.createtemporary(v_cloblocator,true);
    v_filelocator := bfilename(p_directory, p_filename);
    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    DBMS_LOB.LOADFROMFILE(v_cloblocator, v_filelocator,
    dbms_lob.getlength(v_filelocator));
    l_ctx := dbms_xmlsave.newContext(vTableName);
    l_rows := dbms_xmlsave.insertxml(l_ctx,v_cloblocator);
    dbms_xmlsave.closeContext(l_ctx);
    dbms_output.put_line(l_rows || ' rows inserted...');
    dbms_lob.close(v_filelocator);
    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    end ;
    when i try to run this procedure
    BEGIN
    insert_xml_emps('XML_LOAD','load.xml','IBSCOLYTD');
    END;
    it gaves me following Error
    ORA-29532: java call terminated by uncaught java exception : Oracle.xml.sql.OracleXMLSQLException:No
    rows to modify-- the row enclosing tag missing. Specify the correct row enclosing tag.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
    ORA-06512: at "EXT_TEST.INSERT_XML_EMPS", line 18
    ORA-06512: at line 2
    Can anyone describe me this error
    Thanks.
    Best Regards.

    SQL> /* Creating Your table */
    SQL> CREATE TABLE IBSCOLYTD
      2  (
      3  ACTNOI VARCHAR2 (8),
      4  MEMONOI NUMBER (7,0),
      5  MEMODTEI DATE,
      6  AMOUNTI NUMBER (8,0),
      7  BRCDSI NUMBER (4,0),
      8  TYPEI NUMBER (4,0),
      9  TRANSMONI NUMBER (6,0)
    10  );
    Table created.
    SQL> CREATE OR REPLACE PROCEDURE insert_xml_emps(p_directory in varchar2,
      2                                              p_filename  in varchar2,
      3                                              vtableName  in varchar2) as
      4    v_filelocator    BFILE;
      5    v_cloblocator    CLOB;
      6    l_ctx            DBMS_XMLSTORE.CTXTYPE;
      7    l_rows           NUMBER;
      8    v_amount_to_load NUMBER;
      9    dest_offset      NUMBER := 1;
    10    src_offset       NUMBER := 1;
    11    lang_context     NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    12    warning          NUMBER;
    13  BEGIN
    14    dbms_lob.createtemporary(v_cloblocator, true);
    15    v_filelocator := bfilename(p_directory, p_filename);
    16    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    17    v_amount_to_load := DBMS_LOB.getlength(v_filelocator);
    18    ---  ***This line is changed*** ---
    19    DBMS_LOB.LOADCLOBFROMFILE(v_cloblocator,
    20                              v_filelocator,
    21                              v_amount_to_load,
    22                              dest_offset,
    23                              src_offset,
    24                              0,
    25                              lang_context,
    26                              warning);
    27 
    28    l_ctx := DBMS_XMLSTORE.newContext(vTableName);
    29    DBMS_XMLSTORE.setRowTag(l_ctx, 'ROWSET');
    30    DBMS_XMLSTORE.setRowTag(l_ctx, 'IBSCOLYTD');
    31    -- clear the update settings
    32    DBMS_XMLStore.clearUpdateColumnList(l_ctx);
    33    -- set the columns to be updated as a list of values
    34    DBMS_XMLStore.setUpdateColumn(l_ctx, 'ACTNOI');
    35    DBMS_XMLStore.setUpdateColumn(l_ctx, 'MEMONOI');
    36    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'MEMODTEI');
    37    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'AMOUNTI');
    38    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'BRCDSI');
    39    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TYPEI');
    40    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TRANSMONI');
    41    -- Now insert the doc.
    42    l_rows := DBMS_XMLSTORE.insertxml(l_ctx, v_cloblocator);
    43    DBMS_XMLSTORE.closeContext(l_ctx);
    44    dbms_output.put_line(l_rows || ' rows inserted...');
    45    dbms_lob.close(v_filelocator);
    46    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    47  END;
    48  /
    Procedure created.
    SQL> BEGIN
      2  insert_xml_emps('TEST_DIR','load.xml','IBSCOLYTD');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM ibscolytd;
    ACTNOI      MEMONOI MEMODTEI     AMOUNTI     BRCDSI      TYPEI  TRANSMONI
    28004125     251942 05-SEP-92        400        513          1          0
    28004125     251943 04-OCT-92        400        513          1          0
    SQL>

  • Getting error while creating XML data source

    Hi,
    I have converted access database into xml and now wants to convert the xml file into oracle database.while creating the xml database resource geting error ora-065550.PLS-00103:Encountered the symbol"Push" when expecting one of the following .(),*etc.
    Why this problem I am facing.
    Any Idea
    Thanks in advace....

    The error message is explicit the WAERS field is hidden...you must edit the datasource structure in RSO2 and uncheck the "hidden" checkbox for that field....
    It will solve your problem...
    Regards

  • XML Parser Error while creating Web service Client using JAX RPC

    hello evryone,
    Im facing XML Parser Error while creating web service client using JAX RPC. Im using Net Beans IDE for development purpose. I have wrote configuration file for client. Now i want to create Client stub. However i dont know how to do this in Net Beans. So i tried to do it from Command promt using command :
    wscompile -gen:client -d build -classpath build config-wsdl.xml
    here im getting Error:
    error parsing configuration file: XML parsing error: com.sun.xml.rpc.sp.ParseException:10: XML declaration may only begin entities
    Please help me out.
    Many thanks in advance,
    Kacee

    Can i use the client generated using jdeveloper 11g to import into the oracle forms 10g, i.e., form builder 10g. Currently this is the version we have in our office.

  • Error in creating XML photo gallery with Flash CS4 and AS 3.0

    Hello, all. I've been creating an XML photo gallery with Flash CS4 and AS 3.0 following a tutorial. I followed the instructions step-by-step but at the end I got the following error message instead:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    Could anyone in the community assist me as to how to solve the problem? The script has no errors and last time I checked all the applicable files (the .xml file, the .jpg files, the .swf and the .fla file) are in my Documents folder on the Mac.
    Looking forward to your suggestions!

    Check the folder structure
    Flash is not able to get some file thats why the IO Error.
    trace the url path just before u load the file and u will be abel to find whether that file is in specified folder or not.
    http://www.darshanrane.com

  • Has anybody tried creating and validating a XML doc with XML Schema?

    Hi,
    Has anybody tried creating and validating a XML doc with XML Schema?

    With XMLBeans, an XML document may be created from and validated with an XML schema.

  • Creating XML Doc using JDOM... HELP!!!!!

    I've got a constructor which creates an Annotation object ... each object has 4 fields;
    Annotation Owner
    Date/time submitted
    ID
    Annotation Text
    When each Annotation object is constructed it is placed on a Vector array.
    I now want to create an XML Document for the Annotation object on the Vector Array...
    I am using JDOM and have managed to create a simple constructor:
    // Class XMLDocument...
    // This class is a subclass of MooNotes 2 that is designed to construct a XMLDocument containing a particular
    // Annotations details...
    class XMLDocument {
         long docID;
         org.jdom.Document xmldoc;
         * <p>
         * Build a simple XML document in memory
         * </p>
         // Constructor for the XMLDocument class...
         // This constructor will construct an
    // XMLDocument and populate the data fields with the particular
         // Annotation contents.
         // The constructor is passed a DOCUMENT ID and a JDOM document when invoked and it uses this data to construct
         // the XML Document.
         public XMLDocument(long docID, org.jdom.Document xmldoc) {
         this.docID = docID;
         this.xmldoc = xmldoc;
         xmldoc.setDocType(new org.jdom.DocType("html", "-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"));
         org.jdom.DocType docType = xmldoc.getDocType();
         messagearea.append("XMLDocument Element: " + docType.getElementName() + " \n");
         messagearea.append("XMLDocument Public ID: " + docType.getPublicID() + " \n");
         messagearea.append("XMLDocument SystemID: " + docType.getSystemID() + " \n");
         messagearea.append("Document successfully built " + " \n");
    How do I construct a Document to accept and hold the contents of an Annotation Object?
    P.S.
    AnnotationSubmitter is a String
    So is Date/time
    ID is a long number
    Annotation Text is also a String

    Since your constructor receives a org.jdom.Document already, it's difficult to figure out what you're trying to do. I'm also not sure what you mean by a Vector array, but I'm gonna give it a shot. To construct a simple org.jdom.Document (without namespace) I would do the following:
    Element root=new Element("ALL_ANNOTATIONS");
    Document=new Document(root);
    doc.setDocType(new DocType(  ...[your stuff]... ));
    and loop through your annotations objects
    for(int i=0;i<n;++i)
        root.addChild(new Element("ANNOTATION")
                      .addChild(new Element("ANNOTATION_OWNER")
                            .setText(annotObjects.getAnnotationOwner()))
    .addChild(new Element("ANNOTATION_TIME")
    .setText(......getTime()))
    .addChild(new Element("ANNOTATION_ID")
    .setText(""+annotObjects[i].getID()))
    .addChild(new Element("ANNOTATION_TEXT")
    .setText(......getText()));
    In the end this should give you the equivalent of:
    <ALL_ANNOTATIONS>
    <ANNOTATION>
    <ANNOTATION_OWNER>
    Text of First Annotation Owner
    </ANNOTATION_OWNER>
    <ANNOTATION_TIME>
    Time/Date of annotation
    </ANNOTATION_TIME>
    <ANNOTATION_ID>
    1234567
    </ANNOTATION_ID>
    <ANNOTATION_TEXT>
    Some Annotation Text
    </ANNOTATION_TEXT>
    </ANNOTATION>
    <ANNOTATION>
    etc. N-1 Times.
    </ANNOTATION>
    </ALL_ANNOTATIONS>
    Hope that helps.

  • Is it possible to create indexes & use them on xml docs with namespaces?

    I have put an XML doc in a BDBXML container which looks like this:
    *<ns1:note xmlns:ns1="http://www.testsch.org/ns">*
    *<ns1:to>Eric</ns1:to>*
    *<ns1:from>Brendan</ns1:from>*
    *<ns1:msg>How r u?</ns1:msg>*
    *</ns1:note>*
    Now, I am creating an index on the element "to", as:
    addIndex "ns1" "to" node-element-equality-string
    Though the index has been shown as getting created using the listIndexes command, if I lookup that index with the following command:
    lookupIndex node-element-equality-string "ns1" "to"
    the output is:
    *0 objects returned for eager index lookup 'node-element-equality-string'*
    Whereas, if I do the whole procedure without the namespaces in the document & the commands, the result is fine:
    *1 object returned for eager index lookup 'node-element-equality-string'*
    Can someone please tell me whether using namespaces, the indexes can be created or not? If yes, how?
    Thanks,
    Dev
    Edited by: user11871332 on Sep 7, 2009 3:53 PM

    Hi Dev,
    When using XML, the prefix for the namespace is really just syntactic sugar. The actual namespace in your example is "http://www.testsch.org/ns", and that's the value that you need to use when creating your index:
    addIndex "http://www.testsch.org/ns" "to" node-element-equality-stringJohn

Maybe you are looking for