Add XML Element ID to all elements as attribute
Hi There,
The title hopefully states what I like to get. I'm having quite some documents that are tagged, but want to add an id to all elements to allow for better XML manipulation outside on Indesign. I've been looking around a bit but seems to be not to many people ever bothered with...
So, how do I traverse through all my XML elements, and add the element ID as attribute ?
Thanks,
Koen
Hi Koen,
Please try the below JS code. This code its working fine in InDesign CS5.5.
var myDoc = app.activeDocument;
try{
var rootElement = myDoc.xmlElements.item(0);
var linkElementList = rootElement.evaluateXPathExpression("//para");
for(i=linkElementList.length-1; i>=0; i--){
var myAttribute = linkElementList[i];
myAttribute.xmlAttributes.add("idname", "idvalue");
}catch(e){}
thx,
csm_phil
Similar Messages
-
[CS3] [JS] add XML Element to Insertion Points
hi list,
i'll do some text parsing in indesign cs3 intended to add some xml elements to my document.
i just wonder why i can't markup an insertion point. is the following approach correct? The code works fine, only the return value (stored in the _xml variable) is not the new element but the parent element. The same code works without using the insertion point (marking up the text object [xmlElements.add(_dokument.xmlTags.item("index") , erg[0]))] ).
Any ideas or thoughts?
var _dokument = app.activeDocument;
main ();
// ** main ()
function main() {
//Set the find options.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences= NothingEnum.nothing;
//find any string encloased by @
app.findGrepPreferences.findWhat = "@.*?@";
erg = _dokument.findGrep();
while (erg.length > 0) {
_xml = _dokument.xmlElements[0].xmlElements.item("text").xmlElements.add(_dokument.xmlTags.item( "index") , erg[0].insertionPoints[0]);
erg[0].contents = "";
erg = _dokument.findGrep();hi dave,
gui testing is always a good idea :-) but in this case the behaviour is different:
your observation is correct (anyway at least a strange behaviour compared to any xml editing tool i know == how adobe intended to insert an empty element?), tagging in the gui a tagged insertion point tags the whole story.
in the script a new element is added but the return value is the parent element (the xmlElement of the whole story).
this causes a problem when i add an attribute (the intention of the above script is to add references) which is added to the parent element.
gregor -
Issue with working on a webservice that has xml elements with attributes
This is a branchout of Thread: Some more complex sample of invokin WS needed_
We are working on a project that involves a outbound SALT Web service call that includes complex elements with attributes..We are looking for options of how to use FML API's to pass these attribute values from the application code.
We opened a ticket with oracle where we were suggested to frame the entire xml and pass the xml using the FML32 of the complex element. But when we framed the xml for Service and put the entire XML which includes the attributes using the FML ID of Service.
Please find a sample Schema and XML similar to the one we are working on...its associated code
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Service" type="Service_Type" nillable="true">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="Service_Type">
<xs:sequence>
<xs:element name="DateTime" type="xs:dateTime" nillable="true">
</xs:element>
<xs:element name="UUID" nillable="true">
</xs:element>
<xs:element name="Status" type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
<xs:attribute name="Version" type="xs:string" use="required">
</xs:attribute>
<xs:attribute name="Name" type="xs:string" use="required">
</xs:attribute>
</xs:complexType>
</xs:schema>
The sample XML is :
___<?xml version="1.0" encoding="UTF-8"?>___
___<!--Sample XML file generated by XMLSpy v2010 rel. 2 (http://www.altova.com)-->___
___<Service Name="TestService" Version="1.1" xsi:noNamespaceSchemaLocation="Untitled6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">___
___ <DateTime>2001-12-17T09:30:47Z</DateTime>___
___ <UUID>text</UUID>___
___</Service>___
wsdlcvt generated the mif file with Service as a FML32 type and all its child elements as "mbstring". We tried to leave as it is and we also tried to replace all the child elements and just had a mif entry for "Service" as a mbstring neither produced a different output...Tried to dump using Ferror32 which did not dump any..._
The sample C/C++ code as per suggestions were to do the following...
_1) Have a string with the entire XML for Service_
xmldata="<Service Name=\"TestService"\ Version="1.1\"_ xsi:noNamespaceSchemaLocation=\"Untitled6.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">_
_ <DateTime>2001-12-17T09:30:47Z</DateTime>_
_ <UUID>text</UUID>_
_</Service>";_
_2) Use Fmbpack32 to create a mbstring data_
_memcpy(reqmbptr, (char*)xmldata.data(),xmldata.length());_
_len=xmldata.length();_
_Fmbpack32(mbcodeName,reqmbptr,len, packdata,(FLDLEN32 *)&packedlen,0);_
userlog("Size of packedlen is %d",packedlen);
3) Add the packed data to the output buffer
Fadd32(fmlbuffer,Service, packdata,packedlen );
But we do not see the Service tag populated in the GWWS outbound request.Everything else makes it....any help on how to move ahead would be appreciated...It seems you switch to the 10gR3 GA and now the whole XML data is mapped to FLD_MBSTRING.
I will forward my sample to you by mail, but this sample is not offical sample, it is just QA test case. You can refere it and check what's the difference.
Please let me know your mail address.
Regards,
Xu he -
Delete any level xml element or attribute
Hi,
In Design CS2, How can i delete or untag all the id attributes from the entire xml and any level with javascript.
Is it possible ?
Thanks with Regards
Pramod PantIt just needs a little recursion. I wrote this
removeTags (app.activeDocument);
function removeTags (startAt)
for (var i=startAt.xmlElements.length-1; i>=0; i--)
if (startAt.xmlElements[i].xmlElements.length > 0)
removeTags (startAt.xmlElements[i]);
startAt.xmlElements[i].untag();
in 2 minutes, found out that untag() already untags everything
i including
its sub-elements, then re-read your post. Ah ... just the attributes... Oh well. How about this:
removeTags (app.activeDocument);
function removeTags (startAt)
for (var i=startAt.xmlElements.length-1; i>=0; i--)
if (startAt.xmlElements[i].xmlAttributes.length > 0)
startAt.xmlElements[i].xmlAttributes.everyItem().remove();
removeTags (startAt.xmlElements[i]); -
I am trying to add a new element to an xml file, I has 5
existing, so I am trying to add the sixth. but got an error
message, anyone could help me on this?
Thanks,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The index of a child element is out of range.
There are only "5" children under this node.
Therefore index "6" is out of the allowed range [1-5].
The error occurred in
C:\CFusionMX7\wwwroot\myfolder\addNew.cfm: line 18
16 : newNodePos =
arrayLen(variables.xml.machii.listeners.listener) + 1;
17 : // add new node then set it's attributes
18 :
variables.xml.machii.listeners.listener[variables.newNodePos]=
XMLElemNew(variables.xml,"listener");
19 :
structInsert(variables.xml.machii.listeners.listener[variables.newNodePos].XmlAttributes, "name","#form.listenerName#",1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
here the code:
<cfscript>
// get array position of next XML child to add
newNodePos =
arrayLen(variables.xml.machii.listeners.listener) + 1;
// add new node then set it's attributes
variables.xml.machii.listeners.listener[variables.newNodePos]=
XMLElemNew(variables.xml,"listener");
structInsert(variables.xml.machii.listeners.listener[variables.newNodePos].XmlAttributes, "name","#form.listenerName#",1);
</cfscript>Did it help? I am using the new jwsdp 1.2 and have a jaxrpc-ri.xml
like this;
<webServices>
<endpoint name="EP1"/>
<endpoint name="EP2"/>
<endpointMapping
endpointName="SyndicationServerEP2"
urlPattern="/ep1/*"/>
<endpointMapping
endpointName="EP2"
urlPattern="/ep2/*"/>
</webServices>But after running wsdeploy, in the resulting web.xml only EP2
is mentioned!
Any hints?
Hans -
OC4J orion-application.xml - elements and attributes
Hi. i read in oracle docs sentense like this: "Each property maps to an element attribute in the orion-application.xml descriptor." These properties are from deployment plan and i need to know what is the name of the element in orion-application.xml wich is mapped to webSiteBinding property (from deployment plan).
I just did a quick test of this, and it seems to work for me.
I used the following XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<Employees xmlns="
http://www.foo.com/Employees">
<Employee Id="001">
<LastName>Davis</LastName>
<FirstName>Kirk</FirstName>
</Employee>
<Employee Id="002">
<LastName></LastName>
<FirstName>James</FirstName>
</Employee>
<Employee Id="003">
<FirstName>Anthony</FirstName>
</Employee>
<Employee>
</Employee>
</Employees>
With the XPath "/Employees/Employee" I got rows in the data
set and things displayed fine in my page. Changing it to
"/employees/employee" caused the data set to have no rows which I
would expect since things should be case sensitive.
Can you provide me with some sample XML and XPath that
doesn't work?
Thanks!
--== Kin ==-- -
Is it possible to have the XML structure (tags and attributes) be made visible and formatted in the layout? Such a hard-copy reference of the layout (a print and online Drupal publication) would make the XML visible to those persons writing/editing content but who are not using InDesign or XML viewing/editing programs. And this would improve workflow considerably. TIA
Its the nextSibling of nxBook or, you may want to do it via
an array:
var xRootNode:XMLNode =xmlData.firstChild ;
var xnBooks:XMLNode =xRootNode.childNodes;
for (var j=0;j<xnBooks.length;j++) {
var attrib:Object =xnBooks[j].attributes
for (var sattrib:String in attrib ) {
trace(attrib[sattrib]+ " " + sattrib); -
Imported XSLT cannot create attributes for generated XML element
I have two xslts. One imports the other.
The imported xslt creates XML elements with attributes and this XML is stored in a variable in the main stylesheet
If I perform the transformation with JRE prior to 1.6.0.18 then all works fine
If I use 1.6.0.18 or 1.6.0.19 then the attributes aren't added.
If I add attributes in the main xslt it works fine or if I output the element directly instead of first storing it in a variable then it also works fine.
Problem seems to be when you try to add attributes from an imported stylesheet and store the generated element in a variable.
Below two stylesheets to illustrate :
First MainStylesheet.xsl
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 1993-2005 Seagull Software Systems, Inc. -->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
exclude-result-prefixes="xs">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" />
<xsl:import href="innerstylesheet.xsl"/>
<xsl:template match="/TestData">
<xsl:variable name="generatedElementXml">
<xsl:call-template name="generateElement">
<xsl:with-param name="s">testValue</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="exsl:node-set($generatedElementXml)">
*** GeneratedElementXML {<xsl:text>
</xsl:text><xsl:copy-of select="*"></xsl:copy-of>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>Next innerstylesheet.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exsl="http://exslt.org/common"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
extension-element-prefixes="exsl" >
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template name="generateElement">
<xsl:param name="s"/>
<TestElement testAttribute="$s" />
</xsl:template>
</xsl:stylesheet>The result output by jres before 1.6.0.18 is :
<?xml version="1.0" encoding="UTF-8"?>
*** GeneratedElementXML {
<TestElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" testAttribute="testValue"/>
} The result output by jres since 1.6.0.18 is :
<?xml version="1.0" encoding="UTF-8"?>
*** GeneratedElementXML {
<TestElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
} Note : the 'testAttribute' attribute is missingHave found the difference in the code
In both JRE1.6.0_17 & JRE1.6.0_18, the class 'com.sun.org.apache.xalan.internal.xsltc.dom.AdaptiveResultTreeImpl' has the following method
public void addUniqueAttribute(String qName, String value, int flags)
throws SAXException
addAttribute(qName, value);
}In JRE1.6.0_17 the next method is
public void addAttribute(String name, String value)
if (_openElementName != null) {
_attributes.add(name, value);
else {
BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, name);
}In JRE1.6.0_18 the next method is
public void addAttribute(String uri, String localName, String qname,
String type, String value)
if (_openElementName != null) {
_attributes.addAttribute(uri, localName, qname, type, value);
else {
BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, qname);
}Note - the addAttribute method has additional parameters in JRE1.6.0_18 but the call from addUniqueAttribute wasn't updated.
So in JRE1.6.0_18 addUniqueAttribute actually invokes the following method in the base package com.sun.org.apache.xml.internal.serializer.EmptySerializer
public void addAttribute(String name, String value)
aMethodIsCalled();
void aMethodIsCalled()
// throw new RuntimeException(err);
return;
}and as you can see this does nothing. Hence the fact that the attribute isn't added. -
Preserve whitespace in XML element value
I am trying to add XML element with value prefix with white space:
ex_doc->create_simple_element(
name = 'VALUEPART1'
value = ' BQ/XWKB-99-5-9999-2'
parent = lo_ele_e1bpparex_bape_vbak ).
But when the XML is create, the white space is removed! How can I preserve the white space???
<VALUEPART1>BQ/XWKB-99-5-9999-2</VALUEPART1>
What i want is:
<VALUEPART1> BQ/XWKB-99-5-9999-2</VALUEPART1>
Appreciate for any helpHi,
if you had been using XSLT instead, I would have said 'remove the strip-space element or alter it according to your needs'...
Please provide what class you are using, else it's too generic..
regards, Lukas -
How to access XML elements by name in Extendscript??
I'm almost done the script that I've been working on, but something has been nagging me since I started. When I did start, I looked at the JS Tools Guide CS5 that comes with the extendscript ide to check how to access XML elements, children, attributes etc. It says this:
The XML object represents an XML element node in an XML tree. The topmost XML object for an XML file
represents the root node. It acts as a list, which contains additional XML objects for each element. These in
turn contain XML objects for their own member elements, and so on.
The child elements of an element tree are available as properties of the XML object for the parent. The
name of the property corresponds to the name of the element. Each property contains an array of XML
objects, each of which represents one element of the named type.
So basically it converts the XML into JSON. And you can access the properties like so:
<book category="COOKING">
<title lang="en">The Boston Cooking-School Cookbook</title>
<author>Fannie Merrit Farmer</author>
<year>1896</year>
<price>49.99</price>
</book>
The Javascript statement bookstoreXML.book; returns the entire list of books.
The statement bookstoreXML.book[0]; returns the XML object for the first book.
The statement bookstoreXML.book[0].author; returns all authors of the first book.
A couple pages down it talks about Retrieving contained elements using children(), elements(), descendants().
So now I look through the XML Object properties and I see that I can use:
xmlObj.child (which) which A String, the element name, or a Number, a 0-based index into this node’s child array.
or
xmlObj.descendants ([name])
name Optional. A String, the element name to match. If not provided, matches all
elements.
or
xmlObj.elements (name);
name Optional. A String, the element name to match. If not provided, matches all
elements.
This is an excerpt of an XML I was working with:
<ROW xmlns="http://www.filemaker.com/fmpdsoresult"
MODID="16"
RECORDID="11128">
<Sign_Type>251.dr</Sign_Type>
<fm:Location xmlns:fm="http://www.filemaker.com/fmpdsoresult" xmlns="">5-5024</fm:Location>
<Line1>Zone
Floor
3
Patient Rooms
R532 - R436 even
Patient Rooms
R522 - R446 even
Xavier Elevators
Zone
Patient Rooms
R537 - 5757 odd
Main Elevators
Zone</Line1>
</ROW>
Extendscript will not give me an anything when I try to access elements by name. Instead I have to access by index, which works, but I'd rather search for names!
Actually the console log returns: <![CDATA[]]>
What am I doing wrong!?First, those E4X XML objects are definitely no JSON (plain data) - they have a multitude of methods, even for tasks that would easily be implemented as property (e.g. the length() function), and they also bind xml element and attribute names onto the objects, allowing to target a multitude of XML nodes with a single statement. Or did you mean your script with that "it"?
Anyway, as you found out the ExtendScript XML object handles namespaces mostly by hiding them from you.
You could play around with global namespace settings, see the JavaScript tools guide.
You could also explicitly specify a namespace. This works for me:
$.writeln(myXML["fm:Location"]);
For simple use I had most success with a brute force approach that just strips the namespaces.
function removeAllNamespace(xml)
var ns =new Namespace();
var d=xml.descendants();
for (var i=0;i<d.length();i++)
d[i].setNamespace(ns); -
I need to find all XML elements and add a line break to the text of each of them
I need to find all XML elements and add a line break to the text of each of them.
Is this possible with a script?I need to go from this ...
to this...
but looking for the XML elements (not paragraphs) and then adding text ...
Thanks for your attention !!! -
I am new in indesign scripting, please tell me how to write a script to get content of a element in xml and then sort all the content
Hi,
May the below code is useful for you, but I dont know how to sort.
Edit the tag as per your job request.
alert(app.activeDocument.xmlElements[0].contents)
//Second alert
var xe = app.activeDocument.xmlElements[0].evaluateXPathExpression("//marginalnote");
alert(xe.length)
for(i=0; i<xe.length; i++)
alert(xe[i].texts[0].contents)
Regards
Siraj -
XML file too large or XML element too large
I am attempting to import an xml file into the repository and have it shred into the object-relational tables. I registered a schema and it created object-relational xml_tables, triggers, and types. The full xml file is > 80MB. XDB created all the fields as VARCHAR2(4000).
error code when importing the full XML file. This is what I need to ultimately fix.
DECLARE
res BOOLEAN;
BEGIN
res := DBMS_XDB.createResource('/home/pharma/drugbank.xml',
bfilename('XMLPHARMA', 'drugbank.xml'),
nls_charset_id('AL32UTF8'));
END;
COMMIT;
XML file encounters errors on the import.
An error was encountered performing the requested operation
ORA-30951: Element or attribute at Xpath references exceeds maximum length
ORA-06512 at "XDB.DBMS_XDB", line 315
ORA-06512 at line 4
30951.00000 - "Element or attribute at Xpath %x exceeds maximum length"
*Cause: An attempt was made to insert a node of length exceeding the maximum length (specified by the maxLength facet) into an XML document.
*Action: Do not attempt to add a node exceeding the maximum length to XML documents.
Vendor code 30951Error at Line:18I would guess that some of the fields have max lengths > 4000. I plan to annotate the schema with SQLType="CLOB", but need to know which fields to change. I was able to copy the xml file and reduce that xml file to one record, which imported into the tables. My plan was to write a view over the bfile to get the lengths of certain fields, annotate the .xsd with CLOBS where needed, and then import again. In order to do that, I have a 1 record file imported into a table and as a bfile.
Here is my code selecting length from a generated object-relational table of only one record.
CREATE OR REPLACE VIEW pharma.drugs_vw AS
SELECT d.*
FROM drugs, XMLTABLE
('/drugs' PASSING OBJECT_VALUE COLUMNS
drugbank_id VARCHAR2(20) PATH 'drug/drugbank-id',
name VARCHAR2(50) PATH 'drug/name',
description VARCHAR2(4000) PATH 'drug/description'
) d
select max(length(drugbank_id)) as dbidlen,
max(length(name)) as nmlen,
max(length(description)) as desclen
from drugs_vw;
DBIDLEN NMLEN DESCLEN
7 9 229
1 row selected.Here is the code for the bfile. Same results, but using deprecated functions. I read the whitepaper, Oracle XML DB: Best practices to get optimal performance out of XML Queries. It says that extract(), extractvalue(), Table(XMLSequence()), and XMLType() are deprecated in 11gr2.
-- Note extractvalue is deprecated in 11gr2 replaced by W3C standard
-- XMLCast(XMLQuery())
-- TABLE(XMLSequence) is replaced by XMLTable
-- XMLType() is replaced by XMLParse()
SELECT max(length(extractvalue(column_value, '/drug/drugbank-id'))) dbidlen,
max(length(extractvalue(column_value, '/drug/name'))) nmlen,
max(length(extractvalue(column_value, '/drug/description'))) desclen
FROM TABLE(XMLSequence(XMLTYPE(bfilename('XMLPHARMA',
'db00001.xml'),nls_charset_id('AL32UTF8')).extract('/drugs/drug'))) d
WHERE ROWNUM <= 5;
DBIDLEN NMLEN DESCLEN
7 9 229Is this better code for getting the maximum length of xml fields from a bfile? Here is what I have so far. This works on a single drugbank-id.
SELECT max(length(drugbank_id)) AS dbidlen,
max(length(name)) AS nmlen,
max(length(description)) AS desclen
FROM (XMLTABLE('*'
PASSING (XMLType(bfilename('XMLPHARMA', 'db00001.xml'),nls_charset_id('AL32UTF8')))
COLUMNS
drugbank_id VARCHAR2(20) PATH 'drug/drugbank-id',
name VARCHAR2(50) PATH 'drug/name',
description VARCHAR2(4000) PATH 'drug/description'
);I try to run it on the full file and get this error
Error report:
SQL Error: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00007: unexpected end-of-file encountered
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.The code to create schema and object-relational tables. This worked fine.
set serveroutput on
-- Create resource file for schema
DECLARE
res BOOLEAN;
BEGIN
res := DBMS_XDB.createResource('/home/pharma/drugbank.xsd',
bfilename('XMLPHARMA', 'drugbank.xsd'),
nls_charset_id('AL32UTF8'));
COMMIT;
END;
-- optional debugging of create types and tables if you want a trace
ALTER SESSION SET EVENTS = '31098 TRACE NAME CONTEXT FOREVER';
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://localhost:8080/home/pharma/drugbank.xsd',
SCHEMADOC => bfilename('XMLPHARMA', 'drugbank.xsd'),
CSID => nls_charset_id('AL32UTF8'),
LOCAL => TRUE,
GENTYPES => TRUE,
GENTABLES => TRUE,
OWNER => 'PHARMA');
COMMIT;
END;
SQL> select * from v$version;
BANNER
Oracle Database 11g Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - ProductionThe xml schema follows. Sorry about the length, but I think I might break something if I snipped it.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
>
<!-- General type definitions -->
<xs:simpleType name="DecimalOrEmptyType">
<xs:union memberTypes="xs:decimal EmptyStringType"/>
</xs:simpleType>
<xs:simpleType name="EmptyStringType">
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
<!-- Element Definitions -->
<!-- Drug secondary accession number definition begins -->
<xs:element name="secondary-accession-numbers" xdb:defaultTable="SECONDARY_ACCESSION_NUMBERS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="secondary-accession-number" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug secondary accession number definition ends -->
<!-- Drug groups definition begins -->
<xs:element name="groups" xdb:defaultTable="GROUPS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="group">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="approved"/>
<xs:enumeration value="illicit"/>
<xs:enumeration value="experimental"/>
<xs:enumeration value="withdrawn"/>
<xs:enumeration value="nutraceutical"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug groups definition ends -->
<!-- Drug taxonomy definition begins -->
<xs:element name="substructure">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="class" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="substructures" xdb:defaultTable="SUBSTRUCTURES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="substructure"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="taxonomy" xdb:defaultTable="TAXONOMY">
<xs:complexType>
<xs:sequence>
<xs:element name="kingdom" type="xs:string"/>
<xs:element ref="substructures"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug taxonomy definition ends -->
<!-- Drug brands definition begins -->
<xs:element name="brands" xdb:defaultTable="BRANDS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="brand" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug brands definition ends -->
<!-- Drug mixtures definition begins -->
<xs:element name="mixture">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="ingredients" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mixtures" xdb:defaultTable="MIXTURES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="mixture"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug mixtures definition ends -->
<!-- Drug packagers definition begins -->
<xs:element name="packager">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="url" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="packagers" xdb:defaultTable="PACKAGERS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="packager"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug packagers definition ends -->
<!-- Drug manufacturers definition begins -->
<xs:element name="manufacturer">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="generic" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="manufacturers" xdb:defaultTable="MANUFACTURERS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="manufacturer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug manufactures definition ends -->
<!-- Drug pricing definition begins -->
<xs:element name="cost">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="currency" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="price">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string"/>
<xs:element ref="cost"/>
<xs:element name="unit" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="prices" xdb:defaultTable="PRICES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="price"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug pricing definition ends -->
<!-- Drug categories definition begins -->
<xs:element name="categories" xdb:defaultTable="CATEGORIES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="category" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug categories definition ends -->
<!-- Drug affected orgainsms definition begins -->
<xs:element name="affected-organisms" xdb:defaultTable="AFFECTED_ORGANISMS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="affected-organism" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug affected organisms definition ends -->
<!-- Drug dosage definition begins -->
<xs:element name="dosage">
<xs:complexType>
<xs:sequence>
<xs:element name="form" type="xs:string"/>
<xs:element name="route" type="xs:string"/>
<xs:element name="strength" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="dosages" xdb:defaultTable="DOSAGES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="dosage"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug dosages definition ends -->
<!-- Drug ATC codes definition begins -->
<xs:element name="atc-codes" xdb:defaultTable="ATC_CODES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="atc-code" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug ATC codes definition ends -->
<!-- Drug AHFS codes definition begins -->
<xs:element name="ahfs-codes" xdb:defaultTable="AHFS_CODES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="ahfs-code" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug AHFS codes definition ends -->
<!-- Drug Patent definition begins -->
<xs:element name="patent">
<xs:complexType>
<xs:sequence>
<xs:element name="number" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
<xs:element name="approved" type="xs:string"/>
<xs:element name="expires" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="patents" xdb:defaultTable="PATENTS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="patent"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug patent definition ends -->
<!-- Drug food interactions definition begins -->
<xs:element name="food-interactions" xdb:defaultTable="FOOD_INTERACTIONS">
<xs:complexType>
<xs:sequence>
<xs:element name="food-interaction" type="xs:string" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug food interactions definition ends -->
<!-- Drug drug interactions definition begins -->
<xs:element name="drug-interaction">
<xs:complexType>
<xs:sequence>
<xs:element name="drug" type="xs:integer"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="drug-interactions" xdb:defaultTable="DRUG_INTERACTIONS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="drug-interaction"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug drug interactions definition ends -->
<!-- Drug protein sequences (biotech) definition begins -->
<xs:element name="protein-sequences" xdb:defaultTable="PROTEIN_SEQUENCES">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="protein-sequence" type="SequenceType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug protein sequences (biotech) definition ends-->
<!-- Drug external links definition begins -->
<xs:element name="external-link">
<xs:complexType>
<xs:sequence>
<xs:element name="resource" type="xs:string"/>
<xs:element name="url" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="external-links" xdb:defaultTable="EXTERNAL_LINKS">
<xs:complexType>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element ref="external-link"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug external links definition ends -->
<!-- Drug targets definition begins -->
<xs:element name="targets" xdb:defaultTable="TARGETS">
<xs:complexType>
<xs:sequence>
<xs:element name="target" type="TargetBondType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug targets definition ends -->
<!-- Drug enzymes definition begins -->
<xs:element name="enzymes" xdb:defaultTable="ENZYMES">
<xs:complexType>
<xs:sequence>
<xs:element name="enzyme" type="BondType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug enzmes definition ends -->
<!-- Drug transporters definition begins -->
<xs:element name="transporters" xdb:defaultTable="TRANSPORTERS">
<xs:complexType>
<xs:sequence>
<xs:element name="transporter" type="BondType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug transporters definition ends -->
<!-- Drug carriers definition begins -->
<xs:element name="carriers" xdb:defaultTable="CARRIERS">
<xs:complexType>
<xs:sequence>
<xs:element name="carrier" type="BondType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Drug carriers definition ends -->
<!-- Partner Pfams definition begins -->
<xs:element name="pfam">
<xs:complexType>
<xs:sequence>
<xs:element name="identifier" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pfams" xdb:defaultTable="PFAMS">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="pfam"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Partner Pfams definition end -->
<!-- Partner GO Classification definition begins -->
<xs:element name="go-classifier">
<xs:complexType>
<xs:sequence>
<xs:element name="category" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="go-classifiers" xdb:defaultTable="GO_CLASSIFIERS">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="go-classifier"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Partner GO Classification definition ends -->
<!-- Partner Essentiality definition begins -->
<xs:element name="essentiality">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Essential"/>
<xs:enumeration value="Non-Essential"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Partner Essentiality definition ends -->
<!-- Complex Type Definitions -->
<xs:complexType name="SequenceType">
<xs:sequence>
<xs:element name="header" type="xs:string"/>
<xs:element name="chain" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PropertyType">
<xs:sequence>
<xs:element name="kind">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="logP"/>
<xs:enumeration value="logS"/>
<xs:enumeration value="logP/hydrophobicity"/>
<xs:enumeration value="Water Solubility"/>
<xs:enumeration value="caco2 Permeability"/>
<xs:enumeration value="pKa"/>
<xs:enumeration value="IUPAC Name"/>
<xs:enumeration value="Molecular Weight"/>
<xs:enumeration value="Monoisotopic Weight"/>
<xs:enumeration value="SMILES"/>
<xs:enumeration value="Molecular Formula"/>
<xs:enumeration value="InChI"/>
<xs:enumeration value="InChIKey"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="value" type="xs:string"/>
<xs:element name="source">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="JChem"/>
<xs:enumeration value="ALOGPS"/>
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PropertiesType">
<xs:sequence>
<xs:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SynonymsType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="synonym" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="IdentifiersType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="external-identifier">
<xs:complexType>
<xs:sequence>
<xs:element name="resource" type="xs:string"/>
<xs:element name="identifier" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="BondActionsType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:element name="action" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="BondType">
<xs:sequence>
<xs:element name="actions" type="BondActionsType"/>
<xs:element name="references" type="xs:string"/>
</xs:sequence>
<xs:attribute name="position" type="xs:integer" use="optional"/>
<xs:attribute name="partner" type="xs:integer"/>
</xs:complexType>
<xs:complexType name="TargetBondType">
<xs:complexContent>
<xs:extension base="BondType">
<xs:sequence>
<xs:element name="known-action">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="yes"/>
<xs:enumeration value="no"/>
<xs:enumeration value="unknown"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PartnerType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="general-function" type="xs:string"/>
<xs:element name="specific-function" type="xs:string"/>
<xs:element name="gene-name" type="xs:string"/>
<xs:element name="locus" type="xs:string"/>
<xs:element name="reaction" type="xs:string"/>
<xs:element name="signals" type="xs:string"/>
<xs:element name="cellular-location" type="xs:string"/>
<xs:element name="transmembrane-regions" type="xs:string"/>
<xs:element name="theoretical-pi" type="DecimalOrEmptyType"/>
<xs:element name="molecular-weight" type="DecimalOrEmptyType"/>
<xs:element name="chromosome" type="xs:string"/>
<xs:element ref="essentiality"/>
<xs:element name="references" type="xs:string"/>
<xs:element name="external-identifiers" type="IdentifiersType"/>
<xs:element name="synonyms" type="SynonymsType"/>
<xs:element name="protein-sequence" type="SequenceType" minOccurs="0"/>
<xs:element name="gene-sequence" type="SequenceType" minOccurs="0"/>
<xs:element ref="pfams"/>
<xs:element ref="go-classifiers"/>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required"/>
</xs:complexType>
<xs:complexType name="DrugType">
<xs:sequence>
<xs:element name="drugbank-id" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="cas-number" type="xs:string"/>
<xs:element name="general-references" type="xs:string"/>
<xs:element name="synthesis-reference" type="xs:string"/>
<xs:element name="indication" type="xs:string"/>
<xs:element name="pharmacology" type="xs:string"/>
<xs:element name="mechanism-of-action" type="xs:string"/>
<xs:element name="toxicity" type="xs:string"/>
<xs:element name="biotransformation" type="xs:string"/>
<xs:element name="absorption" type="xs:string"/>
<xs:element name="half-life" type="xs:string"/>
<xs:element name="protein-binding" type="xs:string"/>
<xs:element name="route-of-elimination" type="xs:string"/>
<xs:element name="volume-of-distribution" type="xs:string"/>
<xs:element name="clearance" type="xs:string"/>
<xs:element ref="secondary-accession-numbers"/>
<xs:element ref="groups"/>
<xs:element ref="taxonomy"/>
<xs:element name="synonyms" type="SynonymsType"/>
<xs:element ref="brands"/>
<xs:element ref="mixtures"/>
<xs:element ref="packagers"/>
<xs:element ref="manufacturers"/>
<xs:element ref="prices"/>
<xs:element ref="categories"/>
<xs:element ref="affected-organisms"/>
<xs:element ref="dosages"/>
<xs:element ref="atc-codes"/>
<xs:element ref="ahfs-codes"/>
<xs:element ref="patents"/>
<xs:element ref="food-interactions"/>
<xs:element ref="drug-interactions"/>
<xs:element ref="protein-sequences" minOccurs="0"/><!-- Only present for biotech drugs -->
<xs:element name="calculated-properties" type="PropertiesType" minOccurs="0"/><!-- Only present for small molecule drugs -->
<xs:element name="experimental-properties" type="PropertiesType"/>
<xs:element name="external-identifiers" type="IdentifiersType"/>
<xs:element ref="external-links"/>
<xs:element ref="targets"/>
<xs:element ref="enzymes"/>
<xs:element ref="transporters"/>
<xs:element ref="carriers"/>
</xs:sequence>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="small molecule"/>
<xs:enumeration value="biotech"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="updated" type="xs:string" use="required"/>
<xs:attribute name="created" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:decimal" use="required"/>
</xs:complexType>
<xs:element name="drugs" xdb:defaultTable="DRUGS">
<xs:complexType>
<xs:sequence>
<xs:element name="drug" type="DrugType" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="partners">
<xs:complexType>
<xs:sequence>
<xs:element name="partner" type="PartnerType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:keyref name="targetPartnerIdKeyRef" refer="partnerIdKey">
<xs:selector xpath="drug/targets/*"/>
<xs:field xpath="@partner"/>
</xs:keyref>
<xs:keyref name="enzymePartnerIdKeyRef" refer="partnerIdKey">
<xs:selector xpath="drug/enzymes/*"/>
<xs:field xpath="@partner"/>
</xs:keyref>
<xs:keyref name="transporterPartnerIdKeyRef" refer="partnerIdKey">
<xs:selector xpath="drug/transporters/*"/>
<xs:field xpath="@partner"/>
</xs:keyref>
<xs:keyref name="carrierPartnerIdKeyRef" refer="partnerIdKey">
<xs:selector xpath="drug/carriers/*"/>
<xs:field xpath="@partner"/>
</xs:keyref>
<xs:key name="partnerIdKey">
<xs:selector xpath=".//partner"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
</xs:schema>Query optimizing whitepaper
http://www.oracle.com/technetwork/database/features/xmldb/xmlqueryoptimize11gr2-168036.pdfI attempted to insert the xml file into an xml table and into a relational table with an xml column both based on the schema. I get the same errors.
-This creates an XML table based on the schema successfully
CREATE TABLE pharma.drugs_xmltype OF XMLTYPE
XMLSCHEMA "http://localhost:8080/home/pharma/drugbank.xsd"
ELEMENT "drugs";
Table created.
Elapsed: 00:00:02.67
SQL>desc pharma.drugs_xmltype
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/home/pharma/drugbank.xsd" Element "drugs") STORAGE Object-relational TYPE "drugs1200_T"-- it refers to these types
create or replace TYPE "drugs1200_T" AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T","drug" "drug1201_COLL","partners" "partners1202_T")FINAL INSTANTIABLE
create or replace TYPE "drug1201_COLL" AS VARRAY(2147483647) OF "DrugType1121_T"
create or replace TYPE "partners1202_T" AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T","partner" "partner1203_COLL")FINAL INSTANTIABLE
create or replace TYPE "partner1203_COLL" AS VARRAY(2147483647) OF "PartnerType1190_T"
create or replace TYPE "DrugType1121_T" AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T","type" "XDB"."XDB$ENUM_T","updated" VARCHAR2(4000 CHAR),"created" VARCHAR2(4000 CHAR),"version" NUMBER,"drugbank-id" VARCHAR2(4000 CHAR),"name" VARCHAR2(4000 CHAR),"description" VARCHAR2(4000 CHAR),"cas-number" VARCHAR2(4000 CHAR),"general-references" VARCHAR2(4000 CHAR),"synthesis-reference" VARCHAR2(4000 CHAR),"indication" VARCHAR2(4000 CHAR),"pharmacology" VARCHAR2(4000 CHAR),"mechanism-of-action" VARCHAR2(4000 CHAR),"toxicity" VARCHAR2(4000 CHAR),"biotransformation" VARCHAR2(4000 CHAR),"absorption" VARCHAR2(4000 CHAR),"half-life" VARCHAR2(4000 CHAR),"protein-binding" VARCHAR2(4000 CHAR),"route-of-elimination" VARCHAR2(4000 CHAR),"volume-of-distribution" VARCHAR2(4000 CHAR),"clearance" VARCHAR2(4000 CHAR),"secondary-accession-numbers" "secondary-accession1122_T","groups" "groups1124_T","taxonomy" "taxonomy1126_T","synonyms" "SynonymsType1131_T","brands" "brands1132_T","mixtures" "mixtures1133_T","packagers" "packagers1137_T","manufacturers" "manufacturers1141_T","prices" "prices1145_T","categories" "categories1151_T","affected-organisms" "affected-organisms1152_T","dosages" "dosages1153_T","atc-codes" "atc-codes1157_T","ahfs-codes" "ahfs-codes1158_T","patents" "patents1159_T","food-interactions" "food-interactions1163_T","drug-interactions" "drug-interactions1164_T","protein-sequences" "protein-sequences1168_T","calculated-properties" "PropertiesType1171_T","experimental-properties" "PropertiesType1171_T","external-identifiers" "IdentifiersType1174_T","external-links" "external-links1177_T","targets" "targets1181_T","enzymes" "enzymes1186_T","transporters" "transporters1188_T","carriers" "carriers1189_T")NOT FINAL INSTANTIABLE -- drugs type
PHARMA@scidev> desc "drugs1200_T"
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
drug drug1201_COLL
partners partners1202_T-- I planned to insert using a subselect and got the same error on the select.
Error starting at line 1 in command:
SELECT max(length(drugbank_id)) AS dbidlen
FROM (XMLTABLE('*'
PASSING (XMLType(bfilename('XMLPHARMA', 'drugbank.xml'),nls_charset_id('AL32UTF8')))
COLUMNS
drugbank_id VARCHAR2(20) PATH 'drug/drugbank-id'
Error report:
SQL Error: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00007: unexpected end-of-file encountered
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.--This creates a row in the xmltype table from a single drug file.
INSERT INTO drugs_xmltype
VALUES(XMLType(bfilename('XMLPHARMA', 'db00001.xml'),nls_charset_id('AL32UTF8')).CreateSchemaBasedXML(
'http://localhost:8080/home/pharma/drugbank.xsd'))
;-- The create using the full xml file fails.
INSERT INTO drugs_xmltype
VALUES(XMLType(bfilename('XMLPHARMA', 'drugbank.xml'),nls_charset_id('AL32UTF8')).CreateSchemaBasedXML(
'http://localhost:8080/home/pharma/drugbank.xsd'))
VALUES(XMLType(bfilename('XMLPHARMA', 'drugbank.xml'),nls_charset_id('AL32UTF8')).CreateSchemaBasedXML(
ERROR at line 2:
ORA-30951: Element or attribute at Xpath references exceeds maximum length
Elapsed: 00:01:17.90-- Then I tried the same using a relational table with an xml column
-- Then I created a relational table with an xml column
CREATE TABLE pharma.drugs_xmlcolumn_type (drug_xml XMLTYPE)
XMLTYPE COLUMN drug_xml STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://localhost:8080/home/pharma/drugbank.xsd"
ELEMENT "drugs";
CREATE TABLE succeeded.--This command refers to the following types
SYS.XMLTYPE(XMLSchema "http://localhost:8080/home/pharma/drugbank.xsd" Element "drugs" ) STORAGE Object-relational TYPE "drugs1200_T"-- This creates a row in the xmlcolumn table from a single drug file.
INSERT INTO drugs_xmlcolumn_type
VALUES(XMLType(bfilename('XMLPHARMA', 'db00001.xml'),nls_charset_id('AL32UTF8')).CreateSchemaBasedXML(
'http://localhost:8080/home/pharma/drugbank.xsd'))
;--The create using the full xml file into a relational table with an xml column fails
INSERT INTO drugs_xmlcolumn_type
VALUES(XMLType(bfilename('XMLPHARMA', 'drugbank.xml'),nls_charset_id('AL32UTF8')).CreateSchemaBasedXML(
'http://localhost:8080/home/pharma/drugbank.xsd'))
VALUES(XMLType(bfilename('XMLPHARMA', 'drugbank.xml'),nls_charset_id('AL32UTF8')).CreateSchemaBasedXML(
ERROR at line 2:
ORA-30951: Element or attribute at Xpath references exceeds maximum length
Elapsed: 00:01:06.74 -
How to handle abstract XML elements with XMLBeans
Hello,
I have an xsd that uses abstract elements, and i wanted to ask you how can i create new XML Documents with XMLBeans? My problems is that i don't know how to handle abstaction with XMLBeans.
Let me show you a very simple example to make you understand my problem :
Suppose we have the following schema :
<xsd:schema targetNamespace="http://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org">
<xsd:element name="Customer" type="CustomerType" />
<xsd:complexType name="CustomerType" abstract="true" />
<xsd:complexType name="PremiumCustomerType">
<xsd:complexContent>
<xsd:extension base="CustomerType">
<xsd:sequence>
<xsd:element name="CreditCard" type="xsd:string" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>I use XMLBeans to create a jar with java classes according the xsd above. Then, in order to create a new xml document i use the following code :
CustomerDocument cd = CustomerDocument.Factory.newInstance();
CustomerType ct = cd.addNewCustomer();
PremiumCustomerType pct = PremiumCustomerType.Factory.newInstance();
ct.changeType(pct.schemaType());With this code i get an XML Document like the following :
<Customer type="PremiumCustomerType" />But after that, i cannot add an element CreditCard into this Customer element. Can anyone help me?In Indesign there is no way you can directly work on the XML-IN footnote, since indesign won't support XML tags in footnote stream.
To achive that you need to have XSLT/Perl/Indesign Scripting.
This task is achievable, you can create a auto footnote for XML workflow projects.
1. Create an XSLT to transform the footnote to the respective places
2. Change all the "<" ">" to some standard names, since indesign won't accept XML tags in the footnote stream.
3. Import it in indesign and using script convert it to autofootnote.
Shaji -
How to add an element with a namespace prefix (Part 2)
Hi all,
I previously asked a question about adding an attribute with a namespace prefix to an element that already exists and that declares the namespace prefix here:
https://forums.oracle.com/thread/2610142
I received an answer that works, but now I am stumped again when I have to add an element where the element name has the namespace prefix.
For example, let's say I already have this element:
<A xmlns="namespace" xmlns:def="myns_namespace"/>
And I want to add this element:
<def:B/>
To produce this:
<A xmlns="namespace" xmlns:def="myns_namespace">
<def:B/>
</A>
and NOT this:
<A xmlns="namespace" xmlns:def="myns_namespace">
<def:B xmlns:def="myns_namespace"/>
</A>
This does not work:
SELECT
xmlserialize(document
appendChildXML(
xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
, '/A'
, xmlelement("def:D")
, 'xmlns="namespace" xmlns:def="myns_namespace"'
indent)
FROM dual;
Because of this error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00234: namespace prefix "def" is not declared
Error at line 1
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.
Is there any way to do this without the child element having the duplicate namespace declaration?
My oracle version is:
Oracle Database 11g Release 11.1.0.7.0 - 64bit ProductionHi,
This one's tricky, so tricky that I think it's not possible using Oracle built-in XML DML functions.
Even XQuery Update cannot do it (for now) because, likewise, the prefix is always redeclared at child level.
The only thing I can think of is XSLT (or maybe DOM manipulation) :
SQL> select xmlserialize(document
2 xmltransform(
3 xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
4 , xmltype(
5 '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:def="myns_namespace"
7 xmlns:ns0="namespace">
8 <xsl:template match="ns0:A">
9 <xsl:copy>
10 <xsl:element name="def:B"/>
11 </xsl:copy>
12 </xsl:template>
13 </xsl:stylesheet>')
14 )
15 indent
16 )
17 from dual;
XMLSERIALIZE(DOCUMENTXMLTRANSF
<A xmlns="namespace" xmlns:def="myns_namespace">
<def:B/>
</A>
Maybe you are looking for
-
PO formed from SO has inverted line items compared to SO line items
Dear Friends, We have certain cases in EKKN table where the SO line items dont match with PO line items. Let me give an example. SO item no | item | PO item no | PO item 10 | A |
-
Exchange TLS connection failing
Hello, We have an Exchange 2003 SP2 server that up until recently was able to send encrypted messages to bankofamerica.com. Now the messages get stuck in the outbound delivery queue until they expire. I have confirmed that we are configured using all
-
I have several users using iFolder (the latest client) on Win 7 Pro 64 bit. Each user is experiencing multiple problems on a regular basis such as: Failing to load the client first time often taking 4 or 5 attempts to launch Web service not started e
-
hi , i just got a new router.. but i am unable to get online...it gets no ip... i checked everything..even clone mac but that didn`t help either.. Firmware: v7.00.1
-
How to reset security question, how to reset security question
how to reset my security question