The statement on the xsd in an xml document
Hello
I had written in the root element in the XML, the lines to deceive:
<? XML version = "1.0" encoding = "UTF-8"? >
< MyRootElement MyAttribute1 = "MyAttributeValue1."
MyAttribute2 = "MyAttributeValue2."
MyAttribute3 = "MyAttributeValue3".
" xmlns =" http://www.Oracle.com/XML/Test1.xsd"" "
xmlns : xsi = " http://www.w3.org/2001/xmlSchema-instance "
" xsi: schemaLocation =" http://www.Oracle.com/XML/Test1.xsd xml_schema.xsd "> "
but the problem is that the customer does not want to get the 3 lines (underlined), where I declare in the xsd document.
Can I omit these 3 rows? or replace them with something else?
Thanks in advance,
Elad
You can probably omit xsi: schemaLocation (and the declaration xmlns: xsi, if the prefix is not used in the doc), but the removal of the default namespace will change the semantics.
If your client has said that he does not want a namespace by default, then so be, remove it from the document instance. You also need to remove the XSD targetNamespace declaration.
Based on your other discussions recently posted, you then will have to modify your validation code and explicitly construct an instance XML based on a schema using the URL of the registered scheme.
Tags: Database
Similar Questions
-
ORA-19030: invalid method for the schema not based XML Documents
Hi everyone can u help me please when I am trying to execute query below his throw errror
DECLARE
doc xmltype.
BEGIN
SELECT
XMLAGG (XMLElement ("employee",
XMLAttributes)
' http://www.Oracle.com/emp_simple.xsd ' AS 'xmlns',
' http://www.w3.org/2001/XMLSchema-instance ' AS ' xmlns: xsi ",
' http://www.Oracle.com/emp_simple.xsd
http://www.oracle.com/emp_simple.xsd'
AS "xsi: schemaLocation").
XMLForest (e.employee_id LIKE "EmployeeId",
Select AS "name."
e.job_id AS "Job."
e.manager_id "MANAGER."
e.hire_date AS "Hire Date"
e.Salary AS "wages."
e.commission_pct AS 'The Commission',
XMLForest)
d.department_id AS "DeptNo."
d.department_name AS "DeptName",.
d.location_id AS 'Place') AS 'Dept')))
in the doc
E employees, departments d
WHERE e.department_id = d.department_id;
doc.schemaValidate ();
END;
/
The error I get is following
ORA-19030: invalid method for the schema not based XML Documents
Yes, Odie meant something like that.
See how the employee node can now occur more than once in the employees node.
-
Merge the XML document in a table
Hello
I want to merge some of the values of an xml document in a table "Project_Table".
CREATE TABLE Project_Table
(
TASK_ID NUMBER (15),
TASK_NAME VARCHAR2 (100 BYTE),
START_DATE DATE,
)
I am using the following procedure, that I adapted from another post. It inserts null values, I think because I'm not showing the nodes correctly.
DECLARE
BFILE v_bfile: = BFILENAME ("'DTEMP","test.xml");
v_clob CLOB.
BEGIN
-Create directory DTEMP as "C:\TEMP";
-grant read the < schema > DTEMP directory;
DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
DBMS_LOB. OPEN (v_bfile, DBMS_LOB.lob_readonly);
DBMS_LOB. LoadFromFile (v_clob, v_bfile, DBMS_LOB.lobmaxsize);
Dbms_output.put_line (v_clob);
MERGE IN project_table t
USING (SELECT TO_NUMBER (EXTRACTVALUE (VALUE (x), ' / task ')) task_id,)
To_date (EXTRACTVALUE (value (x), "/ start"), 'DD-MM-YYYY') start_date,
EXTRACTVALUE (value (x), "/ name") TaskName
(SELECT XMLTYPE (v_clob) XML
THE DOUBLE).
TABLE (XMLSEQUENCE (EXTRACT (xml, ' / project'))) x) r
WE (t.task_id = r.task_id)
WHEN MATCHED THEN
UPDATE
SET t.start_date = r.start_date, t.task_name = r.task_name
WHEN NOT MATCHED THEN
INSERT (task_id, start_date, taskname)
VALUES (r.task_id, r.start_date, r.task_name);
COMMIT;
END;
This is the document of test.xml.
<? XML version = "1.0" encoding = "UTF-8"? >
-name of the project 'ProjectName' company 'Company' webLink = = = "" view-date = '2009-12-14"see-index '0' = gantt-Divider-location = '300' resource-divider-card ="300"version ="2.0">"
< description / >
< zoom-view state = "default: 8" / >
-<!
->
-< calendars >
-day-types >
< day-type id = '0' / >
< day-type id = "1" / >
-< Calendar id = "1" name = "default" >
< Sun weeks default = '0' LUN '0' = TEU = '0' kills = '0' game = '0' Fri '0' = Saturday = '0' / >
< overloaded-day-types / >
< days / >
< / calendar >
< / day-types >
< / calendars >
-task color = "#8cb6ce" >
-< taskproperties >
< taskproperty id = "tpd0" name = 'type' type = 'default' valuetype = "icon" / >
< taskproperty id = "TDP1" name = 'priority' type = 'default' valuetype = "icon" / >
< taskproperty id = "tpd2" name = 'info' type = 'default' valuetype = "icon" / >
< taskproperty id = "tpd3" name = "name" type = 'default' valuetype = "text" / >
< taskproperty id = "tpd4" name = "begindate" type = 'default' valuetype = "date" / >
< taskproperty id = "tpd5" name = "enddate" type = 'default' valuetype = "date" / >
< taskproperty id = "tpd6" name = "Duration" type = 'default' valuetype = "int" / >
< taskproperty id = "tpd7" name = "completion" type = 'default' valuetype = "int" / >
< taskproperty id = "tpd8" name = "Coordinator" type = 'default' valuetype = "text" / >
< taskproperty id = "tpd9" name = "predecessorsr" type = "default" valuetype = "text" / >
< / taskproperties >
< job id = '0' name = 'TaskA"color =" #0099cc "form = meeting"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"="false"start ="2010-01-28"duration ="1"complete ="0"priority ="1"expand ="true"/ >
< task id = "1" name = "TaskB" color = "#ff0000" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-01-28" duration = "1" complete = "100" priority = "1" expand = "true" / >
< job id = "2" name = 'Day' color = "#ff9933" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "19" complete = "0" priority = "1" expand = "true" / >
< job id = "3" name = "TaskD" color = "#ff0000" form = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" meeting = "false" start = "2010-02-01" duration = "32" full = "100" priority = "1" expand = "true" / >
< job id = "4" name = "TaskE" color = "#66ff99" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "67" complete = "0" priority = "1" expand = "true" / >
< job id = "5" name = "TaskF" color = "#66ff99" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "46" complete = "10" priority = "1" expand = "true" / >
< job id = "6" name = "TaskG" color = "#00cccc" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-03-15" duration = "30" complete = "0" priority = "1" expand = "true" / >
< job id = "7" name = "TaskH" color = "#00cccc" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-03-15" duration = "103" full '1' = '1' priority = expand = "true" / >
< job id = "8" name = "TaskI" color = "#0000ff" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = '2010-04-26' length = "11" complete = "0" priority = "1" expand = "true" / >
< job id = '9' name = 'TaskJ"color =" #0000ff "form = meeting"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"="false"start = '2010-04-26' length ="11"complete ="0"priority ="1"expand ="true"/ >
< job id = "10" name = "TaskK" color = "#000000" meeting = 'false' start time = "2010-07-12" = "65" full = "0" priority = "1" expand = "true" / >
< / tasks >
< resources / >
< allowances / >
< holiday / >
-< taskdisplaycolumns >
< displaycolumn property id = "tpd3" order = "0" width = "75" / >
< displaycolumn property id = "tpd4" order = "1" width = "75" / >
< displaycolumn property id = "tpd5" order = "2" width = "75" / >
< displaycolumn property id = "tpd7" order = "3" width = "75" / >
< / taskdisplaycolumns >
< Previous / >
< roles roles-name = "Default" / >
< / project >
Any ideas how to change the procedure, in order to merge the data in the xml document in the table?
Thank youHello
Here's what you need in your USING clause:
SELECT to_number(extractvalue(column_value, 'task/@id')) as task_id, to_date(extractvalue(column_value, 'task/@start'), 'YYYY-MM-DD') as start_date, extractvalue(column_value, 'task/@name') as task_name FROM TABLE( XMLSEQUENCE( EXTRACT(xmltype(v_clob), '//task') ) )
Since you want nodes "task" request, just extract them directly. In addition, 'id', 'start', 'name' is attributes, you must access them with an '@'.
You can also take a look at function XMLTABLE (which tends to replace construction TABLE (XMLSEQUENCE (...))):
SELECT * FROM XMLTABLE( '//task' passing xmltype(v_clob) columns task_id number(15) path '/task/@id', start_date date path '/task/@start', task_name varchar2(100) path '/task/@name' )
Edit: the XMLType constructor overload taking a BFILE type as an argument, so you can simplify the code a bit more:
DECLARE v_xml XMLTYPE := XMLTYPE( BFILENAME('DTEMP', 'test.xml'), nls_charset_id('AL32UTF8') ); BEGIN MERGE INTO project_table t USING ( SELECT * FROM XMLTABLE( '//task' passing v_xml columns task_id number(15) path '/task/@id', start_date date path '/task/@start', task_name varchar2(100) path '/task/@name' ) ) r ON (t.task_id = r.task_id) WHEN MATCHED THEN ... WHEN NOT MATCHED THEN ... ; ... END;
HTH
Published by: odie_63 on March 18, 2010 12:13
Published by: odie_63 on March 18, 2010 12:15
-
Registration in the form of XML Documents, MDS error
I'm doing a copy of our RPD as an XML Document of MDS repository.
I use the following selection to copy the repository as a XML Document of MDS and receive an "Access denied" error
File-> copy-> XMLDocuments MDS
[nQSError: 61007] File error: Path = C:\obi_scm_file, Code = 5, access is denied
Help would be appreciated.
Thank you
Hi all
I got this error too, with OBIEE 11.1.1.6.6 (version from the repository: 320). I tried to copy everything in live coneccted to the Server repository. I copied the repository in my PC, open in offline mode and it worked.
I hope this helps.
Concerning
ANA GH
-
Alteration of the content of an XML node in java
Hi all
I change the contents of an XML node using java, using the method of setTextContent() a node.
Sometimes I also add child nodes of a node. In this case, when I add the child nodes of a given node, when I print the xml data, I see the added nodes.
for example:
Initial XML:
< a > < / a >
< b > < / b >
< c > < / c >
For my project requirement, based on certain conditions, I do 'a' 'b', 'c' as children nodes nodes. I reached this output.
The problem is
FINAL XML:
< a > < b > < / b > < c > < / c > < / a >
I get the nodes children in the same line as above. But the power required should be as below.
REQUIRED XML
< a >
< b > < / b >
< c > < / c >
< /a >
I also used the Doc.normalize () function. But still, it helps strength.
Kindly help me in this regard.
Thank you
Sabarisri. NHello
You can try to transform the result as below:
Transformer transformer = TransformerFactory.newInstance () .newTransformer ();
transformer.setOutputProperty (OutputKeys.INDENT, 'yes');initialize the StreamResult with the object of the file to save to file
StreamResult result = new StreamResult (new StringWriter());DOMSource source = new DOMSource (doc); Here, the doc is you XML document.
transform. Transform (source, result);String xmlString = result.getWriter (m:System.NET.SocketAddress.ToString ());
System.out.println (xmlString);Thank you best regards &,.
Nilesh Sahni (www.infocepts.com)Published by: Nilesh on August 30, 2011 12:31
-
Create an xml file using the .xsd file
Hi guys,.
Version of DB: Oracle 11g
I was wondering if I had any package that can create a xml file based on a (built-in) .xsd file. I searched but did not find any resource on the internet specific to my problem. Let's say I have an .xsd file. It is possible to load a schema and generate the XML that conform to the .xsd file using sql? If so, I want to store in a CLOB variable.
Please point me to the right direction.
Thank you.
Hello
No, there is no such functionality yet.
To build the XML "manually", according to the XSD, for example using SQL/XML functions (XMLElement, XMLAttributes, and XMLAgg etc.).
-
Can we change the name of the XSD/XML in Bpel node
Hello
I have here is the structure of the xsd that I created and captured the XML in it, in my Bpel process flow:
nodes <>
< NodeFirst >
< NodeSecond >
< / node >
While he will send customer, I need to rename nodes as:
nodes <>
* < node / > *.
* < node / > *.
< / node >
The names of the two nodes must be changed to "Namesake" in XML Final.
Is it possible that we can do this, appreciate any help on this.
Thank you
PuneetIt means that you must create a xsl map in which you "create" the exact names and fill them with data from the 'old' elementnames.
in this case the transformation will do the same if you rename the elementor use bpelx:rename
http://download.Oracle.com/docs/CD/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHFJJGB -
generate the xsd file xml data
I would like to make my java application automatically convert a given to a one .xml .xsd file.
I know that with jdev, you can generate an xsd one xml file, and I want my application to do the same thing.
I also know that I can use JAXB: first of all, I bind the xsd file, then I marshall the java class created for the xml. But I don't know how to do it.
y at - it a simple way to use the 'things' behind the generation of xml xsd jdev.Please see
http://www.developer.com/Java/Web/article.php/3722211/using-JAXB-in-JDeveloper-1013.htmJDeveloepr 11 g includes JAXB 2.0.
-
XML validation against the XSD schema
Hi all
I have a strange problem.
I'm trying to validate an XMLTYPE variable against a XSD schema using the XMLisValid function.
The XML code that I am trying to validate returned false (0) when you use this method.
However, when I save the XSD against a column in a table, and then insert this XMLTYPE in this column, I don't get any errors. If I change the XSD to ensure failure when using this method, I get an error, if it is registered and work.
I then created a very basic XSD and both methods work when validating XML against that. Then of course the XSD harder I want to validate against a difference, but I expect or them both don't both pass, not a failure and a single pass.
Does anyone know why it would return different results?
Thanks in advance for your help.
Robin
examples of what I use:
XML to validate:
<>centers
< Add >
<>Center
< centreName > name 1 < / centreName >
< centreRef > 45678 < / centreRef >
< / Center >
< / add >
< / Center >
Simple XSD:
<? XML version = "1.0" encoding = "UTF-8"? >
< xs: Schema attributeFormDefault = "unqualified" elementFormDefault = "qualified" xmlns: XS = "http://www.w3.org/2001/XMLSchema" >
< xs: element name = "centres" type = "centresType" / >
< name XS: complexType 'addType' = >
< xs: SEQUENCE >
< xs: ELEMENT type = "xs: String" name = "centreName" / >
< xs: ELEMENT type = "xs:short" name = "centreRef" / >
< / xs: SEQUENCE >
< / xs: complexType >
< name XS: complexType = "centresType" >
< xs: SEQUENCE >
< xs: ELEMENT type = "addType" name = 'Add' maxOccurs = "3" minOccurs = "0" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: Schema >
XSD complex:
<? XML version = "1.0" encoding = "utf-8"? >
<! - created with liquid XML Studio - 30 Day Trial Edition 7.1.6.1440 (http://www.liquid-technologies.com)->
< xs: Schema attributeFormDefault = "unqualified" elementFormDefault = "qualified" xmlns: XS = "http://www.w3.org/2001/XMLSchema" >
< xs: element name = "Center" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "Remove" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT minOccurs = "0" maxOccurs = "1000" name = "centreRef" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "50" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "Add" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT minOccurs = "0" maxOccurs = "1000" name = "Center" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "centreName" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "100" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: element >
< xs: element name = "centreRef" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "50" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: element >
< xs: ELEMENT minOccurs = "0" maxOccurs = "1" name = "qualities" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT minOccurs = "0" maxOccurs = "1000" name = "qualRef" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "100" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "modifyQualAssociations" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "Remove" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT minOccurs = "0" maxOccurs = "1000" name = "o" >
< xs: complexType >
< name XS: attribute = use "centreRef" = "required" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "50" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: attribute >
< name XS: attribute = use "qualRef" = "required" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "100" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: attribute >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "Add" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT minOccurs = "0" maxOccurs = "1000" name = 'a' >
< xs: complexType >
< name XS: attribute = use "centreRef" = "required" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "50" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: attribute >
< name XS: attribute = use "qualRef" = "required" >
< xs:simpleType >
< xs:restriction base = "XS: String" >
< xs:minLength value = "1" / >
< xs:maxLength value = "100" / >
< / xs:restriction >
< / xs:simpleType >
< / xs: attribute >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: Schema >Just had a quick glance at your XSD complex...
You have a piece of 'delete' that is required as part of the sequence of elements with the element "centers." Yet your XML will fail validation compared with what it has only one item "add".
Maybe your
must be:
?
Just guessing. ;)
-
How to create the default column in XML schema?
Hi all
I would like to define a default column Let's say Run_Date as Date data type in XML (XSD) schema definition and would fill column Run_Date SYSDATE, when XML documents are parsed to this schema.
Let me know, how can we achieve?
Thanks in advance.Also, I can not change the contents of the XML file, because it is generated by another language, but I can change the definition of XML schema, if necessary.
Well, if you can not change the XML instance, you cannot change the schema, it conforms to the.
You can add an optional attribute whose value by default, but we can only use a static value.How do you insert the file into the table?
- If you programmatically, via an INSERT statement, then I think your best bet is to create a new table with a relational schema XMLType column and a DATE column:
CREATE TABLE employees ( dt_created date default sysdate not null , xmldoc xmltype , CONSTRAINT emp_pk PRIMARY KEY (xmldoc."XMLDATA".EMP_NO) ) XMLTYPE COLUMN xmldoc STORE AS OBJECT RELATIONAL XMLSCHEMA "EMP.xsd" ELEMENT "Emp" ;
If you choose to do so, remove the XML schema and enter it again with "genTables-online false."
- If you have inserted the file via the XDB (FTP, WebDAV, createResource) repository and relying on the table by default feature, then you may be out of luck.
There is probably a way to tamper with the underlying structure of GOLD among a hidden column do accept a default value, but since it is not supported I won't even try. -
What to put in the xsd schema for the form of the ADF radio buttons?
Hello, we create a form generated from the data of a HT ADF auto which is a type defined in a schema .xsd. Which schema component Let's in the .xsd schema correspond to buttons option in the form of the ADF? For example, in our .xsd we just
<? XML version = "1.0" encoding = "UTF-8"? >
" < xsd: Schema container = ' http://www.w3.org/2001/XMLSchema "xmlns:wf =" " http://www.example.org "
" targetNamespace = ' http://www.example.org "elementFormDefault ="qualified"> "
< xsd: complexType name = "FormDataType" >
< xsd: SEQUENCE >
< xsd: element name = "FirstName" type = "xsd: String" / >
< xsd: element name = "Name" type = "xsd: String" / >
< xsd: element name = "Department" type = "xsd: String" / >
< / xsd: SEQUENCE >
< / xsd: complexType >
< / xsd: Schema >
What would be the element / type etc be for radio buttons?
Hi Tali,
It depends on what you want to do with radio buttons, but it would be better to be a part of string in most cases.
This could be better handled on the ADF OTN forum, but I'll take a shot at it. If you have many items to choose from, you can use the string "Department", you already have in your XSD. When displayed on the form, include various departments with radio buttons next to each other (for example,"manufacturing", "Marketing", "Sales").
Because this is the BPM forum, I guess your XSD is used as data for a human task which in turn used to create a form of the ADF. If this is the case, you can use your "Department" in your XSD string element that has already been placed on your form as a text input field. The reason is the link that you need to update the element of the human task service is automatically created in this way. Select this field to text, and then in the properties panel, copy the text that is in the 'value' of the field (you stick it in the Value property of the Radio group you will add in the next step).
There are two ways to get the radio buttons on the form. You might drag the "Radio group" widget on the form-> click on radio to 'Create a list (select an item)' button-> click the Add icon to add the choices you want to appear on the form (for example,' manufacturing ', 'Marketing', 'Sale'). Once this was added, paste property value text you copied in the previous step into the field of "Value" property of the new Radio group.
If you select the radio button of the new group source, it should look like this if you wanted two choices for your radio buttons:
After this has been added, delete the existing text entry field that was created when the form was generated automatically from the human task.
Hope this helps,
Dan
-
How to read the data with different XML schemas within the unique connection?
- I have Oracle database 11g
- I access it via JDBC: Slim, version 11.2.0.3, same as xdb.
- I have several tables, each has an XMLType column, all based on patterns.
- There are three XML schemas different registered in the DB
- Maybe I need to read the XML data in multiple tables.
- If all the XMLTypes have the same XML schema, there is no problem,
- If patterns are different, the second reading will throw BindXMLException.
- If I reset the connection between the readings of the XMLType column with different schemas, it works.
The question is: How can I configure the driver, or the connection to be able to read the data with different XML schemas without resetting the connection (which is expensive).
Code to get data from XMLType is the implementation of case study:
1 ResultSet resultSet = statement.executeQuery( sql ) ;
2 String result = null ;
3 while(resultSet.next()) {
4 SQLXML sqlxml = resultSet.getSQLXML(1) ;
5 result = sqlxml.getString() ;
6 sqlxml.free();
7 }
8 resultSet.close();
9 return result ;It turns out, that I needed to serialize the XML on the server and read it as BLOB. Like this:
1 final Statement statement = connection.createStatement() ; 2 final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ; 3 ResultSet resultSet = statement.executeQuery( sql ) ; 4 String result = null ; 5 while(resultSet.next()) { 6 Blob blob = resultSet.getBlob( 1 ); 7 InputStream inputStream = blob.getBinaryStream(); 8 result = new Scanner( inputStream ).useDelimiter( "\\A" ).next(); 9 inputStream.close(); 10 blob.free(); 11 } 12 resultSet.close(); 13 statement.close(); 14 15 System.out.println( result ); 16 return result ; 17
Then it works. Still, can't get it work with XMLType in resultset. On the customer XML unwrapping explodes trying to pass to another XML schema. JDBC/XDB problem?
-
Why xmlindex is not used in the slow queries on xml binary table eval?
I run a slow simple query on Oracle 11.2.0.1 database server that does not use a xmlindex. Instead, a full table scan against the table eval binary xml occurs. This is the query:
The predicate is not selective at all - the number of rows returned is the same as the number of rows in table (325 550 in the eval table xml documents). When different values are used, which brings the number of lines down to ~ 33%, the xmlindex still is not used - as is expected in a purely relational XML environment.select -- /*+ NO_XMLINDEX_REWRITE no_parallel(eval)*/ defid from eval, XMLTable(XMLNAMESPACES(DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03', 'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7"), '$doc/eval/derivedFacts/ns7:derivedFact' passing eval.object_value as "doc" columns defid varchar2(100) path 'ns7:defId' ) eval_xml where eval_xml.defid in ('59543','55208');
My question is why would'nt the xmlindex be used somehow full scan compared to a sweep of full table that cross the xml for each record in paper table eval?
FFS suspicion would apply to a field of type xmlindex index?
Here is the definition of xmlindex:
Here is the definition of table eval:CREATE INDEX "EVAL_XMLINDEX_IX" ON "EVAL" (OBJECT_VALUE) INDEXTYPE IS "XDB"."XMLINDEX" PARAMETERS ('XMLTable eval_idx_tab XMLNamespaces(DEFAULT ''http://www.cigna.com/acme/domains/eval/2010/03'', ''http://www.cigna.com/acme/domains/derived/fact/2010/03'' AS "ns7"),''/eval'' COLUMNS defId VARCHAR2(100) path ''/derivedFacts/ns7:derivedFact/ns7:defId''');
Purified sample extract of XML:CREATE TABLE "N98991"."EVAL" OF XMLTYPE ( CONSTRAINT "EVAL_ID_PK" PRIMARY KEY ("EVAL_ID") USING INDEX PCTFREE 10 INITRANS 4 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "ACME_DATA" ENABLE ) XMLTYPE STORE AS SECUREFILE BINARY XML ( TABLESPACE "ACME_DATA" ENABLE STORAGE IN ROW CHUNK 8192 CACHE NOCOMPRESS KEEP_DUPLICATES STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) ) ALLOW NONSCHEMA ALLOW ANYSCHEMA VIRTUAL COLUMNS ( "EVAL_DT" AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL( SYS_XQEXVAL(XMLQUERY( 'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03"; (::) /eval/@eval_dt' PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0, 16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP WITH TIME ZONE))), "EVAL_CAT" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY( 'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@category' PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0, 16777216,0),50,1,2) AS VARCHAR2(50))), "ACME_MBR_ID" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY( 'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@acmeMemberId' PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0, 16777216,0),50,1,2) AS VARCHAR2(50))), "EVAL_ID" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY( 'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@evalId' PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0, 16777216,0),50,1,2) AS VARCHAR2(50))) ) PCTFREE 0 PCTUSED 80 INITRANS 4 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT ) TABLESPACE "ACME_DATA" ;
Oracle XML DB 11g Release 2 Developer's Guide is not much help...<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><eval createdById="xxxx" hhhhMemberId="37e6f05a-88dc-41e9-a8df-2a2ac6d822c9" category="eeeeeeee" eval_dt="2012-02-11T23:47:02.645Z" evalId="12e007f5-b7c3-4da2-b8b8-4bf066675d1a" xmlns="http://www.xxxxx.com/vvvv/domains/eval/2010/03" xmlns:ns2="http://www.cigna.com/nnnn/domains/derived/fact/2010/03" xmlns:ns3="http://www.xxxxx.com/vvvv/domains/common/2010/03"> <derivedFacts> <ns2:derivedFact> <ns2:defId>12345</ns2:defId> <ns2:defUrn>urn:mmmmrunner:Medical:Definition:DerivedFact:52657:1</ns2:defUrn> <ns2:factSource>tttt Member</ns2:factSource> <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt> <ns2:factValue> <ns2:type>boolean</ns2:type> <ns2:value>true</ns2:value> </ns2:factValue> </ns2:derivedFact> <ns2:derivedFact> <ns2:defId>52600</ns2:defId> <ns2:defUrn>urn:ddddrunner:Medical:Definition:DerivedFact:52600:2</ns2:defUrn> <ns2:factSource>cccc Member</ns2:factSource> <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt> <ns2:factValue> <ns2:type>string</ns2:type> <ns2:value>null</ns2:value> </ns2:factValue> </ns2:derivedFact> <ns2:derivedFact> <ns2:defId>59543</ns2:defId> <ns2:defUrn>urn:ddddunner:Medical:Definition:DerivedFact:52599:1</ns2:defUrn> <ns2:factSource>dddd Member</ns2:factSource> <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt> <ns2:factValue> <ns2:type>string</ns2:type> <ns2:value>INT</ns2:value> </ns2:factValue> </ns2:derivedFact> ... With the repeating <ns2:derivedFact> element continuing under the <derivedFacts>
Any help is appreciated.
Kind regards
Rick BlanchardXMLIndex definition is not correct, for the following reasons:
In the COLUMNS clause, the path expression is compared to the context from the main event of XQuery item (HERE "/ eval").
If you use an initial slash as you did, this indicates that the context item is an element of "derivedFacts" (which is not correct since it is an "eval" element).
Therefore, the path points to no existing node:derivedFact XMLTYPE path ''/derivedFacts/ns7:derivedFact'' virtual
There is a mismatch between the statements of prefix ns7, probably a typing mistake?
''http://www.cigna.com/acme/domains/derived/fact/2010/03'' AS "ns7" ... ''http://www.cigna.com/acme/domains/derived/FACT/2010/03'' AS "ns7"
What "eval_xml" is referring to here?
passing eval_xml.derivedFact
The path to "defId" don't go too:
defId VARCHAR2(100) path ''/derivedFacts/ns7:derivedFact/ns7:defId''
Try this one, it should help you to:
CREATE INDEX "EVAL_XMLINDEX_IX" ON "EVAL" (OBJECT_VALUE) INDEXTYPE IS "XDB"."XMLINDEX" PARAMETERS ( 'XMLTable eval_idx_tab_I XMLNamespaces(''http://www.cigna.com/acme/domains/derived/fact/2010/03'' AS "ns7", DEFAULT ''http://www.cigna.com/acme/domains/eval/2010/03''), ''/eval'' COLUMNS eval_catt VARCHAR2(50) path ''@category'', derivedFact XMLTYPE path ''derivedFacts/ns7:derivedFact'' virtual XMLTable eval_idx_tab_II XMLNamespaces(''http://www.cigna.com/acme/domains/derived/fact/2010/03'' AS "ns7", DEFAULT ''http://www.cigna.com/acme/domains/eval/2010/03''), ''/ns7:derivedFact'' passing derivedFact COLUMNS defId VARCHAR2(100) path ''ns7:defId''' );
-
Get the XSD of the report query
APEX 4.0.2
Oracle 11.2.0.1.0
Hello
We are trying to retrieve the XML schema for a report query.
The following code example works, but the "xsd" for p_document_format parameter is not documented.
Is "xsd" a taken parameter value supported for APEX_UTIL. GET_PRINT_DOCUMENT?
Thank you in advance!v_blob := APEX_UTIL.GET_PRINT_DOCUMENT ( p_application_id => NV('APP_ID'), p_report_query_name => 'test', p_report_layout_name => null, p_report_layout_type => null, p_document_format => 'xsd', p_print_server => null);
Hi Eric,.
We have four different versions of apex_util.get_print_document, so depending on what you want to do, you can create PDF files and other types of documents based on your own style, your own XML data sheets or pre-defined SEO report queries SQL with predefined, or in custom arrangements. We support the output formats, as I listed previously for the four releases. However, the internal implementation of these APIs is different for the API that refer to report queries and those that refer to custom XML data. When you reference the report queries, APEX of the first loading and running queries and generates XML data and then passes the XML the print rendering engine. The analysis and execution of these queries can use the same internal functions that are also used on the edition of report request page, where you have buttons which allow to have downloaded representations XML and the XML schema for the query for your report. XML and XSD documents are intended for use with the plug-in of BI Publisher Word or design tools XSL of third parties to design presentations. Now as the same internal functions are used, you can actually generate documents from XML Schema (XSD) using the apex_util.get_print_document API, but only with versions that allow you to refer to a report query predefined. This is not officially supported, I can assure you that this behavior will not change in the future, but I don't see why we would change that. The main reason to support XML in APIs is really to test the printing functionality without requiring a print rendering engine. But it seems that there are other cases of use for those both output formats.
Hope the helps
Kind regards
Marc -
Schema validation fails on the transformed XML document
OK, this is weird.
I get XML files that are supposed to conform to a given XSD. There are dozens of different parties who send these files. To be more precise, I refer to the Ontario Energy Board (OEB) PIPE Documents.
I found that at least one sender sends invalid files. I can't that fixes to the source, so I'm working around that.
for example
Oracle is not like this:<?xml version="1.0" encoding="UTF-8"?> <PIPEDocument xmlns="http://www.oeb.gov.on.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oeb.gov.on.ca/ PIPEDocument.xsd" Version="4.0" DocumentReferenceNumber="xxx" CreationDate="20110825100008000ES"> <MarketParticipantDirectory> <Sender> ...
OK, so to work around this problem, before schema validation, I apply an XSLT transformation to clean the top-level element:ORA-31154: invalid XML document ORA-19202: Error occurred in XML processing LSX-00344: namespace values "http://www.oeb.gov.on.ca" and "http://www.oeb.gov.on.ca/" differ
Nice: the fact that it is intended for:<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.oeb.gov.on.ca"> <xsl:output method="xml" indent="no"/> <xsl:template match="/"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:if test="local-name() = name()"> <xsl:element name="{local-name()}"> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:if> </xsl:template> <xsl:template match="@*"> <xsl:if test="local-name() = name()"> <xsl:attribute name="{local-name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> </xsl:stylesheet>
If I now the schema validate the above transformed XML, then it validates OK.<?xml version="1.0" encoding="UTF-8"?> <PIPEDocument xmlns="http://www.oeb.gov.on.ca" Version="4.0" DocumentReferenceNumber="50520110825080908VA0001.EBT" CreationDate="20110825100008000ES"> <MarketParticipantDirectory> <Sender> ...
Large? No, if I try to turn on the fly (i.e. without first transformation and followed by reading in the transformed data from the file), I get a strange error:
declare v_xml xmltype := xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604.xml'), 0).transform(XDBURIType('/ERS_TEST01/PIPE/XSLT/V1.0/pre_validate_XSLT.xsl').getXML()); v_xsd_name varchar2(255) := 'PIPE/Power/V4.0/PIPEDocument.xsd'; begin if v_xml.isSchemaValid(v_xsd_name) = 1 then dbms_Output.put_line('valid'); else dbms_Output.put_line('invalid'); --in order to get specific error info for a non-schema message need to convert the XML to schema based v_xml := v_xml.createSchemaBasedXML(v_xsd_name); v_xml.schemaValidate(); end if; end; /
Exsqueeze me? What element in the schema?ORA-31043: Element '' not globally defined in schema ''
The transformation itself works very well. Specifically, if I run the following:
... I get the desired result. Of course, if I save the result file and validate the fact that it works:select xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604.xml'), 0).transform(XDBURIType('/ERS_TEST01/PIPE/XSLT/V1.0/pre_validate_XSLT.xsl').getXML()).getclobval() from dual;
I would like to join example XML file, but it contains customer data so I can't do that. I would fix the XSD but it is the nest of a rat of 50 XSD with includes and a 300 script online registration scheme, so I can't do that.declare v_xml xmltype := xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604_manually_saved.xml'), 0); v_xsd_name varchar2(255) := 'PIPE/Power/V4.0/PIPEDocument.xsd'; begin if v_xml.isSchemaValid(v_xsd_name) = 1 then dbms_Output.put_line('valid'); else dbms_Output.put_line('invalid'); --in order to get specific error info for a non-schema message need to convert the XML to schema based v_xml := v_xml.createSchemaBasedXML(v_xsd_name); v_xml.schemaValidate(); end if; end; /
What I'm missing here?
Looks like an Oracle bug for me at this isSchemaValid binds to a beginning of the XML instance and not to the instance transformed.
thoughts?
(using database Oracle 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production under linux)
Published by: Pollocks01 on October 18, 2011 16:11Hello
Looks like an Oracle bug for me at this isSchemaValid binds to a beginning of the XML instance and not to the instance transformed.
That wouldn't be surprising. There are "few" bugs on the XSL transformation.
Here's a recently posted: {: identifier of the thread = 2245703}The solution was to serialize the output and analyze again.
So, what you describe on 'reading of a works file' makes me think it's the same kind of problem.You can also view the contents of the variable just after that:
v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
?
Maybe you are looking for
-
Apparent Double Up: Digital camera RAW update 6.20
Hi all Mac: end of 2008 13 inch MacBook, 8 GB of RAM, Samsung 120 GB SSD, El Capitan OS X. I noticed the following- July 13 installed Digital Camera RAW Compatibility Update 6.20 19 July, installed as part of the iTunes store update 12.4.2. What give
-
KB2286198 Windows Update causes Windows Live Messenger stops responding and crashed.
After believing that my computer has somehow a virus and spend hours trying to solve the problem, I think that an update is causing the problem: I solved it by following these steps: KB2286198 Windows Update causes Windows Live Messenger stops respon
-
We have a Dell Inspiron 6400 laptop. When the charger is connected the screen will become black suddenly, and you can't seem to get the screen goes again. It does not seem to close completely because when I press the power button twice (or more?) i
-
My new laptop HP 15 shows white green, for videos, but has sound.
-
Is there a federal employee reviews for Windows operating system? Can I buy more than 1 copy of HUP?