Loading XML with defined DTD
Hi all!
I create XML and DTD. All working fine when I open it in MS XMLNotepad.
But when I try to load my XML in validating mode I get error
Error opening external DTD 'ReportsDTD.dtd'.
I open my XML through class loader as resource stream and then load it from this stream.
In XML I have such string
<!DOCTYPE DEFINITIONS SYSTEM "ReportsDTD.dtd">
Both xml and dtd are located in same directory.
Can anybody explain me whats wrong?
Mike
Reading from a stream, the parser has no idea what the "current directory" is.
So, when you reference a relative URL like "ReportsDTD.dtd", this means to find the DTD in the "same directory" as the current XML document.
You need to properly set the Base URL of the original input stream so that the parser knows what the base directory is.
Or, alternatively you can use getResource on the Class object that returns a URL and that has embedded within it the correct base URL "directory" info to work correctly.
So, if I have a "foo.xml" file that references "foo.dtd" inside, I can use the following code:
import java.net.URL;
import oracle.xml.parser.v2.*;
public class Class1
public static void main(String[] a) throws Throwable {
Class1 c = new Class1();
URL u = c.getClass().getResource("foo.xml");
DOMParser p = new DOMParser();
p.parse(u);
p.getDocument().print(System.out);
public Class1() { }
}Steve Muench
Development Lead, Oracle XSQL Pages Framework
Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
Author, Building Oracle XML Applications
null
Similar Messages
-
ORA-31020 when using XML with external DTD or entities
I'd like to parse XML documents against a modular DTD that references other DTDs. This works fine with Oracle 9i. But after upgrading to 11g, the parsing of XML-instances fails and DBMS_XMLPARSER.parseClob produces ORA-31020.
The same error occurs even if I simply try to store XML with a reference to an external DTD as xmltype:
SQL> select xmltype('<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE ewl-artikel SYSTEM "http://www.foo.com/example.dtd"><test>123</test>') from dual;
ERROR:
ORA-31020: Der Vorgang ist nicht zulässig, Ursache: For security reasons, ftp
and http access over XDB repository is not allowed on server side
ORA-06512: in "SYS.XMLTYPE", Zeile 310
ORA-06512: in Zeile 1
How can I use external DTDs on remote servers in order to parse XML in an 11g database??? Any ideas for a workaround? Thanks in advance!This is my PL/SQL validation procedure:
procedure validatexml (v_id in number default 0) is
PARSER DBMS_XMLPARSER.parser;
DTD_SOURCE clob;
DTD_DOCUMENT xmldom.DOMDocumentType;
XML_INSTANCE xmltype;
BEGIN
-- load DTD from XDB repository
SELECT httpuritype('http://example.foo.de/app1/DTD1.dtd').getclob() into DTD_SOURCE from dual;
-- load XML instance
select co_xml into XML_INSTANCE from tb_xmltab where co_id=v_id;
-- parse XML instance
PARSER := DBMS_XMLPARSER.newParser;
xmlparser.setValidationMode( PARSER , false);
xmlparser.parseDTDClob( PARSER , DTD_SOURCE , 'myfirstnode' );
DTD_DOCUMENT := xmlparser.getDoctype( PARSER );
xmlparser.setValidationMode( PARSER , true );
xmlparser.setDoctype( PARSER , DTD_DOCUMENT );
DBMS_XMLPARSER.parseClob( PARSER , v_xml );
DBMS_XMLPARSER.freeParser(PARSER);
htp.print('<P>XML instance succesfully validated!<P>');
end validatexml; -
Load XML with dynamic filename
Hi,
I am trying to create a load xml function where I can send
the filname to load to the function, however I get a syntax error
with the following function, can anyone see what is wrong here?
function loadXML(file){
myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
// Success
} else {
// fail
myXML.load(path+file);
Thanks for your adviceI was trying to do the same thing and came across this great
tutorial. I think your syntax is just a little off.
myXML=new XML();
myXML.ignoreWhite=true;
myXML.onLoad=function(ok){
if(ok){
//trace('data loaded');
allData=this.firstChild.childNodes;
for(i=0;i<allData.length;i++){
trace(allData
.attributes.text);
}else{
trace('error');
myXML.load('gridTest.xml');
<?xml version="1.0" encoding="iso-8859-1"?>
<nav>
<but text="home">
<heading>You are at Home</heading>
<content>This is the text that is displayed when click
on home</content>
</but>
<but text="About Us">
<heading>You are at the about us
section</heading>
<content>This is the text that is displayed when click
on about us</content>
</but>
<but text="Contact"></but>
<heading>You are at Contact</heading>
<content>This is the text that is displayed when click
on Contact</content>
</nav> -
Load XML with flashvars?
Hey folks
I have a flash photo gallery that uses XML to tell the flash
what pics to load in and display. Works really great but I want to
take it a step further and be able to specify the xml file being
loaded from HTML. I guess using Flashvars unless there's another
method that works better?
in my actionscript, I have this line
xmlData.load("images.xml");
and that's telling it to load in the xml file that has the
info for all the pics
is there any way to replace that with flash vars and actually
have it work?
What we're trying to do is have a different photo gallery on
each page, and instead of making a separate flash movie & xml
for each one, we want to just have 1 "gloabal" flash movie and then
just a different xml file for each different gallery.
Anyone have any ideas how I can get it to work?
I know it's probably some easy little thing I keep missing
:(You just need to replace the file name in:
xmlData.load("images.xml"); with
your variable name, set by FlashVars. I'd suggest using
SWFObject to set the
flash var - it makes it really easy.
Example:
<script type="text/javascript">
var so = new SWFObject("gallery.swf", "gallery", "400",
"300", "8",
"#FFFFFF");
so.addVariable("xmlFile", "gallery1.xml");
so.write("flashcontent");
</script>Then in Flash:
xmlData.load(xmlFile);
http://blog.deconcept.com/swfobject/
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
How to load xml with large base64 element using sqlldr
Hi,
I am trying to load xml data onto Oracle 10gR2. I want to use standard sqlldr tool if possible.
1) I have registered my schema with succes:
- Put the 6kbytes schema into a table
- and
DECLARE
schema_txt CLOB;
BEGIN
SELECT text INTO schema_txt FROM schemas;
DBMS_XMLSCHEMA.registerschema ('uddkort.xsd', schema_txt);
END;
- Succes: I can create table like:
CREATE TABLE XmlTest OF XMLTYPE
XMLSCHEMA "uddkort.xsd"
ELEMENT "profil"
- USER_XML_TABLES shows:
TABLE_NAME,XMLSCHEMA,SCHEMA_OWNER,ELEMENT_NAME,STORAGE_TYPE
"XMLTEST","uddkort.xsd","THISE","profil","OBJECT-RELATIONAL"
2) How can I load XML data into this?
- One element of the schema is <xs:element name="billede" type="xs:base64Binary" minOccurs="0"/>
- This field in data can be 10kbytes or more
I have tried many control files - searching the net, but no luck so far.
Any suggestions?
/Claus, DK- One element of the schema is <xs:element name="billede" type="xs:base64Binary" minOccurs="0"/>
- This field in data can be 10kbytes or moreThe default mapping in Oracle for this type is RAW(2000), so not sufficient to hold 10kB+ of data.
You'll have to annotate the schema in order to specify a mapping to BLOB datatype.
Something along those lines :
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
<xs:element name="image" xdb:defaultTable="IMAGES_TABLE">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="content" type="xs:base64Binary" xdb:SQLType="BLOB"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb05sto.htm#sthref831
Then :
SQL> begin
2 dbms_xmlschema.registerSchema(
3 schemaURL => 'image.xsd',
4 schemaDoc => '<?xml version="1.0"?>
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
6 <xs:element name="image" xdb:defaultTable="IMAGES_TABLE">
7 <xs:complexType>
8 <xs:sequence>
9 <xs:element name="name" type="xs:string"/>
10 <xs:element name="content" type="xs:base64Binary" xdb:SQLType="BLOB"/>
11 </xs:sequence>
12 </xs:complexType>
13 </xs:element>
14 </xs:schema>',
15 local => true,
16 genTypes => true,
17 genTables => true,
18 enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
19 );
20 end;
21 /
PL/SQL procedure successfully completed
SQL> insert into images_table
2 values(
3 xmltype(bfilename('TEST_DIR', 'sample-b64.xml'), nls_charset_id('AL32UTF8'))
4 );
1 row inserted
where "sample-b64.xml" looks like :
<?xml version="1.0" encoding="UTF-8"?>
<image>
<name>Collines.jpg</name>
<content>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QlMUGhvdG9zaG9wIDMuMAA4QklNA+0KUmVzb2x1dGlvbgAA
AAAQASwAAAABAAEBLAAAAAEAAThCSU0EDRhGWCBHbG9iYWwgTGlnaHRpbmcgQW5nbGUAAAAABAAA
AHg4QklNBBkSRlggR2xvYmFsIEFsdGl0dWRlAAAAAAQAAAAeOEJJTQPzC1ByaW50IEZsYWdzAAAA
O9r8FHXdH4LDSSUHoImAmcIcQPwWAkkh3ogKI404WGkkkO8Po/EpmmCYWEkkru7z/FJg9sRqsFJJ
XR3iPZMJN1HmsFJJXT6u+3UQdJUJj7lhpJKHV32dh96i3Qx8lhJJK7u9w4jw7p+SCsBJJDukQ7Tu
VM6Ln0klHo7rjEeak0rASST0f//Z</content>
</image>BTW, open question to everyone...
XMLTable or XMLQuery don't seem to work to extract the data as BLOB :
SQL> select x.image
2 from images_table t
3 , xmltable('/image' passing t.object_value
4 columns image blob path 'content'
5 ) x
6 ;
ERROR:
ORA-01486: size of array element is too large
no rows selectedhowever this is OK :
SQL> select extractvalue(t.object_value, '/image/content') from images_table t;
EXTRACTVALUE(T.OBJECT_VALUE,'/IMAGE/CONTENT')
FFD8FFE000104A46494600010201012C012C0000FFED094C50686F746F73686F7020332E30003842
494D03ED0A5265736F6C7574696F6E0000000010012C000000010001012C0000000100013842494DIs there a known restriction when dealing with LOB types?
Edited by: odie_63 on 17 nov. 2011 19:27 -
Validating XML with its DTD in JSP
Is there a way to validate an XML file with its DTD, using a JSP ???
If YES, then HOW???
I hope my question is clear enough.
Please help!!Thanks "Jleech",
I am using a textarea in a JSP to input for an XML file. The JSP transfers the file to Web-Server, which also has XERCES installed. My question is how can u Validate this transfered XML file with its DTD. My problem is I don't to how to include that Validation program in JSP.?
Could you still help??? -
Loading XML with Flashvars?
Hey folks
I have a flash photo gallery that uses XML to tell the flash
what pics to load in and display. Works really great but I want to
take it a step further and be able to specify the xml file being
loaded from HTML. I guess using Flashvars unless there's another
method that works better?
in my actionscript, I have this line
xmlData.load("images.xml");
and that's telling it to load in the xml file that has the
info for all the pics
is there any way to replace that with flash vars and actually
have it work?
What we're trying to do is have a different photo gallery on
each page, and instead of making a separate flash movie & xml
for each one, we want to just have 1 "gloabal" flash movie and then
just a different xml file for each different gallery.
Anyone have any ideas how I can get it to work?
I know it's probably some easy little thing I keep missing
:(Answered in .actionscript... try not to crosspost.
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Validating XML with external dtd without doctype specified in xml
Hi,
I am very new to SAX, DOM and things..but I am really pulling my hair to find the soln., I have tried to search soln but I found many people asking same question but hardly anyone was satisfactory.
My problem is that I have xml file without doctype specified in it, but I have dtd available on my system.
I have tried to set MyEntityResolver which implements EntityResolver in documentBuilder but its only getting called (resolveEntity method of MyEntirtyResolver), only when I add doctype to the xml (which is not what I want) and not when there is no doctype in the xml. I have set "factory.setValidating(true)" and I also have errorHandler in place.
But why EntityResolver is not invoked when its needed most. ie. when doctype is not available in xml ?...it complains that DOCTYPE must match root=null , which is obvious because no DOCTYPE in xml.
code is as follows:
please help me ..if anyone has any idea about this ....
Main class is :
public static void main(String args[]){
Document document=null;
ErrorHandler defaultHandler=new MyDefaultHandler();
String xmlFile="note.xml";
try{
System.out.println("Starting...");
boolean validXML = true;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
try {
ExternalResolver er = new ExternalResolver();
// addURL is just a method which sets string in a map to be retrieved by resolveEntiy
er.addURL("D:\\SAXnDOM\\SAXProject\\note.dtd");
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setEntityResolver(er);
builder.setErrorHandler(new MyDefaultHandler());
builder.parse(new File(xmlFile));
resolveEntity of ExternalResolver is as follows:
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
System.out.println("********resolvedEntity:" +publicId +" and "+systemId +"******");
if ( urlMap != null && urlMap.get(systemId)!= null ){
try {
return new InputSource(new FileReader(systemId));
} catch (FileNotFoundException e) {
System.out.println("[ERROR] Unable to load entity reference: " + systemId );
return null;
public void addURL(String filePath) throws MalformedURLException{
addURL(new File(filePath).toURL());
public void addURL(URL url) {
if ( urlMap == null ){
urlMap = new HashMap();
urlMap.put(url, null);
}Its working.... its working ...
problem was in resolveEntity, that stupid if condition was removed like this:
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
System.out.println("********resolvedEntity:" +publicId +" and "+systemId +"******");
try {
return new InputSource("D:\\SAXnDOM\\SAXProject\\note.dtd");
} catch (Exception e) {
System.out.println("[ERROR] Unable to load entity reference: " + systemId );
return null;
}Other change is (which I didnt like ) is that in my xml, I had written fake doctype like :
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "fakenote.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
<Prashant>prdfjfdj</Prashant>
</note> in above code fakenote.dtd doesnt exist anywhere ..its just to bypass that doctype:null error.
So my guess is that EntityResolver overrides doctype in the xml and applies its own doctype (note.dtd in this case)
But new proble comes...what if i dont want to add any doctype ..not even fake in xml ?
Hope my stupid mistakes will find someone usefull.. -
hello
trying to write a unit test that validates some xml we are marshalling against a dtd. here is a snippet of code. The problem is how to specify the dtd against which the xml is to be validated. verification_transaction is our root xml element. when i run this code i get a
malformedurlexception: no protocol: verification.dtd
any ideas?
StringWriter writer = new StringWriter();
// write the doctype declaration
writer.write("<!DOCTYPE verification_transaction SYSTEM \"verification.dtd\">");
// now marshal to the writer
marshaller.marshal(spec, requestType, componentNumber, writer);
InputStream inputStream = new ByteArrayInputStream(writer.getBuffer().toString().getBytes());
Reader reader = new InputStreamReader(inputStream);
// get a sax parser that is validating
TestHandler handler = new TestHandler();
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
SAXParser saxParser = factory.newSAXParser();
try {
saxParser.parse(new InputSource(reader), handler);
fail("Should have thrown exception.");
} catch (RuntimeException e) {
// pass
}Message was edited by:
shrndegruvI needed to do a bunch of things.
1.
URL url = getClass().getResource("/verification.dtd");
StringWriter writer = new StringWriter();
writer.write("<?xml version=\"1.0\"?><!DOCTYPE verification_transaction SYSTEM \"" + url + "\">");and then I had to use a handler which processed the errors (which I got from an online tutorial):
private static class MyErrorHandler extends DefaultHandler {
public void warning(SAXParseException e) throws SAXException {
System.out.println("Warning: ");
printInfo(e);
public void error(SAXParseException e) throws SAXException {
System.out.println("Error: ");
printInfo(e);
throw new SAXException("DTD Validation Error: [" + e.getMessage() + "]");
public void fatalError(SAXParseException e) throws SAXException {
System.out.println("Fatal error: ");
printInfo(e);
private void printInfo(SAXParseException e) {
System.out.println(" Public ID: " + e.getPublicId());
System.out.println(" System ID: " + e.getSystemId());
System.out.println(" Line number: " + e.getLineNumber());
System.out.println(" Column number: " + e.getColumnNumber());
System.out.println(" Message: " + e.getMessage());
} -
Load XML with urlstring variables
I have a flash page flipping book that I bought at activeden. It uses an XML file to load in the images of the book to flip through. I have created a PHP file that takes an event ID and creates a custom XML file for flash. How do I have flash load an xml file like this? Instead of passing:
_xmlLoader.loadXml("setup.xml");
I would like to pass:
_xmlLoader.loadXml("setup.php?id=" + eid);
That code doesn't seem to be working for me though. Am I missing something here?Then I don't know what else to offer. As long as the xml is well formed there should be no problem, unless you are testing locally and don't have PHP processing available locally. You will be better off overall testing this on a server.
As my policy I ignore/delete private messages that involve postings. My voluntary attempts to help are strictly in the puiblic forums. -
Goodmorning,
I have this XML file:
bq. <?xml version="1.0"?> \\ <Header> \\ <DocName>NOMRES</DocName> \\ <DocVersion>3.2</DocVersion> \\ <Sender>TIGF</Sender> \\ <Receiver>TIENIG</Receiver> \\ <DocNumber>120731</DocNumber> \\ <DocDate>2008-12-14T16:36:43.9288481+01:00</DocDate> \\ <DocType>J</DocType> \\ <Contract>TIGF-TIENIG</Contract> \\ </Header> \\ <ListOfGasDays> \\ <GasDay> \\ <Day>2008-12-15</Day> \\ <BusinessRuleFlag>Processed by adjacent TSO</BusinessRuleFlag> \\ <ListOfLibri> \\ <Libro> \\ <Logid>62</Logid> \\ <Isbn>88-251-7194-3</Isbn> \\ <Autore>Elisa Bertino</Autore> \\ <Titolo>Sistemi di basi di dati - Concetti e architetture</Titolo> \\ <Anno>1997</Anno> \\ <Collocazione>Dentro</Collocazione> \\ <Genere>Informatica</Genere> \\ <Lingua>Italiano</Lingua> \\ </Libro> \\ <Libro> \\ <Logid>63</Logid> \\ <Isbn>978-88-04-56981-7</Isbn> \\ <Autore>Dan Brown</Autore> \\ <Titolo>Crypto</Titolo> \\ <Anno>1998</Anno> \\ <Collocazione>Dentro</Collocazione> \\ <Genere>Thriller</Genere> \\ <Lingua>Italiano</Lingua> \\ </Libro> \\ </ListOfLibri> \\ </GasDay> \\ <GasDay> \\ <Day>2008-12-15</Day> \\ <BusinessRuleFlag>Confirmed</BusinessRuleFlag> \\ <ListOfLibri> \\ <Libro> \\ <Logid>64</Logid> \\ <Isbn>978-88-6061-131-4</Isbn> \\ <Autore>Stephen King</Autore> \\ <Titolo>Cell</Titolo> \\ <Anno>2006</Anno> \\ <Collocazione>Dentro</Collocazione> \\ <Genere>Horror</Genere> \\ <Lingua>Italiano</Lingua> \\ </Libro> \\ <Libro> \\ <Logid>65</Logid> \\ <Isbn>1-56592-697-8</Isbn> \\ <Autore>David C. Kreines</Autore> \\ <Titolo>Oracle SQL - The Essential Reference</Titolo> \\ <Anno>2000</Anno> \\ <Collocazione>Dentro</Collocazione> \\ <Genere>Informatica</Genere> \\ <Lingua>Inglese</Lingua> \\ </Libro> \\ <Libro> \\ <Logid>66</Logid> \\ <Isbn>978-88-6061-131-4</Isbn> \\ <Autore>Stephen King</Autore> \\ <Titolo>Cell</Titolo> \\ <Anno>2006</Anno> \\ <Collocazione>Dentro</Collocazione> \\ <Genere>Horror</Genere> \\ <Lingua>Italiano</Lingua> \\ </Libro> \\ </ListOfLibri> \\ </GasDay> \\ </ListOfGasDays> \\ <ListOfGeneralNotes> \\ <GeneralNote> \\ <Code>100</Code> \\ <Message>Rien a signaler</Message> \\ </GeneralNote> \\ </ListOfGeneralNotes>
and use this control file:
bq. load data \\ infile "Esempio.XML" "str '</Libro>'" \\ BADFILE "libri.bad" \\ DISCARDFILE "libri.dis" \\ DISCARDMAX 10000 \\ truncate \\ into table LIBRI \\ TRAILING NULLCOLS \\ ( \\ dummy filler terminated by '<Libro>', \\ Logid enclosed by "<Logid>" and "</Logid>", \\ Isbn enclosed by "<Isbn>" and "</Isbn>", \\ Autore enclosed by "<Autore>" and "</Autore>", \\ Titolo enclosed by "<Titolo>" and "</Titolo>", \\ Anno enclosed by "<Anno>" and "</Anno>", \\ Collocazione enclosed by "<Collocazione>" and "</Collocazione>", \\ Genere enclosed by "<Genere>" and "</Genere>", \\ Lingua enclosed by "<Lingua>" and "</Lingua>" \\ )
being uploaded but I always send error in the first record.
Someone said me why? differently if I set the control file?
thanksI have the following XML data file and had the same loading issue.
<?xml version="1.0"?>
<Settlement_Info>
<file_header>
<agency_id>129</agency_id>
<agency_form_number/>
<omb_form_number/>
<treasury_account_symbol/>
<percent_of_amount>100.00</percent_of_amount>
</file_header>
<body_item>
<item_header>
<deposit_ticket_number>001296</deposit_ticket_number>
<total_amount_of_sf215>1,318,542,280.16</total_amount_of_sf215>
<number_of_collections>3,929</number_of_collections>
<total_of_all_collections>1,318,542,280.16</total_of_all_collections>
</item_header>
<item_detail_record>
<paygov_tx_id>FMG4</paygov_tx_id>
<agency_tx_id>0000015901</agency_tx_id>
<collection_amount>8,688.70</collection_amount>
<collection_method>ACH</collection_method>
<deposit_ticket_number>96</deposit_ticket_number>
<settlement_date>12/15/2009</settlement_date>
<collection_status>SETTLED</collection_status>
<submitter_name>MORRIS</submitter_name>
</item_detail_record>
<item_detail_record>
<paygov_tx_id>FMG5</paygov_tx_id>
<agency_tx_id>0000015902</agency_tx_id>
<collection_amount>42,198.66</collection_amount>
<collection_method>ACH</collection_method>
<deposit_ticket_number>001296</deposit_ticket_number>
<settlement_date>12/15/2009</settlement_date>
<collection_status>SETTLED</collection_status>
<submitter_name>CASTLE</submitter_name>
</item_detail_record>
<item_detail_record>
<paygov_tx_id>4FMG6</paygov_tx_id>
<agency_tx_id>0000015903</agency_tx_id>
<collection_amount>57,278.25</collection_amount>
<collection_method>ACH</collection_method>
<deposit_ticket_number>001296</deposit_ticket_number>
<settlement_date>12/15/2009</settlement_date>
<collection_status>SETTLED</collection_status>
<submitter_name>FRANKLIN</submitter_name>
</item_detail_record>
</body_item>
<file_footer>
<file_name>ACHActivityFile_12152009.xml</file_name>
<file_creation_date>12/15/2009 10:08:31 AM</file_creation_date>
</file_footer>
</Settlement_Info>
Control file
load data
infile 'C:\sample1.xml' "str '</item_detail_record>'"
truncate
into table xml_test2
TRAILING NULLCOLS
dummy filler terminated by "<item_detail_record>",
paygov_tx_id enclosed by "<paygov_tx_id>" and "</paygov_tx_id>",
agency_tx_id enclosed by "<agency_tx_id>" and "</agency_tx_id>",
collection_amount enclosed by "<collection_amount>" and "</collection_amount>",
collection_method enclosed by "<collection_method>" and "</collection_method>",
deposit_ticket_number enclosed by "<deposit_ticket_number>" and "</deposit_ticket_number>",
settlement_date enclosed by "<settlement_date>" and "</settlement_date>",
collection_status enclosed by "<collection_status>" and "</collection_status>",
submitter_name enclosed by "<submitter_name>" and "</submitter_name>"
table strucutre
CREATE TABLE XML_TEST2
PAYGOV_TX_ID VARCHAR2(30 BYTE),
AGENCY_TX_ID VARCHAR2(30 BYTE),
COLLECTION_AMOUNT VARCHAR2(30 BYTE),
COLLECTION_METHOD VARCHAR2(30 BYTE),
DEPOSIT_TICKET_NUMBER VARCHAR2(30 BYTE),
SETTLEMENT_DATE VARCHAR2(30 BYTE),
COLLECTION_STATUS VARCHAR2(30 BYTE),
SUBMITTER_NAME VARCHAR2(60 BYTE)
If I reomove the <file_header> and <item_header> blocks, the control file works perfectly, otherwise it skips the first record.
thanks
Reji -
Validate xml with PL/SQL Parser
Hi,
i have an xml DTD into a VARCHAR2 variable and an xml document
into a CLOB, i'd like to know how to validate the xml with my
DTD using PL/SQL API for xml.
Sorry for my terrible english (i'm not english) :-)
Tank you.Here's an example:
set serveroutput on
DECLARE
p xmlparser.parser;
d xmldom.DOMDocument;
dtd xmldom.DOMDocumentType;
v varchar2(32700);
good clob;
bad clob;
xml_parse_error exception;
pragma exception_init(xml_parse_error,-20100);
BEGIN
bad := '<!DOCTYPE Department SYSTEM "test.dtd"><Deprtment/>';
good := '<!DOCTYPE Department
SYSTEM "test.dtd"><Department/>';
v := '<!ELEMENT Department EMPTY>';
p := xmlparser.newParser;
xmlparser.parseDTDBuffer(p,v,'Department');
xmlparser.setDoctype(p,xmlparser.getDoctype(p));
xmlparser.setValidationMode(p,TRUE);
xmlparser.parseClob(p,good);
xmlparser.parseClob(p,bad);
xmlparser.freeParser (p);
EXCEPTION
WHEN xml_parse_error THEN
DBMS_OUTPUT.PUT_LINE(sqlerrm);
xmlparser.freeParser (p);
END; -
XML with MTOM-Attachments for BW 7.X
Hi all,
My question is regarding loading XML with MTOM-Attachments into BW 7.X.
It is possible to load XML-Files with a push via a web service DataSource into BW 7.X. The new NetWeaver-Release 7.1 is capable of handling XML-Files with MTOM-attachments. What I do not understand is if and how the Web Service DataSource and the MTOM capabilities of NetWeaver work together.
Does the capability of NetWeaver 7.1 enable BW to handle MTOM? If it is possible to use MTOM with BW, do I need Usage Type PI to bring MTOM attachments into BW?
I have checked several links regarding MTOM, e.g.
http://help.sap.com/saphelp_nwpi71/helpdata/en/76/fc9c3d9a864aef8139d70759a499fc/frameset.htm
or
https://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/fcbc97b6-0a01-0010-6594-f8208ff674f9&language=en
Unfortunately I could not find an answer to my question there.
Thanks and Regards,
FelixThanks Tammy for the quick reply. Apologies for asking this naive question but since these are planned innovations and subject to change - this means we will not get any of the following benefits if we migrate to BW 7.4 from BW 7.02 and use BO4.1 on top of it now. Yes integrated planning is not applicable to our client.
SAP BW integrated planning
SAP BW integrated planning and planning application kit support in Design Studio
Planning on SAP BW unified models in SAP BW 7.4 for Analysis Office, and Design Studio
Data connectivity (Planned Innovation)
Direct data access to SAP BW for Lumira
User experience
BW integrated planning for Design Studio support
Lumira integration with SAP applications -
HI
I want to load an xml file into a RDBMS table, using sunopsis xml driver.
I try to use an other xml file than the initial that is defined in the driver url.
I cannot run this instruction in a XML treatment before the interface :
LOAD FILE "C:/AXYUS/SURSAUD/entree/sosmed1.xml" WITH DTD "C:/AXYUS/SURSAUD/entree/sosmed.dtd" REPLACE READONLY AUTO_UNLOCK
the file doesn't change at alll and I always load the initial file ( sosmed.xml )
any idea ?Make sure that you issue your LOAD FILE command
- on the SAME Transaction (0, 1, 2, etc...) than the one used in the LKM,
- with the SAME logical schema as the source table logical schema
- and with the SAME Context (if you use the execution context - leave it unset).
This should do the trick, and the connection created in the procedure will be reused in the interface, provided that you chain both in a package.
Regards,
-FX -
How can I load this XML with sql loader ?
Hi,
Im try to load a XML file into a XML table:
Create table TEST of XMLTYPE;
XML file is something like this:
<!DOCTYPE list SYSTEM "myfile.dtd">
<list>
<item id = 1> lot of tags an info here </item>
<item id = 9000> lot of tags an info here </item>
</list>
I dont know how to exactly create an appropriate control file to my XML. All examples I saw in documentation are similar to this one:
this is an example control file
LOAD DATA
INFILE *
INTO TABLE test
APPEND
XMLTYPE (xmldata)
FIELDS
I dont know how to complete this control file. Can anyone help me ?
thank you!
Message was edited by:
pollopoleaWell I found this working code
LOAD DATA
INFILE *
INTO TABLE test APPEND
xmltype(xmldata)
FIELDS
ext_fname filler char(30),
xmldata LOBFILE (ext_fname) TERMINATED BY EOF
BEGINDATA
mifile.xml
mifile2.xml
mifile3.xml
the main diference I found is that when i use:
Insert into test values (XMLType(bfilename('XMLDIR', 'swd_uC000025127.xml'),nls_charset_id('AL32UTF8')));
tag <!DOCTYPE list SYSTEM "myfile.dtd"> is expanded
(I explain at DTD insertion and errors with long DTD entities
Now using sql loader the tag is not modified.
I dont know if is there any difference, between each case. did I lost performance?
Message was edited by:
pollopolea
Maybe you are looking for
-
Unable to restore from DVD set - ThinkPad keeps rebooting to Rescue and Recovery screen
Hello: Lenovo x140e laptop / 2.05 BIOS: (image link removed) I have used Lenovo Rescue / Recovery to make a full disk image backup to DVDs for installation of SSD drive. Attempting to boot from Rescue / Recovery DVD appears to load Windows files, sta
-
How do I get my iCal to sync with a Google cal? Do I have to go thru the Cloud first?
how do I get my iCal to sync with a Google cal? Do I have to go thru the Cloud first?
-
I'm missing a basic concept on iCal.
I'm missing a basic concept on iCal Server i think. I just want to publish a single calendar to the public from the server, not from the local client; with NO passwords. Calendars exist on the iCal Server on 10.8.5 using login credentials from Open D
-
Can't view documents, they show up gray.
This issue is in Adobe Reader 8. It started when I received an Adobe file that was a signed document. The signature block was grayed out, so I clicked on Document, then Sign, then preview document. Since that time all adobe documents are grayed out o
-
Initializing Vector with ResultSet(too Slow!)
Hi I'm createing a JTable with two Vectors. Im am initializing the Vectors in a while loop, but it is way to slow with large ResultSets. Does anyone know how I can speed this process up? Thanks!