Search xml document

is there any way of searching an xml document, i basically want to search the xml doc for a particular value and return its id (not sure if id is the right word)
example:
<root element>
<item>
<name>value 1<name>
<description> example 1<description>
<item>
<item>
<name>value 2<name>
<description> example 2<description>
<item>
<root element>
so for example i want to search the <name> tag for ie value 1 and the function return the item id in the file (or the contents of <description> tab). in this case the id for value1 would be 0 because of the way the dom parser creates them.
i hope you understand what i am trying to say.
Thanks

there are different ways to parse through a xml file. you can use a SAXParser for example.
http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/SAXParser.html
you can find heaps of examples for that...
http://www.brics.dk/~amoeller/XML/programming/saxexample.html

Similar Messages

  • Search xml document by example

    Hi.
    I'd like to create a XML documents search engine. So id like to find documents that contain elements and data like in request XML document. F.E.
    there are 3 documents in the database
    #1
    <root>
    <firstname>AAA</firstname>
    <lastname>BBB</lastname>
    <nickname>CCC</nickname>
    </root>
    #2
    <root>
    <firstname>AAA</firstname>
    <lastname>DDD</lastname>
    <nickname>EEE</nickname>
    </root>
    #3
    <root>
    <firstname>FFF</firstname>
    <lastname>BBB</lastname>
    <nickname>GGG</nickname>
    </root>
    and a request xml like
    #1
    <root>
    <firstname>AAA</firstname>
    </root>
    #2
    <root>
    <lastname>BBB</lastname>
    </root>
    So, id like to get #1 and #2 documents after request #1 and #1 and #3 after request #2. If there is no <someelement> in request this mean that it's value may be ANY, and if it's empty - this element in document must be empty too.
    So, the question is:
    Is there any simple query for this or I should generate dynamic XPath query for each request?
    Thanks.

    there are different ways to parse through a xml file. you can use a SAXParser for example.
    http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/SAXParser.html
    you can find heaps of examples for that...
    http://www.brics.dk/~amoeller/XML/programming/saxexample.html

  • How to search for a text node with a particular value in an xml document with labview

    supposing i have the following xml document:
    <head>
    <book>
    <bookname>zio</bookname>
    <author>dan</author>
    </book>
    <book>
    <bookname>the spear warrior</bookname>
    <author>britney</author>
    </book>
    <book>
    <bookname>the beard</bookname>
    <author>derrick</author>
    </book>
    </head>
    i want to search for the author of the book "the beard" using for example the V.I Get first match  of labview to access the the node with value "the beard" and then use Get next sibling  V.I  and Get node text content to get get the author of this book..so my question is how do i write the xpath expression for Get first match so as to access the node with bookname "the beard" instantyly?  am trying to minimise the use of loops because they increase the time duration,..thank you (NB:i dont want to use Get all Matched V.I because it obliges me to use a loop in order to access the name derrick and this increases the time duration for my v.i)
    Solved!
    Go to Solution.

    Since it's all text, why not use a real quick Match Pattern (or Regular Expression, but you don't need that much power here), see attached.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ
    Attachments:
    Two-stage match demo.vi ‏8 KB

  • 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

  • Keyword search over XML documents

    there are many open source native XML databases,and search engines that support XQuery and XPath and many of them also support full text search.
    such as:
    1- TPOX
    2- Timber
    3- DBXML
    4 - http://exist.sourceforge.net/kwic.html [http://exist.sourceforge.net/kwic.html]
    5- http://www.inf.uni-konstanz.de/dbis/basex/ [http://www.inf.uni-konstanz.de/dbis/basex/]
    6- http://xqengine.sourceforge.net/ [http://xqengine.sourceforge.net/]
    7- Lucene
    But, could you please tell me what is the alternative open source systems for the following closed systems (XRANK is a Ranked keyword search over XML documents on http://www.cs.cornell.edu/~cbotev/XRank.pdf ) and (XSeek is A Semantic XML Search Engine Using Keywords on http://xseek.asu.edu/xseekdemo.pdf )
    I posted the question on http://stackoverflow.com/questions/2921379/is-there-any-open-source-system-for-keyword-search-on-xml-documents and I have got good information , but I think some people on this forum may have more information.
    thanks.

    Well, there is a workaround to search in the xml. Open xml in FF, open the page source (Ctrl + U) and search in it.

  • Searching CLOB column of XML documents with leading wildcard - Performance

    Hi, our table has a text indexed CLOB column of XML documents and when performing a search with a leading wild card, we never retrieve any results.
    The query looks like this:
    select id from <table> where contains(columnname, '(%12345)') > 0;
    I cant even generate an explain plan from this query. I killed it after 39 minutes.
    If the query changes to:
    select id from <table> where contains(columnname, '(12345%)') > 0;
    I get an explain plan immediately with a cost=2 and when I execute the query, I get results in less than a second.
    I'd appreciate any thoughts of what I should check or what the problem might be.
    Thanks! Doug

    Can you provide a script that reproduces the case. I am unable to reproduce the problem with just some small sample data, as shown below. That means that there is nothing wrong with the syntax, but you may be having problems due to the size of your data or other parameters that have not been mentioned.
    SCOTT@10gXE> CREATE TABLE your_table (id NUMBER, columnname CLOB)
      2  /
    Table created.
    SCOTT@10gXE> insert into your_table
      2  select 1, dbms_xmlgen.getxml
      3             ('select deptno, dname,
      4                   cursor (select empno, ename
      5                        from      emp
      6                        where  emp.deptno = dept.deptno ) employee
      7               from   dept
      8               where  deptno = 10')
      9  from   dual
    10  /
    1 row created.
    SCOTT@10gXE> SELECT * FROM your_table
      2  /
            ID COLUMNNAME
             1 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DEPTNO>10</DEPTNO>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMPLOYEE>
                  <EMPLOYEE_ROW>
                   <EMPNO>7782</EMPNO>
                   <ENAME>CLARK</ENAME>
                  </EMPLOYEE_ROW>
                  <EMPLOYEE_ROW>
                   <EMPNO>7839</EMPNO>
                   <ENAME>KING</ENAME>
                  </EMPLOYEE_ROW>
                  <EMPLOYEE_ROW>
                   <EMPNO>7934</EMPNO>
                   <ENAME>MILLER</ENAME>
                  </EMPLOYEE_ROW>
                 </EMPLOYEE>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> CREATE INDEX your_idx ON your_table (columnname)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@10gXE> EXEC DBMS_STATS.GATHER_TABLE_STATS ('SCOTT', 'YOUR_TABLE')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> SET AUTOTRACE ON EXPLAIN
    SCOTT@10gXE> select id from your_table where contains (columnname, '(%839)') > 0
      2  /
            ID
             1
    Execution Plan
    Plan hash value: 2832585188
    | Id  | Operation                   | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |            |     1 |   888 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| YOUR_TABLE |     1 |   888 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | YOUR_IDX   |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("COLUMNNAME",'(%839)')>0)
    SCOTT@10gXE> SET AUTOTRACE OFF

  • SSRS Reports getting error in XML document (1, 6110).

    Hi,
    SCCM 2012 R2  Query reports opening error it shows below errors few reports only open properly.
    Stack Trace:
       at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod)
       at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)
       at Microsoft.Reporting.WinForms.ServerReport.EnsureExecutionSession()
       at Microsoft.Reporting.WinForms.ServerReport.SetParameters(IEnumerable`1 parameters)
       at Microsoft.ConfigurationManagement.AdminConsole.SrsReporting.ReportViewerWindowsForms.SetParameterValues_DoWork(Object sender, DoWorkEventArgs e)
    System.InvalidOperationException
    There is an error in XML document (1, 6648).
    Stack Trace:
       at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod)
       at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)
       at Microsoft.Reporting.WinForms.ServerReport.EnsureExecutionSession()
       at Microsoft.Reporting.WinForms.ServerReport.SetParameters(IEnumerable`1 parameters)
       at Microsoft.ConfigurationManagement.AdminConsole.SrsReporting.ReportViewerWindowsForms.SetParameterValues_DoWork(Object sender, DoWorkEventArgs e)
    System.Xml.XmlException
    '', hexadecimal value 0x1F, is an invalid character. Line 1, position 6648.
    Stack Trace:
       at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod)
       at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)
       at Microsoft.Reporting.WinForms.ServerReport.EnsureExecutionSession()
       at Microsoft.Reporting.WinForms.ServerReport.SetParameters(IEnumerable`1 parameters)
       at Microsoft.ConfigurationManagement.AdminConsole.SrsReporting.ReportViewerWindowsForms.SetParameterValues_DoWork(Object sender, DoWorkEventArgs e)
    Kiran

    This has already been discussed and solved, please use the search funtion:
    http://social.technet.microsoft.com/Forums/en-US/home?category=systemcenter2012configurationmanager&sort=relevancedesc&brandIgnore=True&searchTerm=There+is+an+error+in+XML+document+
    Torsten Meringer | http://www.mssccmfaq.de

  • ClassCastException while creating an XML document in servlet

    HI,
    I am trying to create an XML document in a servlet and I am getting ClassCastException at runtime when casting org.w3c.dom.document to org.apache.crimson.tree.XmlDocument . I am using Tomcat 4.1
    The same code is working fine when executed in a stand alone java program
    Can anyone please help me in trying to solve this problem. I require it urgently.
    The following is my code:
    import java.io.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.apache.crimson.tree.XmlDocument;
    public class test{
    public void createxml (String username) throws Exception
              Document doc=null;
              DocumentBuilderFactory dbf=null;
         DocumentBuilder db=null;
         Element root=null;
         Element poline=null;
         org.apache.crimson.tree.XmlDocument xmldoc=null;
         FileOutputStream fos=null;
         dbf = DocumentBuilderFactory.newInstance ();
              db = dbf.newDocumentBuilder ();
              doc = db.newDocument ();
              root = doc.createElement ("album");
              doc.appendChild (root);
              poline= doc.createElement("album-name");
              root.appendChild(poline);
    //I am getting the ClassCastException in this statement
              xmldoc = (XmlDocument) doc;
              fos = new java.io.FileOutputStream("xyz.xml");
              xmldoc.write(fos);
              fos.close();
    }

    I am not too much of an expert on this issue, but I did a search. Maybe this page can help or point you in the right direction.
    http://www.jspwiki.org/Wiki.jsp?page=A2AClassCastException
    I hope this helps.

  • Validating an XML document to a schema using ColdFusion

    This is something I have never tried before.  We created an XML Schema  to define XML documents we expect to receive from various entities.   When we receive the document, we would like to validate it before  processing it.  I think ColdFusion is up to this from reading the  documentation, but we have not got anything working yet.
    When we try and xmlParse() our test XML file against the XML schema we  get the following error.  When we use a web based XML validation tool  and feed it the same XML file and schema it validates just fine.
    An error occured while parsing an XML document.
    [Error] :2:6: cvc-elt.1: Cannot find the declaration of element 'pur'.
    The error occurred in D:\playground\warren\ppur_file_import.cfm: line 57
    55 :
    56 :
    57 : <cfset xmldoc = XmlParse(ExpandPath(filepath), true,  ExpandPath(validator)) />
    58 : <cfdump var="#xmldoc#">
    59 : <cfabort>
    Searching for the error has not provided me any useful hints.  Can  anybody here?

    XML SCHEMA
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <!-- Simple Types -->
         <xs:simpleType name="RECORD_ID">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[AaBbCc]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="REPORT_MONTH">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="(0[1-9]|1[0-2])"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="REPORT_YEAR">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{2}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="MFG_FIRMNO">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{7}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="LABEL_SEQ_NO">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{5}"/>
              </xs:restriction>
         </xs:simpleType>     
         <xs:simpleType name="REVISION_NO">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[A-Za-z]{2}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="REG_FIRMNO">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{7}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="GROWER_ID">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{11}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="CEDTS_IND">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[Ee]|[ ]"/>
                   <!-- needs to match E or a blank. -->
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="APPLIC_DT">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])([0-9]{2})"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="SITE_CODE">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{6}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="QUALIFY_CD">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{2}"/>
              </xs:restriction>
         </xs:simpleType>     
         <xs:simpleType name="PLANTING_SEQ">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ACRE_TREATED">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{8}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="UNIT_TREATED">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[ATSCKUPatsckup]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="AMT_PRD_USED">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{10}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="UNIT_OF_MEAS">
              <xs:restriction base="xs:string">
                   <xs:pattern value="LB|OZ|GA|QT|PT|KG|GR|LI|ML"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="DOCUMENT_NO">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{8}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="LINE_ITEM">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{4}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="PROCESS_DT">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{4}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="BATCH_NO">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-5][0-9][0-9][0-9]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="COUNTY_CD">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-5][0-9]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="SECTION">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{2}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="TOWNSHIP">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{2}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="TSHIP_DIR">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[NSns]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RANGE">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{2}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RANGE_DIR">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[EWew]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="BASE_LN_MER">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[HMShms]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="AER_GND_IND">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[AFGOafgo]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="SITE_LOC_ID">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[-0-9 ]+"/>
                   <!-- Examples in files I checked
                         only had numeric characters and
                         a dash. The county contract doesn't
                         specify numeric-only, so letters may
                         be acceptable. I find no evidence of
                         any letters being used. -->
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ACRE_PLANTED">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{8}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="UNIT_PLANTED">
              <xs:restriction base="xs:string">
                   <xs:pattern value="[ATSCKUPatsckup]"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="APPLIC_TM">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{4}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="APPLIC_CNT">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{6}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="FUME_CD">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[0-9]{4}"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="LICENSE_NO">
              <xs:restriction base="xs:integer">
                   <xs:pattern value="[-0-9A-Za-z]{13}"/>
              </xs:restriction>
         </xs:simpleType>
         <!-- end Simple Types -->
         <!-- !!!!!!!!! Begin Abstract Types !!!!!!!!! -->
         <xs:complexType name="application_data_abs" abstract="true">
              <xs:sequence>          
                   <xs:element name="GROWER_ID" type="GROWER_ID" />                    
                   <xs:element name="CEDTS_IND" type="CEDTS_IND" />
                   <xs:element name="APPLIC_DT" type="APPLIC_DT" />     
                   <xs:element name="SITE_CODE" type="SITE_CODE" />               
                   <xs:element name="QUALIFY_CD" type="QUALIFY_CD" />
                   <xs:element name="PLANTING_SEQ" type="PLANTING_SEQ" />
                   <xs:element name="ACRE_TREATED" type="ACRE_TREATED" />                         
                   <xs:element name="UNIT_TREATED" type="UNIT_TREATED" />
                   <xs:element name="AMT_PRD_USED" type="AMT_PRD_USED" />
                   <xs:element name="UNIT_OF_MEAS" type="UNIT_OF_MEAS" />               
                   <xs:element name="DOCUMENT_NO" type="DOCUMENT_NO" />                         
                   <xs:element name="LINE_ITEM" type="LINE_ITEM" />
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="application_abs" abstract="true">
              <xs:sequence>
                   <xs:element name="key_data" type="key_data" />
                   <xs:element name="product_data" type="product_data" />
              </xs:sequence>
         </xs:complexType>
         <!-- !!!!!!!!! End Abstract Types !!!!!!!!! -->
         <!-- !!!!!!!!! Start Complex Types !!!!!!!!! -->
         <xs:complexType name="product_data">
              <xs:sequence>
                   <xs:element name="MFG_FIRMNO" type="MFG_FIRMNO" />               
                   <xs:element name="LABEL_SEQ_NO" type="LABEL_SEQ_NO"/>                         
                   <xs:element name="REVISION_NO" type="REVISION_NO" />
                   <xs:element name="REG_FIRMNO" type="REG_FIRMNO" />               
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="key_data">
              <xs:sequence>
                   <xs:element name="RECORD_ID" type="RECORD_ID" />     
                   <xs:element name="COUNTY_KEY">
                        <!--
                             The optional COUNTY_ID field would be used by
                             the Counties to include their internal
                             record identifier. This would allow DPR
                             to reference a county's internal record ID
                             in the event of data inconsistencies.
                        -->
                   </xs:element>
                   <xs:element name="REPORT_MONTH" type="REPORT_MONTH" />
                   <xs:element name="REPORT_YEAR" type="REPORT_YEAR" />
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="fileInfo">
              <xs:sequence>
                   <xs:element name="PROCESS_DT" type="PROCESS_DT" />                              
                   <xs:element name="BATCH_NO" type="BATCH_NO" />
                   <xs:element name="COUNTY_CD" type="COUNTY_CD" />
              </xs:sequence>
         </xs:complexType>     
         <xs:complexType name="mtrs_data">
              <xs:sequence>
                   <xs:element name="SECTION" type="SECTION" />
                   <xs:element name="TOWNSHIP" type="TOWNSHIP" />                                        
                   <xs:element name="TSHIP_DIR" type="TSHIP_DIR" />
                   <xs:element name="RANGE" type="RANGE" />
                   <xs:element name="RANGE_DIR" type="RANGE_DIR" />
                   <xs:element name="BASE_LN_MER" type="BASE_LN_MER" />
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="ag_application_data">
              <xs:complexContent>
                   <xs:extension base="application_data_abs">
                        <xs:sequence>                                             
                             <xs:element name="AER_GND_IND" type="AER_GND_IND" />
                             <xs:element name="SITE_LOC_ID" type="SITE_LOC_ID" />
                             <xs:element name="ACRE_PLANTED" type="ACRE_PLANTED" />
                             <xs:element name="UNIT_PLANTED" type="UNIT_PLANTED" />
                             <xs:element name="APPLIC_TM" type="APPLIC_TM" />
                             <xs:element name="FUME_CD" type="FUME_CD" />
                        </xs:sequence>
                   </xs:extension>
              </xs:complexContent>
         </xs:complexType>
         <xs:complexType name="nonag_application_data">
              <xs:complexContent>
                   <xs:extension base="application_data_abs">
                        <xs:sequence>                                        
                             <xs:element name="APPLIC_CNT" type="APPLIC_CNT" />
                             <xs:element name="LICENSE_NO" type="LICENSE_NO" />
                        </xs:sequence>
                   </xs:extension>
              </xs:complexContent>
         </xs:complexType>
         <!--- "Ag" -->
         <!--
              Type A:
              Data that would appear on individual lines
              in the old A type
              (F file type, agricultural job report)
              Type B:
              Data that would appear on individual lines
              in the old B type
              (F file type, agricultural monthly production summary)
         -->     
         <xs:complexType name="ag_application">
              <xs:complexContent>
                   <xs:extension base="application_abs">
                        <xs:sequence>                                        
                             <xs:element name="mtrs_data" type="mtrs_data" />
                             <xs:element name="application_data" type="ag_application_data" />
                        </xs:sequence>
                   </xs:extension>
              </xs:complexContent>
         </xs:complexType>
         <!--- "Non_Ag" -->     
         <!--
              Data that would appear on individual lines
              in the old C type
              (C file type, non-agricultural monthly summary)
         -->          
         <xs:complexType name="nonag_application">
              <xs:complexContent>
                   <xs:extension base="application_abs">
                        <xs:sequence>                                        
                             <xs:element name="application_data" type="nonag_application_data" />
                        </xs:sequence>
                   </xs:extension>
              </xs:complexContent>
         </xs:complexType>
         <!-- The individual lines of data that are transmitted. -->
         <xs:complexType name="data_lines">
              <xs:sequence>                                        
                   <xs:element name="Non_Ag" type="nonag_application" minOccurs="0" maxOccurs="unbounded"/>
                   <xs:element name="Ag" type="ag_application" minOccurs="0" maxOccurs="unbounded"/>                    
              </xs:sequence>
         </xs:complexType>
         <!-- !!!!!!!!! End Complex Types !!!!!!!!! -->
         <xs:element name="pur">     
              <xs:complexType>
                   <xs:sequence>               
                        <xs:element name="County" minOccurs="0" maxOccurs="1">
                             <!--
                                  Tag for counties to put county-specific
                                  data in (eg, their batch number, timestamp,
                                  contact info, etc)
                             -->
                        </xs:element>
                        <!-- File: information specific to the file -->               
                        <xs:element name="File" type="fileInfo" minOccurs="1" maxOccurs="1"/>
                        <!-- Data: lines of data transmitted -->
                        <xs:element name="Data" type="data_lines" minOccurs="1" maxOccurs="1"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>

  • Serializing an XML document

    Hello, I recently downloaded the Java XML Pack, which uses the Xerces2 XML Parser. A couple of questions with regards to serializing an XML document to a file:
    1) Xerces1 used the org.apache.xml.serialize.* classes to do serialization (such as shown below), but I don't see them in the Xerces2 API. Which packages take over for these in Xerces2?
    import org.apache.xml.serialize.Serializer;
    import org.apache.xml.serialize.SerializerFactory;
    import org.apache.xml.serialize.XMLSerializer;
    2) If we use the JAXP wrapper functionality to serialize instead, is the javax.xml.transform package the standard way to do this in 1.2?--from the examples I've seen searching this forum, this appears to be the case.
    Thanks,
    Glen

    If you want to output your XML to a file, say, then yes the Transformer is the way to do it now. Don't know why they did that, it's far from intuitively obvious.

  • How to parse multiple xml documents from single buffer

    Hello,
    I am trying to use jaxb 2.0 to parse a buffer which contains multiple xml documents. However, it seems that it is meant to only parse a single document at a time and throws an exception when it gets to the 2nd document.
    Is there a way I can tell jaxb to only parse the first complete document and not fetch the next one out of the buffer? Or what is the most efficient way to separate the buffer into two documents without parsing it manually. If I have to search the buffer for the next document root and then split the buffer, it seems like that defeats the purpose of using jaxb as the parser.
    I am using the Unmarshaller.unmarshall method and the exception I am getting is:
    org.xml.sax.SAXParseException: Illegal character at end of document, &#x3c;.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:476)
         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:198)
         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:167)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
    Thank you for your help

    It's just like any other XML parser, it's only designed to parse one XML document. If you have something that concatenates two XML documents together (that's what your "buffer" sounds like), then stop doing that.

  • Embedding XSL in XML document

    Hi
    I am new to this particular forum. I had some query regarding embedding XSL .
    Can we embedd the XSL stylesheet in the XML document itself.
    I searched this forum and got some similar queries but the output isn't working. Can anyone put a working example.
    I have got the following XSL stylesheet:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <body>
    <table border="1" width="100%" cellpadding="1">
    <tr bgcolor="#FFFF99">
    <th style="font-family:arial unicode ms;font-size:100%" align="center">Serial number </th>
    <th style="font-family:arial unicode ms;font-size:100%" align="center">Site number </th>
    </tr>
    <xsl:for-each select="Master/RECORD">
    <xsl:if test="SR_NO &gt; 0">
    <tr>
    <td style="font-family:arial unicode ms;font-size:80%" align="right"><xsl:value-of select="SR_NO"/></td>
    <td style="font-family:arial unicode ms;font-size:80%" align="right"><xsl:value-of select="ACR_SNO"/></td>
    </tr>
    </xsl:if>
    </xsl:for-each>
    </table>
    </body>
    </xsl:template>
    </xsl:stylesheet>
    The XML document is as below:
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="archivingmaster.xsl"?>
    <Master>
    <RECORD>
    <SR_NO>1</SR_NO>
    <ACRSNO>1</ACR_SNO>
    </RECORD>
    <RECORD>
    <SR_NO>2</SR_NO>
    <ACRSNO>2</ACR_SNO>
    </RECORD>
    </Master>
    Thanks in advance
    Ameya.

    I have already gone through that link and searched for this on the net. But it doesn't seem to work on my Mozilla Firefox browser.
    Can anybody put a working example if possible.
    Thanks
    Ameya.

  • 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 object access problem?

    Hi,
    I have created a servlet,which will call .sh file, which will call java application.........
    this java application is working as a search engine,which will do search in the XML document object...........This is working fine when only one user run this servlet...........But when more than servlet do the same it is not working......... But once first servlet create the Document object,which is main source for serching..........then second servlet will work fine.......same thing with third servlet and so on...... I used the thread.sleep()/synchronize but it is not working...bcoz i am accessing the same application.....Then instead of servlet i tried to run the java application from the Dos prompt..........But i am facing the same problem......So pl guide me bcoz everything is working excluding this..........Becoz this document object creation is taking some time........ i am creating the object shown below
    Document doc =parseXmlFile("Article.xml", false);
    Element docElem = doc.getDocumentElement();
    public static org.w3c.dom.Document parseXmlFile(String filename, boolean validating)
                   try {
         // Create a builder factory
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setValidating(validating);
         // Create the builder and parse the file
         // org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(filename);
         org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(new File(filename));
         return doc;
    } catch (SAXException e) {
    // A parsing error occurred; the xml input is not valid
    } catch (ParserConfigurationException e) {
    } catch (IOException e) {
    return null;
    }

    Hi,
    This is my Servlet code..............
    package PW.Feed;
    import java.io.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class PrintDom extends HttpServlet
         Document doc;
         Element docElem;
         Connection Conn=null;
         Statement stmt=null,stmt1=null;
         ResultSet rs1=null,rs=null;
         PrintWriter out;
         Vector myVector1=new Vector();
         Vector myVector2=new Vector();
         String strSql="";
         public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
              res.setContentType("text/html");
              out=res.getWriter();
              try
                   String pubtype=req.getParameter("PubType");
                   String pubDate=req.getParameter("PubDate");
                   String toDate=req.getParameter("ToDate");
                   String fromDate=req.getParameter("FromDate");
                   if(pubDate==null)pubDate="2";
                   if(toDate==null)toDate="02/09/2005";
                   if(fromDate==null)fromDate="02/08/2005";
                   Class.forName("org.firebirdsql.jdbc.FBDriver");
                   Conn = DriverManager.getConnection("jdbc:firebirdsql:192.168.0.15/3050:D:/FBDatabases/PW1.GDB","SYSDBA","cohezia");
                   //Conn = DriverManager.getConnection("jdbc:firebirdsql:192.168.0.99/3050:/share/pw1.gdb","SYSDBA","cohezia");
                   stmt = Conn.createStatement( );
                   if(pubDate.equals("2"))
                        strSql="Select sh.ARTICLEID,sh.cuttingsdate,sh.READDATE,sh.headline,sh.SUMMARY,sh.AUTHOR,sh.PAGEFROM,sh.PUB_NAME,sh.READER_NAME,sh.PARENTTITLE,sh.CANMAIL,sh.PUBLICATION_ID,sh.JOURNALIST_ID,sh.ISPDF FROM SCANSHEADER sh,PUBLICATIONS p where sh.publication_id=p.publication_id and sh.readdate>'"+fromDate+"' and sh.readdate<'"+toDate+"' and p.pubtype='"+ pubtype +"' order by sh.ARTICLEID";
                   else
                        strSql="Select sh.ARTICLEID,sh.cuttingsdate,sh.READDATE,sh.headline,sh.SUMMARY,sh.AUTHOR,sh.PAGEFROM,sh.PUB_NAME,sh.READER_NAME,sh.PARENTTITLE,sh.CANMAIL,sh.PUBLICATION_ID,sh.JOURNALIST_ID,sh.ISPDF FROM SCANSHEADER sh,PUBLICATIONS p where sh.publication_id=p.publication_id and sh.cuttingsdate>'"+fromDate+"' and sh.cuttingsdate<'"+toDate+"' and p.pubtype='"+ pubtype +"' order by sh.ARTICLEID";
                   rs=stmt.executeQuery(strSql);
                   DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                   doc = builder.newDocument();
                   docElem = doc.createElement("RECORDLIST");
                   doc.appendChild(docElem);
                   Element rootElem = doc.createElement("RECORDS");
                   docElem.appendChild(rootElem);
                   String artid="";
                   while(rs.next())
                             Element artElem = doc.createElement("RECORD");
                             if((rs.getString("ARTICLEID")).length()>0)artElem.setAttribute("id",rs.getString("ARTICLEID"));
                             rootElem.appendChild(artElem);
                             Element rootFieldElem = doc.createElement("FIELDS");
                             artElem.appendChild(rootFieldElem);
                             Element eleCuttingDate = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleCuttingDate);
                             eleCuttingDate.setAttribute("fieldName","CUTTINGSDATE");
                             if((rs.getString("CUTTINGSDATE")).length()>0) eleCuttingDate.appendChild(doc.createTextNode(rs.getString("CUTTINGSDATE")));
                             Element eleReadDate = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleReadDate);
                             eleReadDate.setAttribute("fieldName","READDATE");
                             if((rs.getString("READDATE")).length()>0) eleReadDate.appendChild(doc.createTextNode(rs.getString("READDATE")));
                             Element eleHeadLine = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleHeadLine);
                             eleHeadLine.setAttribute("fieldName","HEADLINE");
                             if((rs.getString("HEADLINE")).length()>0) eleHeadLine.appendChild(doc.createTextNode(rs.getString("HEADLINE")));
                             Element eleSummary = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleSummary);
                             eleSummary.setAttribute("fieldName","SUMMARY");
                             if(rs.getString("SUMMARY")==null){
                                  //out.println("String is null");
                                  else
                                  {eleSummary.appendChild(doc.createTextNode(rs.getString("SUMMARY")));}
                             Element eleAuthor = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleAuthor);
                             eleAuthor.setAttribute("fieldName","AUTHOR");
                             if((rs.getString("AUTHOR")).length()>0) eleAuthor.appendChild(doc.createTextNode(rs.getString("AUTHOR")));
                             Element elePageFrom = doc.createElement("FIELD");
                             rootFieldElem.appendChild(elePageFrom);
                             elePageFrom.setAttribute("fieldName","PAGEFROM");
                             if((rs.getString("PAGEFROM")).length()>0) elePageFrom.appendChild(doc.createTextNode(rs.getString("PAGEFROM")));
                             Element elePubName = doc.createElement("FIELD");
                             rootFieldElem.appendChild(elePubName);
                             elePubName.setAttribute("fieldName","PUBNAME");
                             if((rs.getString("PUB_NAME")).length()>0) elePubName.appendChild(doc.createTextNode(rs.getString("PUB_NAME")));
                             Element eleReaderName = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleReaderName);
                             eleReaderName.setAttribute("fieldName","READER NAME");
                             if((rs.getString("READER_NAME")).length()>0) eleReaderName.appendChild(doc.createTextNode(rs.getString("READER_NAME")));
                             Element eleParentTitle = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleParentTitle);
                             eleParentTitle.setAttribute("fieldName","PARENTTITLE");
                             if((rs.getString("PARENTTITLE")).length()>0)eleParentTitle.appendChild(doc.createTextNode(rs.getString("PARENTTITLE")));
                             Element eleCanMail = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleCanMail);
                             eleCanMail.setAttribute("fieldName","CANMAIL");
                             if((rs.getString("CANMAIL")).length()>0) eleCanMail.appendChild(doc.createTextNode(rs.getString("CANMAIL")));
                             Element elePublicationID = doc.createElement("FIELD");
                             rootFieldElem.appendChild(elePublicationID);
                             elePublicationID.setAttribute("fieldName","PUBLICATION_ID");
                             if((rs.getString("PUBLICATION_ID")).length()>0) elePublicationID.appendChild(doc.createTextNode(rs.getString("PUBLICATION_ID")));
                             Element eleJournlistID = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleJournlistID);
                             eleJournlistID.setAttribute("fieldName","JOURNALIST_ID");
                             if((rs.getString("JOURNALIST_ID")).length()>0) eleJournlistID.appendChild(doc.createTextNode(rs.getString("JOURNALIST_ID")));
                             Element eleIspdf = doc.createElement("FIELD");
                             rootFieldElem.appendChild(eleIspdf);
                             eleIspdf.setAttribute("fieldName","ISPDF");
                             if((rs.getString("ISPDF")).length()>0) eleIspdf.appendChild(doc.createTextNode(rs.getString("ISPDF")));
                             Element rootKeyElem=doc.createElement("KEYWORDS_CODES");
                        String[] arrCodes=getKeyCodes(rs.getString("ARTICLEID"));
                        int count1 = myVector1.size();
                        String[] myArray1=new String[count1];
                        myVector1.copyInto(myArray1);
                        int count2 = myVector2.size();
                        String[] myArray2=new String[count2];
                        myVector2.copyInto(myArray2);
                        for(int j=0;j<arrCodes.length;j++)
                             Element eleKeyword= doc.createElement("KEYWORD_CODE");
                             eleKeyword.setAttribute("CodeId",arrCodes[j]);
                             eleKeyword.setAttribute("LongName",myArray1[j]);
                             eleKeyword.setAttribute("CodeType",myArray2[j]);
                             rootKeyElem.appendChild(eleKeyword);
                        artElem.appendChild(rootKeyElem);
                   Source source = new DOMSource(docElem);
                   //File file = new File("/share/PrintDom.xml");
                   StringWriter rw=new StringWriter();
                   Result result = new StreamResult(rw);
                   //Result result = new DOMResult();
                   // Write the DOM document to the file
                   Transformer xformer = TransformerFactory.newInstance().newTransformer();
                   xformer.transform(source, result);
                   out.println(rw);
              catch (ClassNotFoundException e)
                        out.println("Unable to load Driver Class" + e);
                        return;
                        //fileLog.log(e,"PressWatchFrame1.PressWatchFrame1()");
              catch (SQLException se)
                   out.println(se);
              catch (Exception e)
                   out.println(e);
    finally{
                        try{
                             if(Conn!=null) Conn.close();
                        catch(SQLException ignored){}
         public String[] getKeyCodes(String strArticleId)
              Vector myVector=new Vector();
              myVector1.removeAllElements();
              myVector2.removeAllElements();
         try{
              stmt1=Conn.createStatement( );
              //String strSql1="Select codeid FROM SCANSSUBJECT where articleid='"+ strArticleId +"'";
              String strSql1="Select ss.codeid,c.longname,c.codetype FROM SCANSSUBJECT ss,CODES c where ss.codeid=c.codeid and articleid='"+ strArticleId +"'";
              rs1=stmt1.executeQuery(strSql1);
              String strCodes="";
              while(rs1.next())
                   myVector.add(rs1.getString("codeid"));
                   myVector1.add(rs1.getString("longname"));
                   myVector2.add(rs1.getString("codetype"));
              }catch (SQLException se)
                                       out.println(se);
              int count = myVector.size();
              String[] myArray = new String[count];
              myVector.copyInto(myArray);
              return myArray;
    ..................Thanx

  • Inserting XML document into XDB fails with can't convert to OPAQUE

    Hi,
    When I try to insert a document using oracle 9.2.0.5 client software into a 9.2.0.5 database, with the following code:
    void insertDocument(String document) {
    XMLType xt = XMLType.createXML(connection, document);
    PreparedStatement ps = connection.prepareStatement("insert into xmldocuments values(?)");
    ps.setObject(1, xt);
    ps.executeUpdate();
    The setObject function always throws an exception (after a very long time) with:
    java.sql.SQLException: Fail to convert to internal representation: OPAQUE()
    This also fails when we use the InputStream and org.w3c.xml.Document variants.
    We use the OCI driver, otherwise we get errors retrieving the documents from XMLDB.
    What is going wrong here?

    David,
    If you search through the historical data in this list there are previous post regarding opaque.
    These may be useful. Possibly your reaching the size limit.

Maybe you are looking for

  • Is it possible to insert text in a picture in Lightroom?

    Is it possible to insert text in a picture in Lightroom?

  • Deleting multiple duplicates

    Is there a way of duplicating all duplicate songs without clicking on each one? My complete library is in triplicate.

  • AE CS3 crashes when setting audio format options for MP3

    I've just submitted a bug report, but I wanted to see if anyone experienced this or have any suggestion. Basically, when I add an MP3 audio to a comp, and trying to make a movie (exporting it as uncompressed QT), when I press the Format Options butto

  • Sleep and to hot to touch problem

    I'm reading all these problems about the MBP getting to hot to touch while sleeping (not). I haven't seen anybody put all there specs down. I think it is a graphics card driver problem but can't be sure because not everyone has said if they're using

  • Working with SM30

    hi all,        i dont wanna display SAP Menu on the Easy access screen, so i used SM30 to modify the table SSM_CUST. but it shows it is cross client, you are not allowed to change cross client. im a super user in my client and authorization is Sap_al