Retrieving a xml element/node as clob

New at this - so forgive the basic frustration here...
I have successfully loaded an XML file to be stored as Binary XML table in Oracle 11g. The XML file represents and describes data for use on websites, hence there is a vary large node representing the body text of an HTML page.
I have not attempted loading this XML file with an internal DTD or external xsd at this time, trying to keep things simple for now.
The following query results in an error
SELECT extractValue(value(c),'/article/article_body_page_html') article_body_page_html
FROM WEBSITE_CONTENT2 a,
TABLE(XMLSequence(Extract(object_value,'/website_content2'))) b,
TABLE(XMLSequence(Extract(value(b),'/website_content2/articles/article'))) c
WHERE extractValue(value(c),'/article/article_id') = '61041';
ERROR String result too large
I have tried XMLCAST(extractValue(value(c),'/article/article_body_page_html') AS CLOB) to no avail
It would seem I cannot be the first person running into this issue - and not being a PL/SQL or XML guru - I need some specific examples of retrieving a node/element where the data represented is:
1. Variable in length
2. Exists in the xml file as cdata
3. probably well over 4000 characters.
Could someone please help to provide a solution to what seems a very basic issue.
Thanks in advance.

From the 11.1 documentation on ExtractValue it has
"For documents based on XML schemas, if Oracle can infer the type of the return value, then a scalar value of the appropriate type is returned. Otherwise, the result is of type VARCHAR2. For documents that are not based on XML schemas, the return type is always VARCHAR2."
You should be able to use (not tested)
extract(value(c),'/article/article_body_page_html/text()').getClobVal()to get around this problem and ensure the extracted data is always treated as a clob by Oracle.

