The size of a XML document stored in a XMLType table

Is there a way to find out (via SQL) the size of a XML document stored in a XMLType table or XMLType column (storage OR based)?
For instance in the way you could it retrieve if the XML document was stored in an XMLType column (CLOB based)
SQL> r
1 select dbms_lob.getlength(t.gegevens.getclobval()) "SIZE"
2 from hgo.hgo010_detam t
3* where rownum < 2
SIZE
2750

Is there a way to find out (via SQL) the size of a XML document stored in a XMLType table or XMLType column (storage OR based)?
For instance in the way you could it retrieve if the XML document was stored in an XMLType column (CLOB based)
SQL> r
1 select dbms_lob.getlength(t.gegevens.getclobval()) "SIZE"
2 from hgo.hgo010_detam t
3* where rownum < 2
SIZE
2750

Similar Messages

  • Read xml-structure from a xml-document stored in a xmltype-column?

    Hello,
    I have several xml-documents stored in a table with a xmltype-column.
    Is it possible to read the structure of one xml-document? I need to know what data are exists in the xml-documents.
    I had read some hours here, but I dont find a suitable solution for that.
    To make a example, what I need:
    I have stored the following xml-document in the table:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="6">
    <EMPLOYEE_ID>105</EMPLOYEE_ID>
    <FIRST_NAME>David</FIRST_NAME>
    <LAST_NAME>Austin</LAST_NAME>
    <EMAIL>DAUSTIN</EMAIL>
    <PHONE_NUMBER>590.423.4569</PHONE_NUMBER>
    <HIRE_DATE>6/25/1997 0:0:0</HIRE_DATE>
    <JOB_ID>IT_PROG</JOB_ID>
    <SALARY>4800</SALARY>
    <MANAGER_ID>103</MANAGER_ID>
    <DEPARTMENT_ID>60</DEPARTMENT_ID>
    </ROW>
    </ROWSET>
    I need to return the following:
    ROWSET
    ...ROW
    ......EMPLOYEE NUMBER
    ......FIRST_NAME VARCHAR2
    ......DEPARTMENT_ID NUMBER
    Regards,
    Mark

    Hi,
    I was on a wrong way. The datatype is not stored in xml, this was a mistake from me.
    I needed something to printout some values from a xml-file. This xml-file was generated bei MS Excel. The data are in /Workbook/Worksheet/Table/Cell and I didnt know how to access it.
    I write for that the following:
    DECLARE
    v_xml XMLType;
    v_doc dbms_xmldom.DOMDocument;
    v_node dbms_xmldom.DOMNode;
    type t_values is table of varchar2(2000) index by binary_integer;
    v_values t_values;
    type t_table is table of t_values index by binary_integer;
    v_table t_table;
    procedure node_output (v_node in out dbms_xmldom.DOMNode)
    is
    v_nodelist1 DBMS_XMLDOM.DOMNodeList;
    v_nodelist2 DBMS_XMLDOM.DOMNodeList;
    v_anzahlnodes number;
    v_anzahlrows number;
    v_node_c dbms_xmldom.DOMNode;
    v_xmlmitarbeiterid number;
    begin
    v_nodelist1 := dbms_xmldom.GETCHILDNODES(v_node);
    v_anzahlrows := DBMS_XMLDOM.GETLENGTH(v_nodelist1);
    if v_anzahlrows = 0 or DBMS_XMLDOM.GETNODENAME(v_node) = 'Table'
    then
    if v_anzahlrows > 0
    then
    for i1 in 0..v_anzahlrows - 1
    loop
    v_node := dbms_xmldom.Item(v_nodelist1,i1);
    v_nodelist2 := dbms_xmldom.GETCHILDNODES(v_node);
    v_anzahlnodes := DBMS_XMLDOM.GETLENGTH(v_nodelist2);
    for i2 in 0..v_anzahlnodes - 1
    loop
    v_node := dbms_xmldom.Item(v_nodelist2,i2);
    v_node_c := dbms_xmldom.GETFIRSTCHILD(v_node);
    v_node_c := dbms_xmldom.GETFIRSTCHILD(v_node_c);
    v_values(i2) := DBMS_XMLDOM.GETNODEVALUE(v_node_c);
    end loop;
    v_table(i1) := v_values;
    end loop;
    for i1 in 1..v_anzahlrows - 1
    loop
    select SEQ_XMLMITARBEITER.nextval into v_xmlmitarbeiterid from dual;
    for i2 in 1..v_table(i1).count - 1
    loop
    dbms_output.put_line(v_table(i1)(i2));
    end loop;
    end loop;
    end if;
    else
    v_node := dbms_xmldom.GETFIRSTCHILD(v_node);
    for i in 0..v_anzahlrows - 1
    loop
    v_node := dbms_xmldom.Item(v_nodelist1,i);
    node_output(v_node);
    end loop;
    end if;
    end;
    BEGIN
    select inhalt into v_xml FROM xmlimport WHERE name = 'F23973/mitarbeiter.xml';
    v_doc := dbms_xmldom.newDOMDocument(v_xml);
    v_node:= dbms_xmldom.makeNode(dbms_xmldom.getDocumentElement(v_doc));
    node_output(v_node);
    END;
    This gives me all data from a xml-Excel-file. Is there a better way to do that? I have Oracle 10.2.
    Regards,
    Mark

  • How to compare the contents of two XML documents

    Hi all,
    I was trying to compare the contents of two xml documents, they are both validate for the same XML Schema. i was using the xmlunit to do this. but some how it doesn't work like what i have expected. for example:
    1.xml : <test><item>2</item><item>1</item></test>
    2.xml: <test><item>3</item><item>2</item><item>1</item></test>
    the result from XMLUnit is this two xmls are different, but it compares <item>2</item> with <item>3</item>, which i cannot find out where the real diiffs are.
    does anybody know how i can do this correct?
    best regards,
    tina

    I faced a similar problem in one of my projects and hence wrote my own comparator. Most comparators like ExamXML etc show XML as different if the nodes under a parent node occur in different seqeunce or a set of repeated nodes occur in different sequence. The comparator that I wrote gives you the flexibility to configure how to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order. You can view the sample output at http://geocities.com/dheerendra_itbhu/TipsFromDheeru.html
    and contact me in case you need the source code.

  • How to set the encoding of an XML-document

    I need to change the encoding of an xml-document.
    When I convert the document into a string, UTF-8
    is used, I want to use ISO-8859-1.

    use this in your identity transform:
    transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");

  • Use DOM to get the element value of XML document?

    I can not to use the method getNodeValue to get the element value of XML document. How can I do for it?
    For example, for element
    <address>125 Smith Avenue</address>
    how to get the value "125 Smith Avenue" by using DOM?
    Thanks

    Thanks for all of you.
    The code indicates that I need to get the node by tag name. If I do not know the distribution of the elements and want to traverse all nodes. If the node contains value, I retrieve the value. How to implement the general case.
    For example, my XML file represent a directory hierarchy and looks like
    <root>
    <usr>
    <user>user1
    <file>file1</file>
    <file>file2</file>
    </user>
    <user>user2
    <file>file1</file>
    <file>file2</file>
    <file>file3</file>
    <file>file4</file>
    </user>
    </usr>
    </root>

  • What is the size and number of documents we can upload to a document library at one time

    HI
    what is the size and number of documents we can upload to a document library at one time.
    like we have scenario , we developed a custom solution to scan and upload documents to sharepoint sites doc library.
    here we face issues when user try to upload 100 documents with the size of each doc 2-3 MB, at one time.
    adil

    Hi Adil,
    The maximum number and size of documents to upload in a document library is determined by a setting in Central administration. You can go to Central administration -> Application Management -> Manage Web Applications -> Select the Web Application
    -> Click on General Settings in the ribbon. Scroll down and you will see "Maximum Upload Size" section. The maximum value that can be set is 2047 MB. 
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • Intermedia text search in XML document stored as CLOB

    Suppose i store an XML document as clob
    and i index it based on the tags ie
    if i have the followind table
    create table biodata (
    resume_id number primary key,
    content clob default empty_clob(),
    applicant_id number references
    applicants(id));
    and i stores various resumes in the clob (content column ) as xml document ie
    <experience_in_months> 22 </experience_in_months>
    Now if i want all the resume_id that that have experiences_in_months >= 10
    what would be the query that would fetch me this result?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by voron:
    We are storing data in XML format in an Oracle database (via CLOB). I can retrieve search results using the 'within' phrase, but am finding it hard to order them. Is there a utility or command I can use?<HR></BLOCKQUOTE>
    Maybe you should write a stored procedure (function )
    that extracts the section from your clob
    that should be sorted. Then use this function
    in the ORDER clause of your select statement.
    Andreas
    null

  • Maximum file size of imported XML document

    Is anyone able to tell me if there is a maximum size for XML files that you can import into a PDF document?? I need to know this as my client has a requirement for a very large data set within an interactive PDF generated using LiveCycle designer.

    Thanks. I have posted this in the LiveCycle designer forum but have had no reply. I have posted instead within this forum as importing an XML document is not specific to LiveCycle Designer and is instead an Acrobat Pro task and therefore question.

  • How to set the root path of XML document when calling Inserting procedure

    Hi,
    I was create a procedure to insert XML Document in to DBMS Tables, but i am not able to set the Start root element in calling procedure.
    My calling procedure is
    exec insXmldoc('pmc_sample.xml', 'pmc')
    When i am calling this procedure i got this error
    11:23:54 Error: ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 8
    ORA-06512: at line 2
    I am checking my XML file using XML Validator. My XML file was parsed with out errors.
    Please give the solution,and tell me where i did wrong in my calling procedure.
    suppose i have this XML file in local E drive ,how to set the path for that XML file in my calling procedure.

    Hi, I am doing the code likthis,please give the solution.
    SQL> create or replace procedure insProc(xmlDoc IN CLOB, tableName IN VARCHAR2) is
    2 insCtx DBMS_XMLSave.ctxType;
    3 l_ctx dbms_xmlsave.ctxtype;
    4 rows number;
    5 begin
    6 insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    7 rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    8 DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    9 end;
    10 /
    Procedure created.
    SQL> begin
    2 insProc('/usr/tmp/ROWSET.xml', 'emp');
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:
    Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 7
    ORA-06512: at line 2
    Kishore B

  • 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?

  • Using java to fill in the blanks in an xml document via a schema

    Hi all
    What im trying to do is basically take an xml document and run it through a xml schema validator and then if the xsd has any default values to basically populate the original xml document with these default values
    e.g.
    <root>
    <name>dave</name>
    <name></name>
    </root>
    the schema would be something like
    <xs:element name="name" default="bobby">
    after schema validation i would want the document to be
    <root>
    <name>dave</name>
    <name>bobby</name>
    </root>
    is that something possible to do in java with any specific xml frameworks out there? if so can any one give me any pointers in the right direction?

    i assume by the lack of response this cannot be done then :(

  • Build the delta from two xml documents

    Hi,
    i look for a solution to solve the following problem:
    i want to build a xml-based interface to pass my data to a client(Web etc.) and i dont know in which way the client manipulates the data and what in the xml-document was changed, inserted or deleted.
    What i have is the original-document and the changed-document (both based on the same DTD). How can i determine the delta from the two documents, cause i must know what actions to be taken (for example put <?bc4j remove?> or an appropriate tag for the XDK in the xml)
    any suggestion ???
    TIA
    Oliver

    The Oracle XDK for Java comes with a utility called XMLDiffer that, given XML Documents A and B, produces an XSLT stylesheet S that transforms A to B.
    Might be of use to you. That's the only inhouse XML diffing technology that I'm aware of. We use it internally in JDeveloper for merging machine-generate web.xml file edits with the user's hand-written web.xml file edits.

  • Want to load an xml document directly into an Oracle table

    From the Oracle XML Applications book pg: 106/107
    there is an example where it inserts into a Oracle table from the xml_documents table. What I would like to do is insert directly from the xml document and was able to but not able to get rid of the inserting into xml_documents section.
    CREATE OR REPLACE PROCEDURE insertXmlFile( dir VARCHAR2,
    file VARCHAR2,
    myTable varchar2,
    name VARCHAR2 := NULL) IS
    theBFile BFILE;
    theCLob CLOB;
    theDocName VARCHAR2(200) := NVL(name,file);
    BEGIN
    -- (1) Insert a new row into xml_documents with an empty CLOB, and
    -- (2) Retrieve the empty CLOB into a variable with RETURNING..INTO
    INSERT INTO xml_documents(XML_DOCUMENT_NM,XML_DOCUMENT_TX)
    VALUES('DELETE ME',empty_clob())
    RETURNING XML_DOCUMENT_TX INTO theCLob;
    -- (3) Get a BFile handle to the external file
    theBFile := BFileName(dir,file);
    -- (4) Open the file
    dbms_lob.fileOpen(theBFile);
    -- (5) Copy the contents of the BFile into the empty CLOB
    dbms_lob.loadFromFile(dest_lob => theCLob,
    src_lob => theBFile,
    amount => dbms_lob.getLength(theBFile));
    -- (5a) Insert the rows into the proper table
    insProc(theClob, myTable);
    -- (6) Close the file and commit
    dbms_lob.fileClose(theBFile);
    delete from xml_documents
    where xml_document_nm = 'DELETE ME';
    COMMIT;
    END;
    execute insertXmlFile ('XMLFILES','emp.xml','emp')

    Yes I would like to insert directly from an emp.xml file and load it directly into an emp table and not have to load the document in the xml_documents table and then insert into the emp table like I am doing in this procedure.

  • Can I set the DocumentType for an XML document? If so how? please help

    Hi,
    I am porting some code from jdom to xerces.
    jdom's document class provides a setDocType(String, String) function to set the DTD for the document.
    Is there anything similar in dom?
    The javadocs only mentions a getDocType() for the document interface in org.w3c.dom.Node interface. Is there any way I can SET the document type (DTD) for a given document object?
    TIA,
    Srinivas.

    In iOS, the spellcheck language follows the keyboard.
    The forum for questions about iOS Pages is at
    https://discussions.apple.com/community/app_store/iwork_for_ios

  • Parse an Aggregate in XML Document using PL/SQL

    Hi. I've been successful with parsing a TAG in XML Document stored in CLOB using PL/SQL XML Parser.
    However, I need help on how to get the whole aggregate in XML Document stored in CLOB.
    sample XML Doc :
    <library>
    <book>
    <title>Oracle Complete Reference</title>
    <author>Kevin</Author>
    <year>2000</year>
    </book>
    <video>
    <title>Learning C++</title>
    <length>2 hours</length>
    <video>
    </library>
    I need a function that will accept an Input which is the aggregate name and will return the aggregate value.
    With the sample XML above, say the input is 'VIDEO', the function will return :
    <video>
    <title>Learning C++</title>
    <length>2 hours</length>
    <video>
    I'll really appreciate any help.
    null

    I used such an example to parse several Varchar2 strings in a given DB session:
    BEGIN
    parser := xmlparser.newparser ;
    xmlparser.parsebuffer(parser,xmlout) ;
    domdoc := xmlparser.getDocument(parser) ;
    xmlparser.FREEPARSER(parser) ;
    parser.id := -1 ;
    nodes := xslprocessor.selectNodes(
    xmldom.makenode(domdoc),
    'Positionen/Position') ;
    for i in 1 .. xmldom.getLength(nodes) loop
    node := xmldom.item(nodes,i-1) ;
    -- do s/thing with the node
    end loop ;
    xmldom.freedocument(domdoc) ;
    RETURN(komponenten) ;
    EXCEPTION
    WHEN OTHERS THEN
    if parser.id <> -1 then xmlparser.freeparser(parser) ;
    end if ;
    if domdoc.id <> -1 then xmldom.freedocument(domdoc) ;
    end if ;
    RAISE ;
    END ;
    However, after about 2000 of nodes lists parsed, I get an ArrayIndexOutOfBoundsException from XMLNodeCover. Obviously, I should release the nodes or the nodelist, but I have not found any procedure to do this.
    Pascal

Maybe you are looking for