REF and xmltype
Hi,
I cannot find a sample to user REF and xmltype in oracle docs.
I want to create a resource (in a folder in xmldb resource) using dbms_xdb.createresource with a REF xmltype.
Could you help me,
Regards,
Olivier
From the XML DB standard demo
declare
cursor getDepartments is
select ref(d) XMLREF,
XMLCast( XMLQUery ( '$d/Department/Name' passing object_value as "d" returning content) as VARCHAR2(32) ) NAME
from DEPARTMENT_XML d;
res boolean;
targetFolder varchar2(1024) := '/home/SCOTT/Departments';
begin
if dbms_xdb.existsResource(targetFolder) then
dbms_xdb.deleteResource(targetFolder,dbms_xdb.DELETE_RECURSIVE);
end if;
res := dbms_xdb.createFolder(targetFolder);
for dept in getDepartments loop
res := DBMS_XDB.createResource(targetFolder || '/' || dept.NAME || '.xml', dept.XMLREF);
end loop;
end;
select path
from path_view
where under_path(RES,'/home/SCOTT/Departments') = 1
/
Similar Messages
-
X-refs and index markers in absolute paths don't work
A problem has arisen that did not exist before:
If I have added files to a book using an absolute path, all X-refs and index markers in those files then don't work. The index *generates* without trouble, but if I then try to Alt-click an item in the index that refers back to a file with an absolute path I get the error "Cannot find the file named X. Make sure the file exists." This also means, of course, that the corresponding hyperlinks in a generated PDF file also don't work.
X-refs and index markers in files added using *relative* paths work okay.
What is wrong?
(I use FM9 / Windows 7.)
Regards,
Knut HögvallHi Michael,
Yes, I use 9.0p255.
No, the files don't have to be on different volumes. They can even be in the same folder (not that they are, but they *could* be; they are in fact in separate folders, but on the same volume). What matters is how I select the file in the File dialog box when I add the file to the book. To get an absolute link, I first click the Network button, select the top volume, and then navigate down to the file. The absolute path is displayed in the book window as \\<volume>\folder\file.fm" while a relative path is indicated by "..\..\file.fm".
If I add a file using an absolute path it doesn't work; if I add the exact same file using a relative path, it works.
How do I check the hypertext content in the index?
Regards,
- Knut -
Hi,
I am getting the below error for JXDM when using. It was mentioned in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302524 that it is fixed. Still getting this error.
a) Appreciate if anyone can tell how to use the bug fix b20 that is mentioned in the above? I downloaded the latest jaxb 2.0 from this site and also from the jaxb RI(Reference Implementation and tried both).
b) Is there any workaround to get through this?
Will appreciate if any one can give advise on this.
************** Here is the error message ******************
There was this problem creating a context com.sun.xml.bind.v2.runtime.IllegalAnn
otationsException: 1 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "usStateCodeType". Use @XmlType.name and
@XmlType.namespace to assign different names to them.
this problem is related to the following location:
at gov.ojp.it.jxdm.usps_states._1.USStateCodeType
at protected gov.ojp.it.jxdm.usps_states._1.USStateCodeType gov.
ojp.it.jxdm._3_0_2.proxy.usps_states._1.USStateCodeType.value
at gov.ojp.it.jxdm._3_0_2.proxy.usps_states._1.USStateCodeType
at protected gov.ojp.it.jxdm._3_0_2.proxy.usps_states._1.USState
CodeType generated.CjsAddressType.locationStateCodeUSPostalService
at generated.CjsAddressType
at protected java.util.List generated.CjsPersonType.personAddres
s
at generated.CjsPersonType
at protected generated.CjsPersonType generated.CjsSuspectType.su
spectPerson
at generated.CjsSuspectType
at protected generated.CjsSuspectType generated.CjsReportType.su
spect
at generated.CjsReportType
at public generated.CjsReportType generated.ObjectFactory.create
CjsReportType()
at generated.ObjectFactory
this problem is related to the following location:
at gov.ojp.it.jxdm.fips_5_2._1.USStateCodeType
at protected gov.ojp.it.jxdm.fips_5_2._1.USStateCodeType gov.ojp
.it.jxdm._3_0_2.proxy.fips_5_2._1.USStateCodeType.value
at gov.ojp.it.jxdm._3_0_2.proxy.fips_5_2._1.USStateCodeType
at protected java.util.List gov.ojp.it.jxdm._3_0.AddressType.loc
ationStateCodeFips52Alpha
at gov.ojp.it.jxdm._3_0.AddressType
at protected java.util.List gov.ojp.it.jxdm._3_0.LocationType.lo
cationAddress
at gov.ojp.it.jxdm._3_0.LocationType
at protected java.util.List gov.ojp.it.jxdm._3_0.OrganizationTyp
e.organizationLocation
at gov.ojp.it.jxdm._3_0.OrganizationType
at protected java.util.List gov.ojp.it.jxdm._3_0.BookingType.boo
kingAgency
at gov.ojp.it.jxdm._3_0.BookingType
at generated.CjsBookingType
at public generated.CjsBookingType generated.ObjectFactory.creat
eCjsBookingType()
at generated.ObjectFactory
Check this out
Exception in thread "main" java.lang.NullPointerException
at bpd.MakeNewItem.marshallItem(MakeNewItem.java:119)
at bpd.MakeNewItem.persistItem(MakeNewItem.java:112)
at bpd.MakeNewItem.<init>(MakeNewItem.java:31)
at bpd.MakeNewItem.main(MakeNewItem.java:137)
********************End of error message ******************
Thanks
Sat
Message was edited by:
sat_pIn Help > About > Properties:
sqldeveloper.oci.available = true -
Important Question about reFit and EFI
Hi guys
I have a problem, and although I have rEFIt installed on my EFI hard drive since it does not detect a fusion Drive.
So now I want to delete it, but you would have to help me find the correct terminal command out
Here are the commands to create:
From a Terminal or command-line prompt, run the following commands:
1
$ sudo mkdir /efi
This will create the mount point for the EFI system partition
1
$ sudo mount -t msdos /dev/disk0s1 /efi
This command will mount the EFI system partition (usually hidden from Mac OS X) into /efi. The EFI system partition is basically a 200MB FAT32 partition which is, by default empty.
NOTE: Please, take into consideration that EFI system partition is usually the first partition on the built-in hard disk, which is usually /dev/disk0s1, although it could be different on your system.
1
open /efi
This will open the /efi folder in Finder.
Now, download rEFIt and copy the contents of the efi folder into /efi.
In the end, you should have the following subdirectories on your machine:
/efi/efi/refit
/efi/efi/tools
Now, we will bless the EFI system partition:
1
sudo bless --mount /efi --setBoot --file /efi/efi/refit/r
THANK YOU!!!!If you just wanted to run shell commands, this might work. You would need to create links on the linux host to match the Mac equivalent. I did this with Shake a long time ago.
-
Difference between resource-ref and resource-env-ref ?
Hello,
Can anyone tell me what the difference is between <resource-ref> and <resource-env-ref>? (in ejb-jar.xml)
Thanks in advance,
Julien Martin.Check out this URL. You will find out your answer.
http://docs.sun.com/source/816-7156-10/agj2eres.html
Thanks -
Xs:group refs and "ORA-30936: Maximum number (1) of XML nodes exceeded'
We registered a subset of the IBM DITA schemas in Oracle XDB. These schemas contain a lot of xs:group definitions where references to these groups contain "minOccurs" and "maxOccurs" atttributes, for instance:
<xs:group name="category">
<xs:sequence>
<xs:element ref="category"/>
</xs:sequence>
</xs:group>
<xs:complexType name="metadata.class">
<xs:sequence>
<xs:group ref="audience" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="category" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="keywords" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="prodinfo" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="othermeta" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="mapkeyref" type="xs:string"/>
<xs:attributeGroup ref="global-atts"/>
<xs:attribute ref="class" default="- topic/metadata "/>
</xs:complexType>
When we create an instance document that contains more than one "category" element under the element "metadata" element, like:
<metadata>
<audience type="purchaser" othertype="" job="using" otherjob="" experiencelevel="general"/>
<category/>
<category/>
</metadata>
we get the error: ORA-30936: Maximum number (1) of 'category' XML node elements exceeded
This error is not consistent with the schema and XML parsers like Xerces and the Oracle "XDK parser" think the instance is fine.
When we skip the reference to the group and reference the element definition "category" directly the problem is gone:
<xs:complexType name="metadata.class">
<xs:sequence>
<xs:group ref="audience" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="category" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="keywords" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="prodinfo" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="othermeta" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="mapkeyref" type="xs:string"/>
<xs:attributeGroup ref="global-atts"/>
<xs:attribute ref="class" default="- topic/metadata "/>
</xs:complexType>
In this case the problems for the other group references like "audience" remain.
It looks like Oracle XDB doesn't honor the cardinality attributes "minOccurs" and "maxOccurs" on xs:group elements that are references. Does anyone experienced similar problems?
Thanks,
MaartenThis sounds like bug 5204107. You'll need to open a tar with Oracle Support if you need a fix for this..
It happens when a group is used once without a maxOccurs and then later with a maxOccurs.
The workaround is 'in-line' the group before registering the XML Schema. This can be done as follows (assuming the group definition and reference are in the same XML Schema)..
procedure expandGroup(xmlschema in out xmltype, groupName varchar2,xsdDirectory varchar2)
is
xsdSchemaPath varchar2(512);
groupModel xmltype;
sequenceModel xmlType := xmlType('<xsd:sequence ' || xdb_namespaces.XMLSCHEMA_PREFIX_XSD || '><xsd:sequence/></xsd:sequence>');
maxOccursValue binary_integer;
begin
-- FInd the Group Definition
if xmlSchema.existsNode('/xsd:schema//xsd:group[@ref="' || groupName || '"]',NAMESPACES) = 1 then
if xmlSchema.existsNode('/xsd:schema/xsd:group[@name="' || groupName || '"]',NAMESPACES) = 1 then
select extract
xmlSchema,
'/xsd:schema/xsd:group[@name="' || groupName || '"]',
NAMESPACES
into groupModel
from dual;
else
dbms_output.put_line('xsdDirectory = ' || xsdDirectory);
select PATH,
extract
CONTENTS,
'/xsd:schema/xsd:group[@name="' || groupName || '"]',
NAMESPACES
into xsdSchemaPath, groupModel
from (
select PATH, xdburitype(path).getXML() CONTENTS
from PATH_VIEW
where under_path(res,xsdDirectory) = 1
where existsNode
CONTENTS,
'/xsd:schema/xsd:group[@name="' || groupName || '"]',
NAMESPACES
) = 1;
dbms_output.put_line('Resolved ' || groupModel.extract('/xsd:group/@name',NAMESPACES).getStringVal() || ' in Schema ' || xsdSchemaPath);
end if;
if groupModel.existsNode('/xsd:group/xsd:annotation',NAMESPACES) = 1 then
select deleteXML
groupModel,
'/xsd:group/xsd:annotation',
NAMESPACES
into groupModel
from dual;
end if;
-- create a sequence that can be placed in-line in the XML Schema to replace the <group ref=""/>
groupModel := groupModel.extract('/xsd:group/*',NAMESPACES);
select updateXML
sequenceModel,
'/xsd:sequence/xsd:sequence',
groupModel,
NAMESPACES
into sequenceModel
from dual;
if xmlSchema.existsNode('/xsd:schema//xsd:group[@ref="' || groupName || '" and not(@maxOccurs)]',NAMESPACES) = 1 then
select updateXML
xmlSchema,
'/xsd:schema//xsd:group[@ref="' || groupName || '" and not(@maxOccurs)]',
sequenceModel,
NAMESPACES
into xmlSchema
from dual;
end if;
select insertChildXML
sequenceModel,
'/xsd:sequence',
'@maxOccurs',
'unbounded',
NAMESPACES
into sequenceModel
from dual;
if xmlSchema.existsNode('/xsd:schema//xsd:group[@ref="' || groupName || '" and @maxOccurs="unbounded"]',NAMESPACES) = 1 then
select updateXML
xmlSchema,
'/xsd:schema//xsd:group[@ref="' || groupName || '" and @maxOccurs="unbounded"]',
sequenceModel,
NAMESPACES
into xmlSchema
from dual;
end if;
while xmlschema.existsNode('/xsd:schema//xsd:group[@ref="' || groupName || '"]',NAMESPACES) = 1 loop
maxOccursValue := xmlSchema.extract('/xsd:schema//xsd:group[@ref="' || groupName || '"]/@maxOccurs').getNumberVal();
select updateXML
sequenceModel,
'/xsd:sequence/@maxOccurs',
maxOccursValue,
NAMESPACES
into sequenceModel
from dual;
select updateXML
xmlSchema,
'/xsd:schema//xsd:group[@ref="' || groupName || '" and @maxOccurs="' || maxOccursValue || '"]',
sequenceModel,
NAMESPACES
into xmlSchema
from dual;
end loop;
end if;
end;
-- -
Different output XMLTRANSFORM and XMLTYPE.TRANSFORM
Hi,
we upgrade from 10gR2 to 11gR2 and still have problems with XML transformation. Under unknown circumstances the XMLTRANSFORM function
fails with "LPX-00660: Not a well-formed document or external entity" when the count of Page elements is greater then one.
It seems, this bug isnt fixed in 11gR2...
SET SCAN OFF
DECLARE
xml XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
<FILE>
<DOCUMENT>
<PAGE>
<b101f>Hello</b101f>
<b101>World</b101>
<f101/>
<REGARDS/>
</PAGE>
</DOCUMENT>
<DOCUMENT>
<PAGE>
<list_layout xpos="10" lsign="+"/>
<le>May</le>
<le>the</le>
<le stil="f">force</le>
<le>be</le>
<le>with</le>
<le>you</le>
<f101/>
<REGARDS/>
</PAGE>
</DOCUMENT>
</FILE>
xsl XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FILE">
<FILE>
<xsl:apply-templates/>
</FILE>
</xsl:template>
<xsl:template match="DOCUMENT">
<DOCUMENT>
<xsl:apply-templates/>
</DOCUMENT>
</xsl:template>
<xsl:template match="PAGE">
<PAGE>
<CONTENT>
<xsl:apply-templates/>
</CONTENT>
</PAGE>
</xsl:template>
<xsl:template match="REGARDS">
<xsl:text disable-output-escaping="yes">&lt;lt;b101&lt;gt;Best regards&lt;lt;/b101&lt;gt;</xsl:text>
</xsl:template>
</xsl:stylesheet>
buf VARCHAR2(32767 CHAR);
BEGIN
DBMS_OUTPUT.PUT_LINE(xml.transform(xsl).getClobVal());
SELECT xmltransform(xml, xsl).getStringVal()
INTO buf
FROM dual;
DBMS_OUTPUT.PUT_LINE(buf);
END;
/Oracle Docu: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb08tra.htm
XMLType instance can be transformed in the following ways:
Using Oracle SQL function XMLtransform or XMLType method transform() in the database.
Using Oracle XML Developer's Kit transformation options in the middle tier, such as XSLT Processor for Java.
You can alternatively use XMLType method transform() as an alternative to Oracle SQL function XMLtransform. It has the same functionality.
Output:
<FILE>
<DOCUMENT>
<PAGE>
<CONTENT>
<b101f>Hello</b101f>
<b101>World</b101>
<f101/>&lt;lt;b101&lt;gt;Best regards&lt;lt;/b101&lt;gt;</CONTENT>
</PAGE>
</DOCUMENT>
<DOCUMENT>
<PAGE>
<CONTENT>
<list_layout xpos="10" lsign="+"/>
<le>May</le>
<le>the</le>
<le stil="f">force</le>
<le>be</le>
<le>with</le>
<le>you</le>
<f101/>&lt;lt;b101&lt;gt;Best regards&lt;lt;/b101&lt;gt;</CONTENT>
</PAGE>
</DOCUMENT>
</FILE>
<FILE><DOCUMENT><PAGE><CONTENT><b101f>Hello</b101f><b101>World</b101><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT><DOCUMENT><PAGE><CONTENT><list_layout xpos="10" lsign="+"></list_layout><le>May</le><le>the</le><le stil="f">force</le><le>be</le><le>with</le><le>you</le><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT></FILE>Hi,
we upgrade from 10gR2 to 11gR2 and still have problems with XML transformation. Under unknown circumstances the XMLTRANSFORM function
fails with "LPX-00660: Not a well-formed document or external entity" when the count of Page elements is greater then one.
It seems, this bug isnt fixed in 11gR2...
SET SCAN OFF
DECLARE
xml XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
<FILE>
<DOCUMENT>
<PAGE>
<b101f>Hello</b101f>
<b101>World</b101>
<f101/>
<REGARDS/>
</PAGE>
</DOCUMENT>
<DOCUMENT>
<PAGE>
<list_layout xpos="10" lsign="+"/>
<le>May</le>
<le>the</le>
<le stil="f">force</le>
<le>be</le>
<le>with</le>
<le>you</le>
<f101/>
<REGARDS/>
</PAGE>
</DOCUMENT>
</FILE>
xsl XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FILE">
<FILE>
<xsl:apply-templates/>
</FILE>
</xsl:template>
<xsl:template match="DOCUMENT">
<DOCUMENT>
<xsl:apply-templates/>
</DOCUMENT>
</xsl:template>
<xsl:template match="PAGE">
<PAGE>
<CONTENT>
<xsl:apply-templates/>
</CONTENT>
</PAGE>
</xsl:template>
<xsl:template match="REGARDS">
<xsl:text disable-output-escaping="yes">&lt;lt;b101&lt;gt;Best regards&lt;lt;/b101&lt;gt;</xsl:text>
</xsl:template>
</xsl:stylesheet>
buf VARCHAR2(32767 CHAR);
BEGIN
DBMS_OUTPUT.PUT_LINE(xml.transform(xsl).getClobVal());
SELECT xmltransform(xml, xsl).getStringVal()
INTO buf
FROM dual;
DBMS_OUTPUT.PUT_LINE(buf);
END;
/Oracle Docu: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb08tra.htm
XMLType instance can be transformed in the following ways:
Using Oracle SQL function XMLtransform or XMLType method transform() in the database.
Using Oracle XML Developer's Kit transformation options in the middle tier, such as XSLT Processor for Java.
You can alternatively use XMLType method transform() as an alternative to Oracle SQL function XMLtransform. It has the same functionality.
Output:
<FILE>
<DOCUMENT>
<PAGE>
<CONTENT>
<b101f>Hello</b101f>
<b101>World</b101>
<f101/>&lt;lt;b101&lt;gt;Best regards&lt;lt;/b101&lt;gt;</CONTENT>
</PAGE>
</DOCUMENT>
<DOCUMENT>
<PAGE>
<CONTENT>
<list_layout xpos="10" lsign="+"/>
<le>May</le>
<le>the</le>
<le stil="f">force</le>
<le>be</le>
<le>with</le>
<le>you</le>
<f101/>&lt;lt;b101&lt;gt;Best regards&lt;lt;/b101&lt;gt;</CONTENT>
</PAGE>
</DOCUMENT>
</FILE>
<FILE><DOCUMENT><PAGE><CONTENT><b101f>Hello</b101f><b101>World</b101><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT><DOCUMENT><PAGE><CONTENT><list_layout xpos="10" lsign="+"></list_layout><le>May</le><le>the</le><le stil="f">force</le><le>be</le><le>with</le><le>you</le><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT></FILE> -
Bootcamp, rEFIt and virtual
I have a MacBook with OS X Lion,
I installed Windows 7 via Boot Camp, added Linux (Backtrack) using rEFIt.
I now access OS X, Windows and BackTrack via rEFIt's boot menu. When I choose Backtrack or Windows I am routed to GRUB boot loader, Windows 7 being one of GRUB's options. If I choose Windows, it boots Windows properly.
problem is I don't manage to configure windows in virtualbox or vmware fusion 4
I tried the solution in http://communities.vmware.com/message/969654#969654, but get stuck while trying to restore windows MBR. The windows install disk says: "this version of recovery tools is not compatible with your install..."
Output of fdisk /dev/disk0
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: AF 1023 254 63 - 1023 254 63 [ 409640 - 741694744] HFS+
*3: 07 1023 254 63 - 1023 254 63 [ 819032064 - 157741056] HPFS/QNX/AUX
4: 82 1023 254 63 - 1023 254 63 [ 742105088 - 1951744] Linux swap
output of diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 379.7 GB disk0s2
3: Microsoft Basic Data BOOTCAMP 80.8 GB disk0s3
4: Linux Swap 999.3 MB disk0s4
5: Microsoft Basic Data 38.4 GB disk0s5
Any ideas?
Thank youHi again Alex,
This is just my opinion. rEFIt is open source and one of the main benefits of using Mac OS X is that it opens up access to the vast quantity of open source software and utilities. For this reason, I think that it will not void your warranty. If the situation is such that you need to return your MBP for repairs are you able to revert to the original EFI?
Of course, this isn't a categoric answer and on these user-to-user forums you will not receive a definitive answer with regards to unusual warranty type questions.
Call Apple or pop down to your local Apple Store and ask. Additionally, the "Apple One (1) Year Limited Warranty" details can be viewed in the following link:
http://www.apple.com/legal/warranty/hardware.html
Kryten -
Oracle 9i and xmltype, ora-03001
I get this message: 'ora-03001 unimplemented feature' when i
trying to create a table with this statement: create table
purchaseorder(podocument sys.xmltype);
-The user has the following roles:
connect, resource, javauserpriv, query rewrite, create any
directory.
-And execute privilege on xmlparser and xmldom (granted by sys).
-The init.ora file is included with query_rewrite_enabled=true,
query_rewrite_integrity=trusted.
What's wrong?Colleague, I had problem the same that its, also with the postagem of a message here in this forum. I have the successfully installed Oracle 9i EE, after two weeks of very work, in IBM to xServer 220, with SuSE 7.2 This error occurred due to the fact of incorrect parameters of the init.ora, as well as, through some definite parameters incorrectly, in that if it says respect the 0 variable of environment of the ORACLE. One remembers to modify parameter REMOTE_LOGIN... of EXCLUSIVE for NONE and of preference it comments this in its archive INIT.ORA. Of one looked at in check list of installation of the Oracle, as well as in the specific manual of pattern for its distribution for the correct definition of the parameters of its archive of pattern.
-
Store XML data as relational data into Oracle tables using Java and XMLType
I want to store xml data into an Oracle 11g table as relational storage, not as CLOB or Binary storage. Then I should also be able to query and fetch this data from table into an XML file.
Any hint on how to write java code using XMLType to achieve this?
Any help would be appreciated.Thanks for the explanation. I still have few confusions. I will try to elaborate my requirement with a simple example...
I have the following xsd and xml files. "note" would be the table in database and "to", "from", "heading" and "body" would be the columns of note table. "Tove", "Jan", "Reminder" and "Don't forget me this weekend!" would go as data in one row of note table.
How do I create note table with the xml schema (xsd file)?
Should the note table be of XMLType or the columns?
How do I load the XML data into the columns of note table?
How do I retrieve the row of note table as XML file?
XML Schema:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.xxxxx.com"
xmlns="http://www.xxxxx.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
XML Data:
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jan</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note> -
Dynamic programming issue: store typed ref in generic ref and back
Hi All,
Im working on a generic 'Snapshot' functionality for Class objects.
Some background info:
The basic idea is that when the class implements the snapshot interface, a 'snapshot' can be taken of that object and its attributes. At a later point the object can be restored to its previous state by recovering all of its attributes values from the snapshot.
All types of attributes work well (data, ref to Class, ref to data, structs, tables, tables with refs, etc etc) except the typed data references ( TYPE REF TO [Type] ).
The issue:
What i try to acomplish is the following:
I want to store a typed data reference (TYPE REF TO Mandt) into an untyped data reference (TYPE REF TO Data) and back.
The goals is to, in the end, have the data refrence point to the same address as in the beginning, not necesseraly the same value.
The problem is in the last step where i move back the reference from the untyped to the typed reference.
here i keep getting Dumps caused by type incompatability. The weird thing is that in debug i see that both TECHNICAL TYPES are equal (MANDT) but the Absolute types differ. This still understandable because in fact both data types are unequal (REF TO Mandt vs. REF TO Data).
I've tried dozens of things but i can not get it to work properly. Ive looked into type casting, using helper refs, trying to dynamically create the store data object with type specified, etc , etc.
Please see the sample code below for better understanding.
Hope you guys can help me out here. Any other solution to accomplish my goal is welcome as well ofcourse!
Thanks in advance!
Joris Bots
REPORT ztestjbo3.
* Store a typed data reference into generic 'Store'.
* and restore from that store.
* Phase 1: Store/Save data reference in store
* Phase 2: Change location our datref points to
* Phase 3: Restore our dataref from the store
* The generic data store (untyped)
DATA g_datastore TYPE REF TO data.
* Simple data
DATA lv_mandt1 TYPE mandt VALUE '100'.
DATA lv_mandt2 TYPE mandt VALUE '200'.
* Our data reference (typed)
DATA lr_mandt TYPE REF TO mandt.
************************* Phase 1 Store/Save data reference in store
GET REFERENCE OF lv_mandt1 INTO lr_mandt.
* our data ref lr_mandt now points to lv_mandt, containing '0100'
*create data g_datastore like lr_mandt.
g_datastore = lr_mandt.
* store/save this ref to '0100'.
************************* Phase 2 Change location our datref points to
* Get other ref into LR_MANDT
GET REFERENCE OF lv_mandt2 INTO lr_mandt.
************************* PART 3 Restore our dataref from the store
FIELD-SYMBOLS <fs> TYPE any.
ASSIGN g_datastore TO <fs>.
* This is where it all goes bad.
lr_mandt = <fs>.
* Shortdumps caused by type incompatability
* In debug it shows that technical Types are equal (MANDT)
* but The Absulote types (%_T00004S00000038O0000022592, etc) differ.
* Below code is NOT the solution since lv_Mandt1 then overwrites lv_Mandt2
*ASSIGN g_datastore->* TO <fs>.
*lr_mandt->* = <fs>.
Edited by: Joris Bots on Jan 13, 2011 5:06 PMHi ..
Your last statement was wrong.
Just add the below line instead of
*****ASSIGN g_datastore TO <fs>. " Here <FS> is type od DATA which is generic type
This is where it all goes bad.
****lr_mandt = <fs>. " here you try to assign one data type directly to particular data type MATNR which is not possible
ASSIGN g_datastore->* to <fs>.
GET REFERENCE OF <fs> INTO lr_mandt.
IF sy-subrc = 0.
ENDIF.
Thanks
Subhankar -
Hi,
I have stored a instance of XMLDocument on my Oracle db.
I have used XMLType object (oracle.xml.parser.v2) to take it value.
XmlType Xml = XMLType.createXML(orset.getOPAQUE("Policy"));
So, I cast value to create a XMLDOM document
Document XmlDoc = (Document) Xml.getDOM();
But when I try to access XMLDOM this value occured :
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xF532F2E
Function=qmxPrintXobToStreamWithPfx+0x2E
Library=C:\oracle\ora92\bin\orageneric9.dll
Current Java thread:
at oracle.xdb.dom.XDBNode.toStringNative(Native Method)
- locked <02A20FF0> (a oracle.xdb.dom.XDBElement)
at oracle.xdb.dom.XDBNode.toString(XDBNode.java:510)
at java.lang.String.valueOf(String.java:2177)
at java.io.PrintStream.print(PrintStream.java:462)
at firstimpl.FirstImpl.NodeRules(FirstImpl.java:338)
at firstimpl.FirstImpl.NodeRegistration(FirstImpl.java:380)
at firstimpl.FirstImpl.<init>(FirstImpl.java:127)
at firstimpl.FirstImpl.main(FirstImpl.java:1307)
Thanks in advance,
OmarLooks like a bug in orageneric9.dll
You should search Oracle's bug listings and patches. -
Ejb-ref and JNDI lookup problem
Hi,
I use WLS6.1sp2. I created one EntityBean and SessionBean jar files. I tried to
use session bean to refer entity bean, I failed. The details are as following:
In EntityBean's weblogic-ejb-jar.xml, I set:
<jndi-name>cabin.CabinHome</jndi-name>
In sessionbean's ejb-jar.xml
<ejb-ref>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.titan.cabin.CabinHome</home>
<remote>com.titan.cabin.Cabin</remote>
</ejb-ref>
In sessionbean's weblogic-ejb-jar.xml
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<jndi-name>ejb/CabinHome</jndi-name>
</ejb-reference-description>
</reference-descriptor>
At sessionbean's client, I use
javax.naming.Context jndiContext = getInitialContext();
Object obj = jndiContext.lookup("java:comp/env/ejb/CabinHome");
When I run client file, I get the following error message:
- with nested exception:
[javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining name
'CabinHome']; Link Remaining Name: 'ejb/CabinHome']>
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining name
'CabinHome'
<<no stack trace available>>
--------------- nested within: ------------------
javax.ejb.EJBException
- with nested exception:
[javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining name
'CabinHome']; Link Remaining Name: 'ejb/CabinHome']
at com.titan.travelagent.TravelAgentBean.listCabins(TravelAgentBean.java:45)
at com.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl.listCabins(TravelAgentBean_a4c3ph_EOImpl.java:37)
at com.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
####<Feb 1, 2002 11:32:40 PM PST> <Info> <Management> <dj> <travelServer> <ExecuteThread:
'14' for queue: 'default'> <system> <> <140009> <Configuration changes for domain
saved to the repository.>
Do you know what's wrong? how to fix this problem?
Thanks in advance.
DJSlava,
I took "cabin." out from weblogic-ejb-jar.xml, I got the same error.
DJ
"Slava Imeshev" <[email protected]> wrote:
Hi DJ,
I think you don't need "cabin." in weblogic-ejb-jar.xml :
<jndi-name>cabin.CabinHome</jndi-name>
Regards,
Slava Imeshev
"DJ" <[email protected]> wrote in message
news:[email protected]...
Hi,
I use WLS6.1sp2. I created one EntityBean and SessionBean jar files.I
tried to
use session bean to refer entity bean, I failed. The details are asfollowing:
In EntityBean's weblogic-ejb-jar.xml, I set:
<jndi-name>cabin.CabinHome</jndi-name>
In sessionbean's ejb-jar.xml
<ejb-ref>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.titan.cabin.CabinHome</home>
<remote>com.titan.cabin.Cabin</remote>
</ejb-ref>
In sessionbean's weblogic-ejb-jar.xml
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<jndi-name>ejb/CabinHome</jndi-name>
</ejb-reference-description>
</reference-descriptor>
At sessionbean's client, I use
javax.naming.Context jndiContext = getInitialContext();
Object obj = jndiContext.lookup("java:comp/env/ejb/CabinHome");
When I run client file, I get the following error message:
- with nested exception:
[javax.naming.LinkException: [Root exception is
javax.naming.NameNotFoundException:>> Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining>name>> 'CabinHome'; Link Remaining Name: 'ejb/CabinHome']>
javax.naming.LinkException: . Root exception isjavax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remainingname
'CabinHome'
<<no stack trace available>>
--------------- nested within: ------------------
javax.ejb.EJBException
- with nested exception:
[javax.naming.LinkException: [Root exception is
javax.naming.NameNotFoundException:>> Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining>name>> 'CabinHome'; Link Remaining Name: 'ejb/CabinHome']
atcom.titan.travelagent.TravelAgentBean.listCabins(TravelAgentBean.java:45)
atcom.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl.listCabins(TravelAgentBe
an_a4c3ph_EOImpl.java:37)
atcom.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
atweblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:93)
atweblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
atweblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:2
2)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
####<Feb 1, 2002 11:32:40 PM PST> <Info> <Management> <dj> <travelServer><ExecuteThread:
'14' for queue: 'default'> <system> <> <140009> <Configuration changesfor
domain
saved to the repository.>
Do you know what's wrong? how to fix this problem?
Thanks in advance.
DJ -
PLSQL and XMLTYPE -- Trying to pass cursor record into a XMLTYPE query.
Hi all --
I'm trying to pass records from a cursor into a xmltype query, with no success. If i hard code what the cursor record is, it works just fine, but when I use cursor_rec.value, I think it is taking that strin literally. Here is a simple example of what i'm trying to do.
Brief Background -- I have two tables (OPLAN, OPLAN_SUB_CONT) with an XMLTYPE column. OPLAN contains the bulk/main XML with about 30 elemets, while OPLAN_SUB_CONT contains the xml files which either inserts or updates any of the 30 elements. Instead of hard coding 30 statments to check each element, I created a cursor to cycle through the possible elements. If an element exists i do something , if not i go the next element.
This returns null, using elements_rec.element_name in the query...
declare
cursor cur_get_elements is
select element_name
from oplan_element_attribs
where parent_element='Transactions'
and element_name='OPLAN_STATUS';
elements_rec cur_get_elements%rowtype;
v_element number;
begin
for elements_rec in cur_get_elements
Loop
dbms_output.put_line ('before extract');
select nvl(count(value(p)),0)
into v_element
from oplan_sub_content_xml oscx,
table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/elements_rec.element_name'))) p;
if v_element =0
then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is null');
elsif v_element > 0
then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is not null');
end if;
end loop;
end;
SQL> /
before extract
Element OPLAN_STATUS is null
PL/SQL procedure successfully completed.
If i hard code the element_name (elements_rec.element_name) on line 16 (line wraps) to "OPLAN_STATUS' i get desired results ... returns not null
declare
cursor cur_get_elements is
select element_name
from oplan_element_attribs
where parent_element='Transactions'
and element_name='OPLAN_STATUS';
elements_rec cur_get_elements%rowtype;
v_element number;
begin
for elements_rec in cur_get_elements
Loop
dbms_output.put_line ('before extract');
select nvl(count(value(p)),0)
into v_element
from oplan_sub_content_xml oscx,
table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/OPLAN_STATUS'))) p;
if v_element =0
then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is null');
elsif v_element > 0
then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is not null');
end if;
end loop;
end;
SQL> /
before extract
Element OPLAN_STATUS is not null
PL/SQL procedure successfully completed.
Any ideas?
Thanks!I should try everything before posting! Sorry, got it to work...
replaced ..
select nvl(count(value(p)),0)
into v_element
from oplan_sub_content_xml oscx,
table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/elements_rec.element_name'))) p;
with
select nvl(count(value(p)),0)
into v_element
from oplan_sub_content_xml oscx,
table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/' || elements_rec.element_name || ''))) p; -
DirectToXMLType Mapping and XMLType functions
Hi,
I am using Toplink 11g, Weblogic 10.3 and Database Oracle 11g for my application. This application uses DirectToXMLType mapping. XMLtype column is mapped as String. Though I am able to create and query(findAll) the tables, I am not able to use specific XMLType functions like existsNode, extract etc... These methods throw the following exception.
TopLink Warning: 2009.03.18 05:26:00.328--DatabaseSessionImpl(22872587)--Exception TOPLINK-6047 (Oracle TopLink - 11g Release 1 (11.1.1.1.0) (Build 090129)): oracle.toplink.exceptions.QueryException
Invalid operator platform operator - ExistsNode in expression.
Are these operators supported?
When I query the database directly
SELECT * FROM element WHERE existsNode(ELEMENT_META, '//ROOT','xmlns:ora="http://xmlns.oracle.com/xdb"')= 1;
rows are returned.
I constructed an expression simillar to the following as
ExpressionBuilder exp = new ExpressionBuilder();
Expression criteria = exp.get("elementMeta").existsNode("'//ROOT','xmlns:ora=\"http://xmlns.oracle.com/xdb\"'").equal(1);
The above method throws exception. I followed the example provided in Oracle Toplink Developer guide, Example 110–7 Using the XMLType Extract Operator,
builder.get("resume").extract("//education/degree/text()").getStringVal().equal("BCS");
this also throws error for getStringVal().
Do I need to do any other setup?
Regards
RajiHello,
In your TopLink login configuration, what DatabasePlatform have you specified? The existsNode operator only exists in the Oracle9Platform class, and so can only be used if you are using it or the Oracle10Platform or Oracle11Platform which extend it.
Best Regards,
Chris
Maybe you are looking for
-
New to the Mac World - please help...
I have purchased a Time Capsule to use as a Hard Drive with my Mac Book air so I don't drown it in files. I would like to know how to change the preferences so I can store application files on the Time Capsule. Mainly in Mail - I want to create a Mai
-
I don't know what I did when I was checking my emails, but somehow I ended up with a large window that displays a list of the emails but not the content of the selected one like before, unless I open each one individually... I tried shutting down, ho
-
Saving a pdf form in illustrator
Firstly, I would like to say hello as this is my first post. I'm just a novice compared to the majority of you guys here but hopefully I'll be able to muck in a little and add my share of help in the days ahead My problem may be a simple one but as e
-
Hello Experts, I am using SUBST_START_REPORT_IN_BATCH to generate absence quotas for the employees using report program RPTQTA00. But it is taking too much time. I want to use RPTQTA00 in direct mode but I dont know what sett
-
Compensation Model for Benefits
Hi All, I am new to benefits. I would like to know, some information about compensation model in benefits. We have 401k salary,hourly,catchup,Deferredcompensation Bonus and Salary Plans in infotype 169. I am using /102 wagetype as Technical base. Ca