Similar Messages

  • Oracle xml v2 parser collapses xml element nodes

    Hi,
    Whenever I pass load an XML document and parse it using the DOMParser object, it collapses empty XML elements. Eg, if my XML file has the following element:
    <firstname></firstname>, once it passes through the parser, it becomes <firstname/>!
    How can I prevent this from happening? Is there some setting that I can set to stop it?
    Urgent response required.
    thanks!
    neelam

    This is an incorrect statement.
    Whether the incoming document had:
    <x>
    or
    <x></x>
    All that will be reflected in the DOM model is the presence of an "X" Element. An Element does not have a value in the DOM model (anyElement.getNodeValue() ALWAYS returns null). In either case, to associate a child text node with the "X" element, you would have to:
    1) Construct a new Text node
    2) Call appendChild() to append the child text node to the "X" element
    There is no semantic difference, in other words, between <x> and <x></x>

  • Parse XML Elements/Attributes from CLOB in PL/SQL

    Hi folks,
    I'm new to XML development in Oracle...I need some help in Parsing a XML stored in a CLOB column using PL/SQL.
    We are using Oracle 9i R2. Do i need install the XDK and /or XML DB?
    Basically the xml has some quiz questions and the answers to the quiz. Once student submits the quiz we need parse the XML and calculate the grade.
    Any help is appreciated...
    Thanks,

    A bit dirty but this works:
    Create an XMLType based on the CLOB contents...
    select extractvalue(value(x), '/PERSON/PER_ID/text()') PER_ID, extractvalue(value(x), '/PERSON/PER_ID/@changed') PER_ID_CHG
    , extractvalue(value(x), '/PERSON/SURNAME/text()') PER_SURNAME, extractvalue(value(x), '/PERSON/SURNAME/@changed') PER_SURNAME_CHG
    , extractvalue(value(x), '/PERSON/ADDRESS/STREET_NO/text()') PER_STREET_NO, extractvalue(value(x), '/PERSON/ADDRESS/STREET_NO/@changed') PER_STREET_NO_CHG
    , extractvalue(value(x), '/PERSON/ADDRESS/POSTCODE/text()') PER_POSTCODE, extractvalue(value(x), '/PERSON/ADDRESS/POSTCODE/@changed') PER_POSTCODE_CHG
    from table(xmlsequence(extract(xmltype('
    <PERSON>
    <PER_ID changed="1">260180</PER_ID>
    <SURNAME changed="2">MARTIN</SURNAME>
    <ADDRESS>
    <STREET_NO changed="3">1</STREET_NO>
    <POSTCODE changed="4">LE3 8RA</POSTCODE>
    </ADDRESS>
    </PERSON>')
    , 'PERSON')
    ) x;

  • Retrieving Request XML Element in Web Service Code

    to create a web service: I write java code and using JDeveloper, I 'create J2EE web service' from the java code.
    I need to get and handle a parameter, passed to the web service in the request xml and process it in my java code. For example I want to access a header element received in the request.
    How can I retrieve those elements in my code?
    Regards
    Farbod

    Hi V.S,
    [Here|http://img144.imageshack.us/my.php?image=datetimekb1.jpg] by the screenshot of the working example.
    The expression that I have used is :
    =DSTR(@DATE1,"XML_DATE")&TSTR(@TIME1,"XML_TIME")
    Where,
    XML_DATE    YYYY-MM-DD    2001-01-31
    XML_TIME     THH:NN:SS 02:39:40
    This should work now. Let me know.
    Best regards,
    Dharmi
    Edited by: Dharmi Tanna on Sep 8, 2008 2:29 PM

  • Parse XML Elements/Attributes from CLOB into Oracle Table

    Hi!
    I have an XML file (loaded into a CLOB) which I need to parse and have each individual element and attribute inserted into an oracle table for manipulation.
    Eg: XML File...
    <PERSON>
    <PER_ID changed="1">1</PER_ID>
    <SURNAME changed="1">MARTIN</SURNAME>
    <ADDRESS>
    <STREET_NO changed="1">1</STREET_NO>
    <POSTCODE changed="1">LE3 8RA</POSTCODE>
    </ADDRESS>
    </PERSON>
    There will only ever be one address.
    From this I need to extract
    * PER_ID and related changed attribute
    * SURNAME and related changed attribute
    * STREET_NO and related changed attribute
    * POSTCODE and related changed attribute
    and insert a single record into the table below:
    CREATE TABLE PERSON AS
    ( PER_ID VARCHAR2(10)
    , ID_CHANGED VARCHAR2(1)
    , SURNAME VARCHAR2(30)
    , ID_CHANGED VARCHAR2(1)
    , STREET_NO VARCHAR2(5)
    , ID_CHANGED VARCHAR2(1)
    , POSTCODE VARCHAR2(10) );
    Any assistance/advice would be very much appreciated. I've tried using DBMS_XMLSave / DBMS_XMLStore which works great at pulling in elements (PER_ID, SURNAME, etc) straight into the table but doesn't look at the changed attributes, and I need both.
    Thanks a million in advance to anyone who can crack this!!
    Jay

    Try looking at this thread
    Loading datafrom a PL/SQL table into the Database table

  • How to access XML elements by name in Extendscript??

    I'm almost done the script that I've been working on, but something has been nagging me since I started. When I did start, I looked at the JS Tools Guide CS5 that comes with the extendscript ide to check how to access XML elements, children, attributes etc. It says this:
    The XML object represents an XML element node in an XML tree. The topmost XML object for an XML file
    represents the root node. It acts as a list, which contains additional XML objects for each element. These in
    turn contain XML objects for their own member elements, and so on.
    The child elements of an element tree are available as properties of the XML object for the parent. The
    name of the property corresponds to the name of the element. Each property contains an array of XML
    objects, each of which represents one element of the named type.
    So basically it converts the XML into JSON. And you can access the properties like so:
    <book category="COOKING">
         <title lang="en">The Boston Cooking-School Cookbook</title>
         <author>Fannie Merrit Farmer</author>
         <year>1896</year>
         <price>49.99</price>
    </book>
    The Javascript statement bookstoreXML.book; returns the entire list of books.
    The statement bookstoreXML.book[0]; returns the XML object for the first book.
    The statement bookstoreXML.book[0].author; returns all authors of the first book.
    A couple pages down it talks about Retrieving contained elements using children(), elements(), descendants().
    So now I look through the XML Object properties and I see that I can use:
    xmlObj.child (which) which A String, the element name, or a Number, a 0-based index into this node’s child array.
    or
    xmlObj.descendants ([name])
    name Optional. A String, the element name to match. If not provided, matches all
    elements.
    or
    xmlObj.elements (name);
    name Optional. A String, the element name to match. If not provided, matches all
    elements.
    This is an excerpt of an XML I was working with:
    <ROW xmlns="http://www.filemaker.com/fmpdsoresult"
         MODID="16"
         RECORDID="11128">
       <Sign_Type>251.dr</Sign_Type>
       <fm:Location xmlns:fm="http://www.filemaker.com/fmpdsoresult" xmlns="">5-5024</fm:Location>
       <Line1>Zone
    Floor
    3
    Patient Rooms
    R532 - R436 even
    Patient Rooms
    R522 - R446 even
    Xavier Elevators
    Zone
    Patient Rooms
    R537 - 5757 odd
    Main Elevators
    Zone</Line1>
    </ROW>
    Extendscript will not give me an anything when I try to access elements by name. Instead I have to access by index, which works, but I'd rather search for names!
    Actually the console log returns: <![CDATA[]]>
    What am I doing wrong!?

    First, those E4X XML objects are definitely no JSON (plain data) - they have a multitude of methods, even for tasks that would easily be implemented as property (e.g. the length() function), and they also bind xml element and attribute names onto the objects, allowing to target a multitude of XML nodes with a single statement. Or did you mean your script with that "it"?
    Anyway, as you found out the ExtendScript XML object handles namespaces mostly by hiding them from you.
    You could play around with global namespace settings, see the JavaScript tools guide.
    You could also explicitly specify a namespace. This works for me:
    $.writeln(myXML["fm:Location"]);
    For simple use I had most success with a brute force approach that just strips the namespaces.
    function removeAllNamespace(xml)
              var ns =new Namespace();
              var d=xml.descendants();
              for (var i=0;i<d.length();i++)
        d[i].setNamespace(ns);

  • ACL granularity on XML element

    Hello,
    when I store a XML in a XMLTYPE (column or table) can I define an ACL on a specific XML element(node)? How fine grained is the ACL restriction? on the whole XML document or even lower to elements and attributes? If it is fine grained to elements can someone provide an example?

    As far as I know, it is top down...
    In http://www.oracle.com/technology/products/database/oracle11g/pdf/xml-db-11g-whitepaper.pdf it is described as follows (the 11g extras):
    ENHANCED ACL SECURITY
    In Oracle Database 11g, the Oracle XML DB ACL-based security model has been enhanced in a number of ways, including the following:
    • ACL Inheritance.
    ACL inheritance simplifies the process of defining, managing, and enforcing a common set of security policies across all of the documents stored in Oracle XML DB Repository. These rules can be organization-wide policies or policies specific to certain types of documents. These rules are specified by creating one or more master ACLs. With ACL inheritance it is possible to ensure that all new ACLs must be based on an existing ACL. This ensures that the newly created ACL inherits all of security policies defined by the ACL it is derived from, ensuring that the policies defined by the parent ACL are enforced whenever the new ACL is used.
    • DAV ACL Compliance.
    The Oracle XML DB ACL model has been enhanced to provide more complete support for the DAV ACL specification. This will allow improved interaction with clients that provide support for the DAV ACL security model.
    • User defined ACLs.
    In Oracle Database 11g the set of permissions defined by Oracle XML DB can be extended to allow the ACL based security model to be used to secure other kinds of database object.
    • Time-sensitive ACLs.
    In Oracle Database 11g it is possible to create ACLs that enforce access control polices in a timesensitive manner. This can be used to automatically publish and then expire content, based on rules defined by the ACL.

  • [JAXB 2.0] Unmarshalling error if the XML contains w3c.Element nodes

    Hi!
    I'm using the JAXB 2.0 library to create an XML file according to a XML Schema (XSD).
    I use the JAXB 2.0 classes, that I have previuosly generated, to fill the data and finally I execute the marshal method to store a XML file with the object's info.
    The second step is unmarshalling the file. Alright in my first attempt: I get all the JAXB objects filled with the data of the file.
    Now I try to add w3c.dom.Element nodes underneath a JAXB object that accepts a list of w3c.dom.Elements:
    org.w3c.dom.Element cip = (org.w3c.dom.Element) doc.createElement("CIP");
    root.appendChild(cip);
    t = doc.createTextNode("CIP");
    t.setData("TEST");
    cip.appendChild(t);
    qpd3.getAny().add(cip);
    And the resulting XML file is marshalled correctly again. Moreover, the node QPD contains a list of simple nodes like 'CIP' (the w3c.dom.Element of the example).
    The second step, to try unmarshalling the XML file I just have generated:
    Using a main method in my class the file is unmarshalled with no problems.
    It's now, when I deploy the web service that calls the unmarshall method (sending the same XML file to the same function), I receive a parsing error!!
    2007-01-30 20:00:08.221 ERROR caught exception while handling request: java.lang.IllegalAccessError: void oracle.xml.parser.schema.XSDNode.<init>()
    Why does this error appear??? I supose JDeveloper tries to parser the w3c.dom.Element nodes like a XSDNode and therefore it fails (what is a XSDNode...?). But if I execute the same method from the "main" of my class it works! Maybe the problem is related with the libraries that OC4J loads when it starts...
    Can anyone help me?? Thanks in advance!
    Sergi

    Hi Blaise,
    The Document class I use to generate the w3c.dom.Element nodes in the marshaling procedure belongs to oracle.xml.parser.v2.XMLDocument class. And it is located in the jar file: file:/C:/Oracle/jdeveloper/jdk/jre/lib/rt.jar!/org/w3c/dom/Document.class
    I have also checked if the unmarshal method of my class has linked the same library, althought is not used in the unmarshalling process (but maybe is implicit...) and it's OK.
    Have you seen something wrong?
    Thank you!
    Sergi

  • Want to retrieve multiple XML fragments in CLOBs in a *single query*

    Hi,
    I am trying to retrieve some well formed XML fragments stored as CLOBs from an 8i DB. For a single fragment at a time this is not a problem using <xsql:include-xml>. However, I am trying to retrieve multiple well formed fragments in a single query, "stacked" like so...
    <xsql:include-xml>
    <![CDATA[
    select theXMLFrag from tclob1 where id = 'open'
    union all
    select theXMLFrag from tclob2 --returns multiple rows
    union all
    select theXMLFrag from tclob3 --some more rows
    union all
    select theXMLFrag from tclob1 where id = 'close'
    ]]>
    </xsql:include-xml>
    What I am really after are the contents from the middle two selects. (The 'open' and 'close' bit was just a cheap attempt to ensure that the included XML is well formed.) Though it is not shown in my example, the problem is that the number and source of the CLOB fragments is not known until run time, and I wanted to use a dynamic query to assemble the needed CLOBS...
    I have since learned that <xsql:include-xml> returns the first column of the first row of the query result as parsed XML, either from a CLOB or a VARCHAR containing well-formed XML. So my attempt is no good... all but the first row are ignored.
    Does anyone have any suggestions for a way to do this using the existing xsql tag library? Or will I need to create my own <xsql:action>?
    Thanks,
    Bob Nugent

    Hi,
    Let me correct if i am right:
    - Central Contract -> new concept of SRM 7.0. 1 contract which is visible and usable from ECC and SRM as well. (not available in SRM 5.0 - agree)
    - GOA -> it exist in SRM 5.0 for sure! (we are currenlty using it for ECC procurement).
    The solution what you are mentioned is good...but as you said only for SRM 70...we are in SRM 5.0 and we need solution for here. Do you have any idea?
    Currently i am thinking about a new solution based on "standard" functionalities: if a GOA need to be created for mulitple company, it has to be populated in Header distribution (all company will have the same contract header). It item detail all the required information need to be poupulate in SRM (i.e.: item 1 for p.org1/comp.cod1; item 2 for p.org2/comp.cod2).
    When this is done, the BADI need to check the informatoin in SRM GOA and create contract according to that -> in this case 1GOA is created, but the 2 items for totally different p.org/comp.code, the BADI needs to create 2 different contract in ECC (i would like to avoid using reference purchasing organization in ECC!
    Thanks in advance!
    Best Regards,
    Attila

  • Getting Node Value of an XML element in JAVA.

    Hi,
    In my application, I have got the exact node that I want by parsing the document, but the node value returned is null as the node is an element and the Java Documentation does specify that it will return null. I would like to know if there in any alternative way by which I can parse the document and get the specified value of the node or element. Kindly help.

    Hi,
    i am using the dom parser. My code is as follows.
    Document xmlDocument, outputDoc;
                   DocumentBuilderFactory dbfObject = DocumentBuilderFactory.newInstance();
                   DocumentBuilder dbObject = dbfObject.newDocumentBuilder();
                   xmlDocument =  dbObject.parse("IPD_Response.xml");
                   Element dd = xmlDocument.getDocumentElement();
                   NodeList ItemAttributes = dd.getElementsByTagName("Element Name");
                   System.out.println("element" + ItemAttributes.item(0));
                   Node ss = ItemAttributes.item(0);
                   NodeList bb = ss.getChildNodes();
                   Node cc = ss.getFirstChild();
                   System.out.println("element sibling1 "+bb.item(0));
                   System.out.println("element sibling 2"+bb.item(1));
                   System.out.println("element sibling 3"+bb.item(2));
                   System.out.println("element child "+cc);
                   Node aa = bb.item(0);
                   NodeList qqq = aa.getChildNodes();
                   System.out.println("element sibling1---1 "+qqq.item(0));
                   System.out.println("element sibling1---1 "+qqq.item(1));
                   Node fff = qqq.item(0);
                   Node aaa = qqq.item(1);
                   String value1 = fff.getNodeValue();
                   String value2 = aaa.getNodeValue();
                   System.out.println("1st value "+value1+" 2nd value "+value2);What my code does is gets all the elements within a particular tag. After that i look for the child nodes, which i have done successfully. But when i get the value using getNodeValue(); method it will be null as per the Java Docs. Is there any other way by which i can get the node value. Kindly help.
    How do you parse the XML Document ?
    Are you using a DOM Document ?
    Which parser do you use ?
    How do you access the Element ?
    Post the releveant part of the code and using the
    [code ]  tags as described in[url=http://forum.java.sun.com/help.jspa?sec=formattin
    g]Formatting tips
    andi

  • How to rename element (node) names in an XMLType column?

    I have a source table with a xml data stored in an XMLType column.
    The xml contains elements/nodes identified by numbers. I need to replace the numbers with the appropriate names.
    The plsql below does this, but has two issues:
    i. It selects the data into a clob and does a text replace on the elements in a loop. This works, but is super slow for 3500+ xml rows (about 500 node pairs per row).
    ii. Once the data has had the element numbers replaced with the names, it inserts the new xml (clob wrapped in xmltype function) into the table with the XMLType attribute.
    The problem with the latter action is that it is failing due to nls client vs server settings, or so it appears from what I could dig up. The actual error message:
    ORA-19202: Error occurred in XML processing
    LPX-00242: invalid use of ampersand ('&') character (use &amp;)
    Error at line 3
    There are come entities in the original xml like "&#61616;" (the degree symbol).
    My question is two-fold:
    a). Can I replace the element names without straying from the xmltype datatype? If so, how?
    b). If I cannot do "a.)", then what must I do ensure that the clob gets converted correctly to xmltype and inserted into the table?
    SQL> select <some rows> from nls_database_parameters ;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8ISO8859P1
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 10.2.0.1.0
    SQL> SELECT * FROM NLS_SESSION_PARAMETERS;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    ----code below-----
    (note, this is a stripped down version of the original, so there may be typos)
    declare
    l_xmlclob CLOB;
    l_newxml XMLType;
    v_record_uid NUMBER(20);
    CURSOR my_cur IS
    select a.elementname,b.tagname
    from t_elements a, t_tags b
    where (a.element_uid = b.element_uid)
    begin
    select br.xml_data.getClobVal() xml_data into l_xmlclob from t_elements;
    FOR my_rec IN my_cur LOOP
    l_xmlclob := replace(l_xmlclob,my_cur.elementname,my_cur.maptag_name);
    END LOOP;
    l_newxml := XMLType(l_xmlclob);
    insert into test_translated_xml (xml_data) values (l_newxml);
    end;
    (hopefully I haven't missed anything)
    Any tips or hints would be much appreciated.
    Thanks!

    Hello again,
    Take a look at html entity codes: http://www.w3schools.com/tags/ref_entities.asp.
    You can use this:
    insert into t values (xmltype('<test>'||dbms_xmlgen.convert('this is a test &')||'deg;</test>'));
    or
    insert into t values (xmltype('<test>'||dbms_xmlgen.convert('this is a test &')||'#176;</test>'));
    see this: &deg; (& deg;) or this: &#176; (& #176;)
    SQL*Plus will not display degree character. But this is valid enitity code, and when you generate HTML out of this, it should be displayed properly in web browser.
    HTML is in fact XML, that is validated by specific DTD (Document Type Definition).
    Paweł

  • Update XML data stored in CLOB Column

    Hi All,
    i am new to Oracle and new to SQL
    i am trying to update XML data stored in CLOB cloumn,data is stored with the follwoing format
    <attrs><attr name="name"><string>Schade</string></attr></attrs>
    i am using the following query for updating the value
    UPDATE PRODUCT p SET ATTRIBUTES_nl_nl=UPDATEXML(XMLTYPE.createXML(ATTRIBUTES_nl_nl),'/attrs/attr[@name="name"]/string/text()','Schade').getClobVal() WHERE p.sku='000000000000040576_200911-5010057'
    this query is working fine but it changing the data to the following format
    <attrs><attr name="name">Schade</attr></attrs>
    some how it is ommiting the <string> tag from it, i am unable to figure it out whats the reason.
    any help in this regard will b e much appriciated
    Thanks in Advance
    -Umesh

    Hi,
    You should have created your own thread for this, and included database version.
    This works for me on 11.2.0.2 and 10.2.0.5 :
    SQL> create table t_org ( xml_clob clob );
    Table created
    SQL>
    SQL> insert into t_org
      2  values(
      3  '<Message>
      4  <Entity>
      5  <ASSIGNMENT>
      6  <OAVendorLocation> </OAVendorLocation>
      7  <Vendorid>1</Vendorid>
      8  </ASSIGNMENT>
      9  </Entity>
    10  </Message>'
    11  );
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> select '*' ||
      2         extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
      3         || '*' as result
      4  from t_org;
    RESULT
    SQL> update t_org set xml_clob =
      2  updatexml(xmltype(xml_clob),
      3  '/Message/Entity/ASSIGNMENT/OAVendorLocation/text()','LONDON').getClobVal()
      4  ;
    1 row updated
    SQL> select '*' ||
      2         extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
      3         || '*' as result
      4  from t_org;
    RESULT
    *LONDON*
    Does the OAVendorLocation really have a whitespace value?
    If not then it's expected behaviour, you're trying to update a text() node that doesn't exist. In this case, the solution is to use appendChildXML to create the text() node, or update the whole element.
    Is it your real document? Do you actually have some namespaces?

  • XML Element to string conversion returning null

    Hi,
    When i try to convert XML Element to string using toString() API, it returns something like [device: null] where device is element tag.
    Code is as follows -
    Document xmlDoc;
    DOMParser parser = (DOMParser)Class.forName("org.apache.xerces.parsers.DOMParser").newInstance();
    parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion", true );
    parser.parse(new InputSource(new StringReader(tableStr)));
    xmlDoc = parser.getDocument();
    Element root = xmlDoc.getDocumentElement();
    NodeList nodeList = root.getElementsByTagName("device");
    Element deviceNode = (Element)nodeList.item(nodeList.getLength()-1);
    System.out.println(deviceNode.toString()); //prints [device: null] ????
    System.out.println(deviceNode.getAttribute("ipAddress")); //prints correct ip address
    Any idea why i am getting [device: null] when trying to convert Element to String though attribute value is retrieved.
    Thanks,
    Deepak

    Hello ,
    I want to get the root node (<ZTOP60_XML_TAG_STRUCTURE>
    ) of the following xml file .
    <?xml version="1.0" encoding="utf-8"?>
    <ZTOP60_XML_TAG_STRUCTURE>
         <MSGTYPE>NAPOBACK</MSGTYPE>
         <SNDPRN>657393485</SNDPRN>
         <RECEIVER/>
         <RCVPRN>GSOHUBDM1</RCVPRN>
         <PONUM/>
         <VENDCODE>0020040266</VENDCODE>
         <VENDUNS>002601768</VENDUNS>
         <PARTNERFUNC_WE>WE</PARTNERFUNC_WE>
         <PARTNERNUM_WE>C240</PARTNERNUM_WE>
         <LINE_ITEMS>
              <item>
                   <ITEMNUM>00687</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>7.000</GRQTY>
                   <NETVAL>339.65</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FE-26865-01</MATNUM>
                   <MATDESC>PTR, T632, LEXMARK 5-BIN MAILBOX</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00178</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>303.000</GRQTY>
                   <NETVAL>18.62</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FE-ZZYRG-01</MATNUM>
                   <MATDESC>FDD,FDI-PC,1.44MB,3.5 ,HH</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00157</ITEMNUM>
                   <POQTY>999999998.000</POQTY>
                   <BOQTY>24.000</BOQTY>
                   <GRQTY>303.000</GRQTY>
                   <NETVAL>26.25</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FE-25094-01</MATNUM>
                   <MATDESC>MOUSE,PC,3BUT,,INTELLIMOUSE,PS2</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00881</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>62.000</GRQTY>
                   <NETVAL>368.80</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-66515-01</MATNUM>
                   <MATDESC>ITU MODULE ASM</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00223</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>377.000</GRQTY>
                   <NETVAL>459.28</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-65336-01</MATNUM>
                   <MATDESC>MAIN SYSTEM BOARD T23 (2647)</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00081</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>19.000</BOQTY>
                   <GRQTY>810.000</GRQTY>
                   <NETVAL>217.21</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-64199-01</MATNUM>
                   <MATDESC>QST- CADET 100</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00271</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>136.000</GRQTY>
                   <NETVAL>813.76</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-60065-01</MATNUM>
                   <MATDESC>SMART UPS 3000VA RM</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00791</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>3.000</GRQTY>
                   <NETVAL>201.73</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>3X-PBXGG-AA</MATNUM>
                   <MATDESC>ATI 7500 PCI GRAPHICS</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00173</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>32.000</GRQTY>
                   <NETVAL>7.50</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>12-56178-01</MATNUM>
                   <MATDESC>CARD GUIDE,SNAP-IN,LOW PROFILE,2.5 INCHE</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00309</ITEMNUM>
                   <POQTY>999999998.000</POQTY>
                   <BOQTY>15.000</BOQTY>
                   <GRQTY>71.000</GRQTY>
                   <NETVAL>51.23</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>30-51476-01</MATNUM>
                   <MATDESC>VHDI-CABLE WIDE 12 FT. DT-AB001-TQ</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00194</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>147.000</GRQTY>
                   <NETVAL>345.48</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>29-33689-01</MATNUM>
                   <MATDESC>PTR,IMP9,B/W,PAR/SER,110/240,R</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
         </LINE_ITEMS>
    </ZTOP60_XML_TAG_STRUCTURE>
    I wrote the following lines of code ..
    FTI .. >> String strMsg =((javax.jms.TextMessage)msg).getText();
    StrMsg is a string that represents an xml file .
    DocumentBuilderFactory docfactory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder builder = docfactory.newDocumentBuilder();
                   Document doc = builder.parse(new InputSource(new StringReader(strMsg)));
                   Element root = doc.getDocumentElement();
                   System.out.println("The root is " + root);
                   String strFileName = root+".xml" ;
                   System.out.println("The file name is " + strFileName);
                   File f = new File (strFileName);
                   FileOutputStream fos = new FileOutputStream( f );
                   for ( int j =0 ; j < strMsg.length(); j++)
                        char c = strMsg.charAt(j);
                        fos.write((int)c);
    I am getting the following error ...
    The root is [ZTOP60_XML_TAG_STRUCTURE: null]
    The file name is [ZTOP60_XML_TAG_STRUCTURE: null].xml
    Whey the file name or root is with special character [ ] and null ..
    I want just ZTOP60_XML_TAG_STRUCTURE.xml .
    Can anyone help me .
    thanks
    mahesh

  • How to escape or remove the special characters in the xml element by regula

    Hi members,
    How to escape or remove the special characters in the xml element by regular expression  in java??
    For Example ,
    <my:name> aaaa </my:name>
    <my:age> 27 </my:age>
    In the above example , i have to retrieve the value of the <my:name> Element(For examlpe -- i have to get "aaaa" from <my:name> tag)...
    How to retreive this value by using DOM with XPATH in java
    Thanks in Advance

    Hi members,
    I forget to paste my coding for the above question....This is my coding......In this display the error...... Pls reply ASAP.......
    PROGRAM:
    import java.io.IOException;
    import java.util.Hashtable;
    import java.util.Map;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import javax.xml.parsers.*;
    import javax.xml.xpath.*;
    public class DOMReaderForXMP {
         static Document doc;
         static XPath xpath;
         static Object result;
         static NodeList nodes;
         public DOMReaderForXMP() throws ParserConfigurationException, SAXException,
                   IOException, XPathExpressionException {
              DocumentBuilderFactory domFactory = DocumentBuilderFactory
                        .newInstance();
              domFactory.setNamespaceAware(true);
              DocumentBuilder builder = domFactory.newDocumentBuilder();
              doc = builder.parse("d:\\XMP.xml");
              XPathFactory factory = XPathFactory.newInstance();
              xpath = factory.newXPath();
         public static void perform(String path) throws Exception {
              result = xpath.evaluate(path, doc, XPathConstants.NODESET);
              nodes = (NodeList) result;
         public void check() throws Exception {
              perform("//my:name/text()");
              if (!nodes.item(0).getNodeValue().equals("application/pdf")) {
                   System.out.println("Mathces....!");
    ERROR:
    Exception in thread "main" net.sf.saxon.trans.StaticError: XPath syntax error at char 9 in {/my:name}:
    Prefix aas has not been declared

  • Read XML message from a CLOB

    We are currently receiving XML messages from a business partner that goes
    through a transformation/parser first to make sure the xml document was
    in MISMO form (Mortgage Industry Standard Message Organization). Then the
    document is stored in a clob in a table. The document is stored Without
    the tags. We are storing these XML messages into a CLOB datatype for
    later processing. I want to read the CLOB and then parse out the
    individual fields to store into a table. What is the best way to
    accomplish this in PL/SQL? Here is one sample record:
    <MORTGAGEDATA>
    <APPLICATION LoanPurposeType="OTHER">
    <LenderCaseIdentifier>3631681</LenderCaseIdentifier>
    <LendersBranchIdentifier>2966448</LendersBranchIdentifier>
    </APPLICATION>
    <PROPERTY PropertyUsageType="Primary">
    <Address1>1335 test</Address1>
    <City>las cruces</City>
    <State>NM</State>
    <PostalCode>88001</PostalCode>
    </PROPERTY>
    <SUBJECTPROPERTY>
    <SubjectPropertyEstimatedValueAmount>69000</SubjectPropertyEstimatedValueAmount>
    </SUBJECTPROPERTY>
    <BORROWERRECONCILEDLIABILITY LiabilityType="HelocSubjectProperty">
    <LiabilityUnpaidBalanceAmount>0</LiabilityUnpaidBalanceAmount>
    <LiabilityMonthlyPaymentAmount>0</LiabilityMonthlyPaymentAmount>
    </BORROWERRECONCILEDLIABILITY>
    <BORROWERRECONCILEDLIABILITY LiabilityType="MortgageLoanSubjectProperty">
    <LiabilityUnpaidBalanceAmount>0</LiabilityUnpaidBalanceAmount>
    </BORROWERRECONCILEDLIABILITY>
    <BORROWER>
    <FirstName>scooby</FirstName>
    <MiddleName/>
    <LastName>doo</LastName>
    <NameSuffix/>
    <MothersMaidenName>velma</MothersMaidenName>
    </BORROWER>
    </MORTGAGEDATA>
    NOTE: I have tried to use DBMS_XMLQUERY and it comes out like this using a
    stored procedure called printclob: When I do this the data is put into
    one field called xml_app_msg. The problem is how do I reference the
    individual fields like FirstName and so on to store in another table? Can
    I apply a stylesheet and if so, how?
    Or do I create an object type called xml_app_msg with the fields lastname
    and so on?
    -- The table is raw_xml_msg_tbl and the field with the stored infomation is
    xml_app_msg.
    set serveroutput on size 50000
    declare
    queryCtx DBMS_XMLquery.ctxType;
    result CLOB;
    begin
    queryCtx := DBMS_XMLQuery.newContext('select xml_app_msg from raw_xml_msg_tbl where app_id = :APP_ID');
    -- DBMS_XMLQuery.clearBindValue(queryCtx);
    DBMS_XMLQuery.setBindValue(queryCtx,'APP_ID','LT1001');
    -- get the result..!
    result := DBMS_XMLQuery.getXML(queryCtx);
    -- Now you can use the result to put it in tables/send as messages..
    printClobOut(result);
    DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle..
    end;
    OUTPUT:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <XML_APP_MSG><MORTGAGEDATA>
    <BORROWER>
    <FirstName>Falls</FirstName>
    <MiddleName/>
    <LastName>Water</LastName>
    <NameSuffix/>
    <SSN>123-45-6789</SSN>
    </BORROWER>
    </MORTGAGEDATA>
    </XML_APP_MSG>
    </ROW>
    </ROWSET>
    null

    I parse the XML doc into a domdocument and then loop through using xpath.valueof to pull the individual values from the nodes and then build a generic insert. It works quite well with a small number of columns. I'm not sure how it would work with a lot of columns. You can get code examples from Steve Muench's book "Developing Oracle XML Applications".

Maybe you are looking for