DTD is prohibited in this XML document. (System.xml)

Hi,
I am having issue with my SSRS report, XML Data Source, when I am try to execute my query I get this error:
"Could not generate a list of fields for the query. Check the query syntax or click refresh Fields on the query
Toolbar. DTD is prohibited in this XML document."
This my query:
<Query>
  <ElementPath>Action {}/Step {Obj,Details,Time,NodeArgs}</ElementPath>
</Query>
This is my Connection string:
http://localhost/results.xml?NoRedirect=true
Please help;
Angel C. Barrientos
angelatino2013

Below link may be helpful,
http://social.technet.microsoft.com/Forums/sqlserver/en-US/11b1a418-7c70-4318-9535-6a60dd26539d/dtd-is-prohibited-in-this-xml-document-systemxml-error-while-accessing-xml-file-of-form-library?forum=sqlreportingservices
Regards, RSingh

Similar Messages

  • For security reasons DTD is prohibited in this XML document in sharepoint

    Hi,
     I am new SharePoint and still learning it.
     I have been tasked to do the following on office 365 E3 SharePoint 2013 Online edition.
     1) I have to create a Web page in asp.net
     2) This page needs to show document from a given SharePoint folder and bind them in a grid
      My code is in C#
                            ClientContext clientContextApp = new ClientContext("Apps Url");
                            clientContextApp = SPOAuthe(clientContextApp);
                            List oListDocuments = clientContextApp.Web.Lists.GetByTitle("Documents");
                            CamlQuery camlQueryDoc = new CamlQuery();
                            var qDocuments = new CamlQuery() { ViewXml = "<View><Query><Where><Eq><FieldRef Name='Externalurl'
    /><Value Type='URL'>" + decodedUrl + "</Value></Eq></Where></Query></View>" };
                            Microsoft.SharePoint.Client.ListItemCollection collListItemDoc = oListDocuments.GetItems(qDocuments);
                            clientContextApp.Load(collListItemDoc);
                            clientContextApp.ExecuteQuery();
                            foreach (Microsoft.SharePoint.Client.ListItem oListItemDoc in collListItemDoc)
                                startDate = Convert.ToDateTime(oListItemDoc["StartDate"].ToString());
                                endDate = Convert.ToDateTime(oListItemDoc["_EndDate"].ToString());
                                currentDate = System.DateTime.Now;
                                documentLocation = ((FieldUrlValue)oListItemDoc["DocumentLocation"]).Url.ToString();
          but it is following error occurred LINE-9(clientContextApp.ExecuteQuery();).
          "For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method"
                           What is missing my code?
     I am not also not sure what is the best way of achieving the functionality this?
     Thanks
     Krishna

    Below link may be helpful,
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/11b1a418-7c70-4318-9535-6a60dd26539d/dtd-is-prohibited-in-this-xml-document-systemxml-error-while-accessing-xml-file-of-form-library?forum=sqlreportingservices
    Regards, RSingh

  • I am getting this error when i am doing CSOM on project server..For security reasons DTD is prohibited in this XML document.

    before two day my csom code was working fine..but from last two days when i tried to execute my code i am getting this error..
    For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.

    Found in negative cache.... very strange.
    RFC found in negative cache
    What is the negative cache?

  • Getting inner exception "dtd is prohibited in this xml document exchange" while reading emails from outlook

    Getting error "The response received from the service didn't contain valid XML." with inner exception "dtd is prohibited in this xml document exchange" while reading emails from outlook(Not while reading every mail).
    Can anybody please tell me what might be the issue. Below is the code where I am getting error
    FindItemsResults<Item> RetrievedItems=null ;
    RetrievedItems = service.FindItems(FIds, new ItemView(4));
    String[] SignatureList = ConfigurationManager.AppSettings.Get("SignatureTypes").Split(',');
    if (RetrievedItems != null && RetrievedItems.Count() > 0)
    RetrievedItems.ToList().ForEach(x =>
    try
    List<String> Attachments = new List<String>();
    List<String> ScanFileName = new List<String>();
    bool IsAvailable = true;
    //Getting error while Load() - below line of code
    ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).Load();
    Vo.EmailMessage msg = new Vo.EmailMessage();
    msg.MessageId = ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).Id.UniqueId;
    msg.From = ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).From.Address;
    ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).ToRecipients.ToList().ForEach(z => msg.To += z.Address + ",");
    ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).ReplyTo.ToList().ForEach(y => msg.ReplyToEmailAddress += y.Address + ",");
    msg.Subject = ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).Subject;
    msg.Body = ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).Body.Text;
    msg.Dated = ((Microsoft.Exchange.WebServices.Data.EmailMessage)x).DateTimeSent;
    Please help.

    Hi,
    Thank you for your post.
    This is a quick note to let you know that we are performing research on this issue.
    Niko Cheng
    TechNet Community Support

  • Got error message when store XML documents into XML DB repository, via WebD

    Hi experts,
    I am in I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
    I got error message when store XML documents into XML DB repository, via WebDAV.
    I have successfully registered 5 related schemas and generated 1 table.
    I have inserted 40 .xml files into this auto generated table.
    using these data I created relational view successfully.
    but since I couldn't store XML documents into XML DB repository, via WebDAV
    when I query using below code:
    SELECT rv.res.getClobVal()
    FROM resource_view rv
    WHERE rv.any_path = '/home/DEV/messages/4fe1-865d-da0db9212f34.xml';
    I got nothing.
    My ftp code is listed below:
    ftp> open localhost 2100
    Connected to I0025B368E2F9.
    220- C0025B368E2F9
    Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
    220 I0025B368E2F9 FTP Server (Oracle XML DB/Oracle Database) ready.
    User (I0025B368E2F9:(none)): fda_xml
    331 pass required for FDA_XML
    Password:
    230 FDA_XML logged in
    ftp> cd /home/DEV/message
    250 CWD Command successful
    ftp> pwd
    257 "/home/DEV/message" is current directory.
    ftp> ls -la
    200 PORT Command successful
    150 ASCII Data Connection
    drw-r--r-- 2 FDA_XML oracle 0 DEC 17 19:19 .
    drw-r--r-- 2 FDA_XML oracle 0 DEC 17 19:19 ..
    226 ASCII Transfer Complete
    ftp: 115 bytes received in 0.00Seconds 115000.00Kbytes/sec.
    250 SET_CHARSET Command Successful
    ftp> put C:\ED\SPL\E_Reon_Data\loaded\4fe1-865d-da0db9212f34.xml
    200 PORT Command successful
    150 ASCII Data Connection
    550- Error Response
    ORA-00600: internal error code, arguments: [qmxConvUnkType], [], [], [], [], [], [], [], [], [], [], []
    550 End Error Response
    ftp: 3394 bytes sent in 0.00Seconds 3394000.00Kbytes/sec.
    I have tried all suggestion from another thread such as:
    alter system set events ='31150 trace name context forever, level 0x4000'
    SQL> alter system set shared_servers = 1;
    but failed.
    is there anyone can help?
    Thanks.
    Edited by: Cow on Mar 29, 2011 12:58 AM

    Hi experts,
    I am in I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
    I got error message when store XML documents into XML DB repository, via WebDAV.
    I have successfully registered 5 related schemas and generated 1 table.
    I have inserted 40 .xml files into this auto generated table.
    using these data I created relational view successfully.
    but since I couldn't store XML documents into XML DB repository, via WebDAV
    when I query using below code:
    SELECT rv.res.getClobVal()
    FROM resource_view rv
    WHERE rv.any_path = '/home/DEV/messages/4fe1-865d-da0db9212f34.xml';
    I got nothing.
    My ftp code is listed below:
    ftp> open localhost 2100
    Connected to I0025B368E2F9.
    220- C0025B368E2F9
    Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
    220 I0025B368E2F9 FTP Server (Oracle XML DB/Oracle Database) ready.
    User (I0025B368E2F9:(none)): fda_xml
    331 pass required for FDA_XML
    Password:
    230 FDA_XML logged in
    ftp> cd /home/DEV/message
    250 CWD Command successful
    ftp> pwd
    257 "/home/DEV/message" is current directory.
    ftp> ls -la
    200 PORT Command successful
    150 ASCII Data Connection
    drw-r--r-- 2 FDA_XML oracle 0 DEC 17 19:19 .
    drw-r--r-- 2 FDA_XML oracle 0 DEC 17 19:19 ..
    226 ASCII Transfer Complete
    ftp: 115 bytes received in 0.00Seconds 115000.00Kbytes/sec.
    250 SET_CHARSET Command Successful
    ftp> put C:\ED\SPL\E_Reon_Data\loaded\4fe1-865d-da0db9212f34.xml
    200 PORT Command successful
    150 ASCII Data Connection
    550- Error Response
    ORA-00600: internal error code, arguments: [qmxConvUnkType], [], [], [], [], [], [], [], [], [], [], []
    550 End Error Response
    ftp: 3394 bytes sent in 0.00Seconds 3394000.00Kbytes/sec.
    I have tried all suggestion from another thread such as:
    alter system set events ='31150 trace name context forever, level 0x4000'
    SQL> alter system set shared_servers = 1;
    but failed.
    is there anyone can help?
    Thanks.
    Edited by: Cow on Mar 29, 2011 12:58 AM

  • Using "XML Document from XML Schema" in JDeveloper

    Hi Experts,
    I have a requirement to generate XML Document from XML Schema.
    For this I have used "XML Document from XML Schema" feature in JDeveloper. It is found in File->New->General->XML Document form XML Schema.
    I have registered a schema with jdev and got an XML document output for that successfully.
    Now, I want to implement this feature in my code for generating XML documents when XSD files are provided.
    Can any one please provide me with pointers to do that? I am sure there should be some libraries which can implement this feature.
    Thanks,
    Dilbagh

    Create an XML document from a Schema with the Oracle SchemaClassGenerator.
    import oracle.xml.classgen.SchemaClassGenerator;
    XMLSchema schema=new XMLSchema();
    XSDBuilder builder = new XSDBuilder();
    URL    url =  new URL(schemaUrl);     
    schema = (XMLSchema)builder.build(url);
    SchemaClassGenerator generator = new SchemaClassGenerator();
    Generate the Java classes from the example XML Schema.
    generator.generate(schema);With the java classes construct an XML document.

  • How to convert XML document to xml variable?

    Hi,
    I have taken an xml variable in my process and reading a xml document file. Can anyone tell me how can i convert this xml document to xml variable so that i can parse the xml variable.
    I am able to convert xml variable to xml document variable by using set value activity. But how do I perform reverse process.
    I want to perform this conversion because i want to keep xml data in document format on storage drive and then parse this xml data so that i can read the nodes.
    Any help will be appreciated..
    Regards
    Sunil

    we can use set value activity to reach these xml docs and assign it to xml variable.
    Then parsing of this xml can be browsed to find the nodes.
    Regards
    Sunil

  • XML Document from XML Schema Bug

    When an XML document is generated from an XML Schema the XML document does not have all the elements specified in the XML Schema. The XML document only has the root element.
    1. Register an XML Schema.
    2. Create an XML document with File>New>General>XML>XML Document from XML Schema. The "Generate only Required Elements" is unchecked.
    3. The XML document has only the root element.
    In JDeveloper 10.1.3 all the elements in the XML Schema get generated.

    Also, the component palette for the XML document generated from the XML Schema does not list all the elements in the XML Schema, only the root element is listed. Even if elements are specified as required in the XML Schema with minOccurs="1" and the "Generate only Required Elements" checkbox is selected only the root element gets generated.

  • Error while generating an XML Document from XML Schema with JAXB

    Hi,
    I am following this OTN tutorial to generate the XML document from Java classes got from the XSD document.
    http://www.oracle.com/technology/pub/notes/technote_jaxb.html
    I am able to generate all the Java classes but getting error on compiling the XMLConstructor.java class which is use for generating the XML document :
    I am using JDK 1.5 and
    Oracle 10g XML Developer's Kit (XDK) Production for Java. xdk_nt_10_1_0_2_0_production
    (though these are warnings I am not able to run it.)
    Error
    C:\Prototype\classes\jaxbderived\catalog>javac -Xlint XMLConstructor.java
    warning: [path] bad path element "%CLASSPATH%": no such file or directory
    XMLConstructor.java:42: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
    journalList.add(journal);
    ^
    XMLConstructor.java:46: warning: [unchecked] unchecked call to add(E) as a membe
    r of the raw type java.util.List
    articleList.add(article);
    Thanks
    Sanjeev ([email protected])

    Use JDK 1.4.

  • XMLTYPE as CLOB storage "inserting large xml document in xml type column"

    Hi All,
    i have a table containing an xml datatype(non schema based)
    i would like to insert a large xml document in it
    but an exception is thrown-->"string literal too long"
    i tried to use bind variables as a solution"prepared statements as i write in java"
    but it didn't work....as xml document is large
    when i tried to change the column type to CLOB,it worked but without xml validataion,
    although the xml type is mapped to a CLOB in storage, xml type couldn't insert the document
    if anyone have a solution plz tell,i needed it urgently
    thanks,in advance :-)

    thx it was very useful :-)
    but i am not having any success getting the following statement working using a JDBC connection pool rather than a hard coded URL connection
    tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    it works with:
    "jdbc:oracle:thin:@server:port:dbname"
    Does NOT work with:
    datasource.getConnection()
    if anyone colud help...

  • "DTD is prohibited" error when accessing sharepoint 2013/office365 list (but not openly aware of using XML)

    I've been getting a list of folders and files from Sharepoint (on Office 365) by using the following C# code...
    var folders = ListFolders(libraryName, clientContext, web);
    public List<Folder> ListFolders(string libraryName, ClientContext clientContext, Web web)
    var list = GetDocumentLibrary(libraryName, clientContext, web);
        var folders = list.RootFolder.Folders;
        clientContext.Load(folders); 
       clientContext.ExecuteQuery();
        return folders.ToList();       
    public List GetDocumentLibrary(string libraryName, ClientContext clientContext, Web web)
    var query = clientContext.LoadQuery(web.Lists.Where(p => p.Title == libraryName));
       clientContext.ExecuteQuery();
    return query.FirstOrDefault();
    It was working fine until I rebooted my computer (it installed a Windows Update), I strongly suspect, based on some testing I've done, it is caused by http://support.microsoft.com/kb/2964358 
    When the *clientContext.ExecuteQuery()* statement is reached in *GetDocumentLibrary()*, the
    following exception is thrown.
    *An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
    Additional information: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.*
    I'm wondering how I can work around this, as I'm not consciously using System.XML, it's a background function or process when the ExecuteQuery runs. 
    Can I pass some additional XMLReader info to this or clientContext (I'm assuming not), so I'm not sure how to execute this query to prevent the DTD error. I have also tried accessing the list in a different manner, by using this code... (from Microsoft's MSDN
    pages)
    List list = clientContext.Web.Lists.GetByTitle(libraryName);CamlQuery camlQuery = new CamlQuery();            camlQuery.ViewXml = "<View/>";ListItemCollection listItems = list.GetItems(camlQuery);clientContext.Load(list); clientContext.Load(listItems);clientContext.ExecuteQuery();
    This works on a computer without the KB above, however on my PC it doesn't (I get the same exception as my other code) , obviously uninstalling the KB will make things work in the short term, but its no good in the longer term. Any advice on how to avoid
    this error would be greatly appreciated.  I can only assume there will be a "preferred" way from Microsoft for accessing lists now this KB is implemented, but I'm clueless as to what it is.
    Thanks
    Dougie

    I've found that the issue is related to certain ISP's providing a "search assistance" page when a request returns an error due to no DNS entry matching that URL.  For example, if you use Verizon in the USA, and go to www.somenonexistanturl.com, it will
    "helpfully" respond to you with a search results page of possible options to match the URL you requested.
    Because this is not the expected XML that the SP Client Context library was looking for (i.e., it does not have the DTD that it validates), the exception is thrown.  The offending request that I have seen in my case is to the following URL: http://msoid.[my
    office 365 acct name].onmicrosoft.com/FPUrl.xml
    A simple resolution is to change your network connection adapter settings to use a DNS server IP other than the one auto-retrieved from your ISP, such as Google's (8.8.8.8 and 8.8.4.4). It's not a long term fix, since you'd breaking the ability to resolve
    internal resources from a private or corporate network (unless the private network is also setup with Google's IP for the DNS gateway).
    While you may have not changed any of your code, I would bet that you changed how/where you access the internet from when it was working to when it stopped working.
    What I am not entirely sure of is why did this start happening all of a sudden - was it a change from MSFT that broke the URL, or did the ISP(s) decide to become extra helpful with bad URLs?
    HTH
    --Thiago
    --Thiago

  • Dtd-is-prohibited-error-when-accessing-sharepoint-2013-office365-list-but-not

    I need to update some items in a list and previously done it through a console app and using the sharepoint.client.dll but for some reason it no longer works. 
    When I call the clientContext.ExecuteQuery() it throws this error:-
    "For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method."
    I have googled this and seen others have had similar problems but changing DNS has not resolved this which did in their case.
    I can probably create a sharepoint-hosted app to do it but just takes longer for such a simple update.
    I have checked fiddler and can see it is requesting the FPUrl.xml and returning a 302 response.
    GET http://msoid.thesportsoffice.com/FPUrl.xml HTTP/1.1
    Host: msoid.thesportsoffice.com
    HTTP/1.1 302 Found
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Location: /
    Server: Microsoft-IIS/8.5
    X-AspNetMvc-Version: 4.0
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Fri, 26 Sep 2014 14:43:36 GMT
    Content-Length: 118
    Any ideas why this is starting to happen?
    Karl Diggle

    Hi D00gle,
    DTD means document type declaration. Using DTD entity expansion, it is easy to make a very small XML data stream fully expand into a very large document.
    It will run parser without source limit, so the system will tell you the data has a security issue.
    To fix the issue, you can set like below in your code:
    XmlReaderSettings settings = new XmlReaderSettings();
    settings.ProhibitDtd = false;
    Here is a thread about this issue for your reference:
    http://stackoverflow.com/questions/13854068/dtd-prohibited-in-xml-document-exception
    Feel free to reply if you still have any questions about this.
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]
    Zhengyu Guo
    TechNet Community Support

  • Loading a XML-document into tables

    Hi,
    I have created a view for the tables below.
    Table Book with columns:
    - Book_ID
    - Book_Name
    - Ref_To_Price ( -> is a reference to Table Price (Price_ID))
    Table Price with columns:
    - Price_ID
    - Price_DM
    SQL-Syntax:
    "create view Bookprice as select Book_ID, Book_Name, Ref_To_Price, Price_ID, Price_DM from Book, Price where Ref_To_Price = Price_ID; "
    XML-Document:
    <?xml version="1.0" encoding="UTF-16"?>
    <!DOCTYPE ANWENDUNGEN SYSTEM "file:/E:/book.dtd">
    <!-- ?xml-stylesheet href="book.xsl" type="text/xsl"? -->
    <ROOTDOC>
    <ROW>
    <BOOK_ID>66-77</BOOK_ID>
    <BOOK_NAME>JavaScript</BOOK_NAME>
    <REF_TO_PRICE>12</REF_TO_PRICE>
    <PRICE_ID>12</PRICE_ID>
    <PRICE_DM>25.50DM</PPRICE_DM>
    </ROW>
    </ROOTDOC>
    If I use the XML SQL Utility to insert the XML-Document, the following error message came up:
    " Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: java.sql.SQLException: ORA-01776: cannot modify more than one base table through a join view "
    Can anyone help me, please ?
    null

    Hi,
    This is a classic join view problem, where u cannot update two tables in one shot. The main problem is that ur two tables are not normalized correctly. Why can't they be in just one table?
    OK, if that is not possible, then the best way out is to create a simple INSTEAD OF trigger on the view which will insert correclty,
    e.g.
    CREATE TRIGGER bookprice_tr INSTEAD OF INSERT ON Bookprice FOR EACH ROW
    BEGIN
    insert into Book values (:NEW.Book_id,
    :NEW.Book_name, :NEW.Ref_to_Price);
    insert into Price
    values(:NEW.Price_ID, :NEW.Price_DM);
    END;
    Hope this helps,
    Murali

  • Xml document validation using Schema

    I want to validate XML Document using XML Schema...
    does any body have an idea how to do it.
    Every time i m running my java file by using different XML FILE AND XSD FILE in command line i m getting same error.
    error is:
    Exception in thread "main" org.xml.sax.SAXException: Error: URI=null Line=2: s4s-elt-schema-ns: The namespace of element 'catalog' must be from the schema name space.
    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1115)
    at SAXLocalNameCount.main(SAXLocalNameCount.java:117)
    Below is my java code with xml file and schema file.
    plz get back to me as soon as possible it is urgent.
    thanx
    java File
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import java.util.*;
    import java.io.*;
    public class SAXLocalNameCount extends DefaultHandler {
    /** Constants used for JAXP 1.2 */
    static final String JAXP_SCHEMA_LANGUAGE =
    "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
    static final String W3C_XML_SCHEMA =
    "http://www.w3.org/2001/XMLSchema";
    static final String JAXP_SCHEMA_SOURCE =
    "http://java.sun.com/xml/jaxp/properties/schemaSource";
    /** A Hashtable with tag names as keys and Integers as values */
    private Hashtable tags;
    // Parser calls this once at the beginning of a document
    public void startDocument() throws SAXException {
    tags = new Hashtable();
    // Parser calls this for each element in a document
    public void startElement(String namespaceURI, String localName,
    String qName, Attributes atts)
         throws SAXException
    String key = localName;
    Object value = tags.get(key);
    if (value == null) {
    // Add a new entry
    tags.put(key, new Integer(1));
    } else {
    // Get the current count and increment it
    int count = ((Integer)value).intValue();
    count++;
    tags.put(key, new Integer(count));
    System.out.println("TOTAL NUMBER OF TAG IN FILE = "+count);
    // Parser calls this once after parsing a document
    public void endDocument() throws SAXException {
    Enumeration e = tags.keys();
    while (e.hasMoreElements()) {
    String tag = (String)e.nextElement();
    int count = ((Integer)tags.get(tag)).intValue();
    System.out.println("Local Name \"" + tag + "\" occurs " + count
    + " times");
    static public void main(String[] args) throws Exception {
    String filename = null;
    String schemaSource = null;
    // Parse arguments
    schemaSource = args[0];
    filename = args[1];
    // Create a JAXP SAXParserFactory and configure it
    SAXParserFactory spf = SAXParserFactory.newInstance();
    // Set namespaceAware to true to get a parser that corresponds to
    // the default SAX2 namespace feature setting. This is necessary
    // because the default value from JAXP 1.0 was defined to be false.
    //spf.setNamespaceAware(true);
    // Validation part 1: set whether validation is on
    spf.setValidating(true);
    // Create a JAXP SAXParser
    SAXParser saxParser = spf.newSAXParser();
    System.out.println(" saxparser "+saxParser);
    // Validation part 2a: set the schema language if necessary
    if (true) {
    try {
    saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
    System.out.println(" saxparser ");
    } catch (SAXNotRecognizedException x) {
    // This can happen if the parser does not support JAXP 1.2
    System.err.println(
    "Error: JAXP SAXParser property not recognized: "
    + JAXP_SCHEMA_LANGUAGE);
    System.err.println(
    "Check to see if parser conforms to JAXP 1.2 spec.");
    System.exit(1);
    // Validation part 2b: Set the schema source, if any. See the JAXP
    // 1.2 maintenance update specification for more complex usages of
    // this feature.
    if (schemaSource != null) {
    saxParser.setProperty(JAXP_SCHEMA_SOURCE, new File(schemaSource));
    System.out.println(" saxparser 123");
    // Get the encapsulated SAX XMLReader
    XMLReader xmlReader = saxParser.getXMLReader();
    System.out.println(" XML READER "+xmlReader);
    // Set the ContentHandler of the XMLReader
    xmlReader.setContentHandler(new SAXLocalNameCount());
    System.out.println(" XML READER 345 ");
    // Set an ErrorHandler before parsing
    xmlReader.setErrorHandler(new MyErrorHandler(System.err));
    System.out.println(" XML READER 67878 ");
    // Tell the XMLReader to parse the XML document
    xmlReader.parse(filename);
    System.out.println(" XML READER ");
    // Error handler to report errors and warnings
    private static class MyErrorHandler implements ErrorHandler {
    /** Error handler output goes here */
    private PrintStream out;
    MyErrorHandler(PrintStream out) {
    this.out = out;
    * Returns a string describing parse exception details
    private String getParseExceptionInfo(SAXParseException spe) {
    String systemId = spe.getSystemId();
    if (systemId == null) {
    systemId = "null";
    String info = "URI=" + systemId +
    " Line=" + spe.getLineNumber() +
    ": " + spe.getMessage();
    return info;
    // The following methods are standard SAX ErrorHandler methods.
    // See SAX documentation for more info.
    public void warning(SAXParseException spe) throws SAXException {
    out.println("Warning: " + getParseExceptionInfo(spe));
    public void error(SAXParseException spe) throws SAXException {
    String message = "Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    public void fatalError(SAXParseException spe) throws SAXException {
    String message = "Fatal Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    xml file(books.xml)
    <?xml version="1.0"?>
    <catalog>
    <book id="bk101">
    <author>Gambardella, Matthew</author>
    <title>XML Developer's Guide</title>
    <genre>Computer</genre>
    <price>44.95</price>
    <publish_date>2000-10-01</publish_date>
    <description>An in-depth look at creating applications
    with XML.</description>
    </book>
    <book id="bk102">
    <author>Ralls, Kim</author>
    <title>Midnight Rain</title>
    <genre>Fantasy</genre>
    <price>5.95</price>
    <publish_date>2000-12-16</publish_date>
    <description>A former architect battles corporate zombies,
    an evil sorceress, and her own childhood to become queen
    of the world.</description>
    </book>
    <book id="bk103">
    <author>Corets, Eva</author>
    <title>Maeve Ascendant</title>
    <genre>Fantasy</genre>
    <price>5.95</price>
    <publish_date>2000-11-17</publish_date>
    <description>After the collapse of a nanotechnology
    society in England, the young survivors lay the
    foundation for a new society.</description>
    </book>
    <book id="bk104">
    <author>Corets, Eva</author>
    <title>Oberon's Legacy</title>
    <genre>Fantasy</genre>
    <price>5.95</price>
    <publish_date>2001-03-10</publish_date>
    <description>In post-apocalypse England, the mysterious
    agent known only as Oberon helps to create a new life
    for the inhabitants of London. Sequel to Maeve
    Ascendant.</description>
    </book>
    <book id="bk105">
    <author>Corets, Eva</author>
    <title>The Sundered Grail</title>
    <genre>Fantasy</genre>
    <price>5.95</price>
    <publish_date>2001-09-10</publish_date>
    <description>The two daughters of Maeve, half-sisters,
    battle one another for control of England. Sequel to
    Oberon's Legacy.</description>
    </book>
    <book id="bk106">
    <author>Randall, Cynthia</author>
    <title>Lover Birds</title>
    <genre>Romance</genre>
    <price>4.95</price>
    <publish_date>2000-09-02</publish_date>
    <description>When Carla meets Paul at an ornithology
    conference, tempers fly as feathers get ruffled.</description>
    </book>
    <book id="bk107">
    <author>Thurman, Paula</author>
    <title>Splish Splash</title>
    <genre>Romance</genre>
    <price>4.95</price>
    <publish_date>2000-11-02</publish_date>
    <description>A deep sea diver finds true love twenty
    thousand leagues beneath the sea.</description>
    </book>
    <book id="bk108">
    <author>Knorr, Stefan</author>
    <title>Creepy Crawlies</title>
    <genre>Horror</genre>
    <price>4.95</price>
    <publish_date>2000-12-06</publish_date>
    <description>An anthology of horror stories about roaches,
    centipedes, scorpions and other insects.</description>
    </book>
    <book id="bk109">
    <author>Kress, Peter</author>
    <title>Paradox Lost</title>
    <genre>Science Fiction</genre>
    <price>6.95</price>
    <publish_date>2000-11-02</publish_date>
    <description>After an inadvertant trip through a Heisenberg
    Uncertainty Device, James Salway discovers the problems
    of being quantum.</description>
    </book>
    <book id="bk110">
    <author>O'Brien, Tim</author>
    <title>Microsoft .NET: The Programming Bible</title>
    <genre>Computer</genre>
    <price>36.95</price>
    <publish_date>2000-12-09</publish_date>
    <description>Microsoft's .NET initiative is explored in
    detail in this deep programmer's reference.</description>
    </book>
    <book id="bk111">
    <author>O'Brien, Tim</author>
    <title>MSXML3: A Comprehensive Guide</title>
    <genre>Computer</genre>
    <price>36.95</price>
    <publish_date>2000-12-01</publish_date>
    <description>The Microsoft MSXML3 parser is covered in
    detail, with attention to XML DOM interfaces, XSLT processing,
    SAX and more.</description>
    </book>
    <book id="bk112">
    <author>Galos, Mike</author>
    <title>Visual Studio 7: A Comprehensive Guide</title>
    <genre>Computer</genre>
    <price>49.95</price>
    <publish_date>2001-04-16</publish_date>
    <description>Microsoft Visual Studio 7 is explored in depth,
    looking at how Visual Basic, Visual C++, C#, and ASP+ are
    integrated into a comprehensive development
    environment.</description>
    </book>
    </catalog>
    (books.xsd)
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="catalog">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="book" minOccurs="0" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="author" type="xsd:string"/>
    <xsd:element name="title" type="xsd:string"/>
    <xsd:element name="genre" type="xsd:string"/>
    <xsd:element name="price" type="xsd:float"/>
    <xsd:element name="publish_date" type="xsd:date"/>
    <xsd:element name="description" type="xsd:string"/>
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:string"/>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

    Add xmlns:xsi attribute to the root element <catalog>.
    <catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation='books.xsd'>

  • SQLException while selecting only part of XML document

    Hi,
    I'm newbie in oracle XML DB. I'm trying to make an example application but I'm still getting an SQLException while selecting only part of my XML document. I'm using oracle 11g release 1.
    I have following XML document:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <CATALOG>
    <CD>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
    <COMPANY>Columbia</COMPANY>
    <PRICE>10.90</PRICE>
    <YEAR>1985</YEAR>
    </CD>
    <CD>
    <TITLE>Hide your heart</TITLE>
    <ARTIST>Bonnie Tyler</ARTIST>
    <COUNTRY>UK</COUNTRY>
    <COMPANY>CBS Records</COMPANY>
    <PRICE>9.90</PRICE>
    <YEAR>1988</YEAR>
    </CD>
    </CATALOG>
    and following java code:
    import oracle.jdbc.OraclePreparedStatement;
    import oracle.jdbc.OracleResultSet;
    import oracle.xdb.XMLType;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Select {
    private static String SQL_1 = "SELECT OBJECT_VALUE FROM CATALOG";
    private static String SQL_2 = "SELECT extract(OBJECT_VALUE,'/CATALOG/CD/ARTIST') FROM CATALOG";
    public static void main(String[] args) throws SQLException {
    Connection conn = createConnection();
    OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement(SQL_1);
    OracleResultSet orset = (OracleResultSet)stmt.executeQuery();
    while (orset.next()) {
    // get the XMLType
    XMLType poxml = XMLType.createXML(orset.getOPAQUE(1));
    // get the XMLDocument as a string...
    System.out.println(poxml.getStringVal());
    conn.close();
    private static Connection createConnection() {
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@hruby.marbes.cz:1521:oracle", "hruby", "password");
    return conn;
    } catch (SQLException e) {
    e.printStackTrace();
    return null;
    While executing SQL_1 statement everything goes well and I get whole document.
    While executing SQL_2 statement I get following exception:
    Exception in thread "main" java.sql.SQLException: Only LOB or String Storage is supported in Thin XMLType
         at oracle.xdb.XMLType.processThin(XMLType.java:2817)
         at oracle.xdb.XMLType.<init>(XMLType.java:1238)
         at oracle.xdb.XMLType.createXML(XMLType.java:698)
         at oracle.xdb.XMLType.createXML(XMLType.java:676)
         at Select.main(Select.java:27)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    I expect to get such result:
    <ARTIST>Bob Dylan</ARTIST>
    <ARTIST>Bonnie Tyler</ARTIST>
    any suggestion???
    Thanks

    OBJECT_VALUE in this case refers to an XMLType datatype (fragment due to the use of "extract"). Convert it on "the fly" to a CLOB using getCLOBVal(). Then pick it up in java as a LOB.

Maybe you are looking for