Validating an xml with DTD external DTD
Hi
how can i validate my XML File with an external DTD ?
thanks for your replies
serge
Hi,
when you use the XML Library, the interface <b>if_ixml_parser</b> has a static method <b>set_validation( )</b> to activate and deactivate a DTD validation.
There are the follow constants in the if_ixml_parser for the DTD validation-mode:
<b>if_ixml_parser=>co_no_validation</b>
Do not validate the XML-Document against the document type definition (DTD)
<b>if_ixml_parser=>co_validate</b>
Validate the XML-Document against the document type definition (DTD)
<b>if_ixml_parser=>co_validate_if_dtd</b>
Validate the XML-Document against the document type definition (DTD) if a DTD is specified. Otherwise parse the Document in non validating mode.
see also the SAP online-help:
<a href="http://help.sap.com/saphelp_webas610/helpdata/de/bb/5766b2dca511d4990b00508b6b8b11/content.htm">Interface if_ixml_parser</a>
Regards
Stefan
Similar Messages
-
Validating an XML document using external DTD?
Hi,
I want to validate an XML file using external DTD with SAX parser.
How can I validate an XML file with external DTD.
Thanks in Advance,
MahendraI dont think we can set a DTD file throug java while
parsing an XML.I've done it with an XML schema though. Can you use that instead? For schemas you do something like:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setAttribute( "http://java.sun.com/xml/jaxp/properties/schemaSource",
schemaUrl );where schemaUrl in this case would be something like file:///usr/local/whatever.xsd -
Validating XML against an external DTD
I've three questions concerning the validation of an XML file on Checkin:
1. Can the SimpleXMLParser validate an XML file against an external (internal) DTD.
2. How do I have to construct the !DOCTYPE Reference in my XML file for the parser to find my external DTD
3. Do I need to have a iFS type definition for my file to get it validated
nullYes, DTD Validation is supported for 1.1
but its not supported on a Per document basis
or a per protocol basis.
There is a System wide Property called
IfsDefaultDTDValidation which if set to true
will turn on validation for the entire
system (all protocols)
In addition, there is also support for a validate option to be passed to the parser
(which is currently not exposed for 1.1 through the protocols) but a Custom Parser
or application can set the validate mode on.
The validate option setting takes preference
over the IfsDefaultDTDValidation setting
null -
Parsing an xml referencing an external DTD in PLSQL
Hello,
I am using Oracle 9.2.0.3 on HPUX 11i. I want to use DBMS_XMLPARSER to
process XML documents stored in a table as CLOBs. In the documents theres a
DOCTYPE tag <!DOCTYPE myDocType SYSTEM "DTD/myDTD.dtd">.
The following code returns :
ORA-31001: Invalid resource handle or path name "/DTD/myDTD.dtd"
ORA-06512: at "XDB.DBMS_XMLDOM", line 3840
ORA-06512: at "XDB.DBMS_XMLDOM", line 3883
My utl_file_dir parameter is set to '*'
The error comes form the call : aNodeList :=
DBMS_XMLDOM.getElementsByTagName(aDoc, 'myDocType') ;
The same code using the XDK works fine just replacing DBMS_XMLPARSER with
XMLPARSER, DBMS_XMLDOM with XMLDOM... but is slow
I also tried to remove the DOCTYPE tag and it works fine and fast.
Do you have any idea of what I could do to make the DTD regognized.
Thanks a lot
David
DECLARE
aParser DBMS_XMLPARSER.PARSER ;
aDoc DBMS_XMLDOM.DOMDOCUMENT ;
aNodeList DBMS_XMLDOM.DOMNodeList ;
aNode DBMS_XMLDOM.DOMNode ;
aNodeAttr DBMS_XMLDOM.DOMNode ;
aNodeAttrList DBMS_XMLDOM.DOMNamedNodeMap ;
CURSOR C_test IS
SELECT payload
FROM TEST ;
BEGIN
aParser := DBMS_XMLPARSER.newParser ;
DBMS_XMLPARSER.setValidationMode(aParser, FALSE) ;
DBMS_XMLPARSER.setBaseDir(aParser, '/opt/test') ;
FOR R_test IN C_test LOOP
DBMS_XMLPARSER.parseClob(aParser, R_test.payload) ;
aDoc := DBMS_XMLPARSER.getDocument(aParser) ;
aNodeList := DBMS_XMLDOM.getElementsByTagName(aDoc, 'myDocType') ;
IF DBMS_XMLDOM.isNull(aDoc) THEN
DBMS_OUTPUT.PUT_LINE('Doc IS NULL') ;
ELSE
FOR idx IN 0..(DBMS_XMLDOM.getLength(aNodeList)-1) LOOP
aNode := DBMS_XMLDOM.item(aNodeList, idx) ;
dbms_output.put_line(DBMS_xmldom.getNodeName(aNode)) ;
dbms_output.put_line(DBMS_xmldom.getNodeValue(aNode)) ;
aNodeAttrList := DBMS_XMLDOM.getAttributes(aNode) ;
FOR idx1 IN 0..(DBMS_XMLDOM.getLength(aNodeAttrList)-1) LOOP
aNodeAttr := DBMS_XMLDOM.item(aNodeAttrList, idx1) ;
dbms_output.put_line(DBMS_xmldom.getNodeName(aNodeAttr)
|| ' = '||DBMS_xmldom.getNodeValue (aNodeAttr)) ;
END LOOP ;
END LOOP ;
END IF ;
END LOOP ;
DBMS_XMLPARSER.freeParser(aParser) ;
END ;For security purposes the DBMS_XMLPARSER and DBMS_XMLDOM package will not access files on the local file system. To allow the DTD to be resolved you will need to create a DTD folder in the root of the XML DB repository and then load the DTD into that folder. Ensure that the ACL on the DTD folder and DTD document allow the user performing the parsing read access to the docuemnt. You can verify this by connecting as the user in question and performing
select xdburitype('/DTD/myDTD.dtd').getCLOB() from dual -
Validation of XML with Schema, which contains more than one Schema
Hi All,
I am having a parent.xsd file, which inculdes or imports child.xsd file. I need to validate an xml with the parent xsd. Could u give any sample code for doing the same.
Java Version : 1.4.2
Using Xerces for parsing the xml....
Thanks,
SenthilIs anyone there to reply?
-
Partial Validation of XML with Schema
This might be a quick question with a 'yes' or 'no' answer.
What I have is a large XML file. It has various tags that are headers to keep groups of information together. I want to create an XML Schema that validates only one section of the overall larger XML file.
First, is this possible to do, and if so, how exactly do I go about doing it?????
Any code would be great, but if there I think it would be more useful to see how the XSL might be defined.
<root>
<section1>
</section1>
<section2>
<!-- How would I define a W3C Schema to validate only this section? -->
</section2>
<section3>
</section3>
</root>
Again, any help would be much appreciated?
Thanks.
TomThe existing schema validation doesn't let you do that... however you sure can get around it. I wrote some program that let you validate one field at a time, or one record at a time rather than whole document.
I did so by using directly the DataTypeValidator inside org.apache.xerces.validators.*... it requires some coding, because you will have to write your own validator and some sort of filter... but you should look at the codes in that package to get a better understanding. -
Hi,
I have found a piece of code through google, to validate an xml file with an external dtd file. which is
function validateDocument()
xmlDocumentObject = new ActiveXObject("microsoft.XMLDOM")
xmlDocumentObject.onreadystatechange = changeHandler
xmlDocumentObject.load('C:\\My.xml')
function changeHandler()
and for that we need to a import i.e #import "C:\WINDOWS\system32\msxml4.dll"
here when i try to import "msxml4.dll" in Acrobat javascript (js) file, it is giving error, application exits.
How can i import dll in Acrobat javascript to get some functionality, or if not
What someother way to achieve this(To validate xml with dtd file).
This is totally making me crazy, please someone help me on this issue.
thanks in advance.thanks Leonard,
But my problem is i have an xml(i created that using acrobat javascript)and a dtd file, i want validate xml file with that dtd, using acrobat or some other way. How can i validate xml with dtd, please help me. -
Validating XML with DTD ..... Urgent
Hi all,
I am using java 1.4
I have to validate the XML file with the external DTD.
Can anyone give me the code for that.
DTD should be external.
Thanks,
Vinayak.Hello Vinayak,
I'm kind of new to this but I thinik I saw what you're looking for in a program called Echo05 or Echo07 in chapter 5 of http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html.
I think I was working on it Friday and basically you have to have your own DTD then when Echo echo's the output it will throw errors with vaugue messages about how messed up your DTD is.
Regards,
Bill -
Produce XML file with a given DTD
I have only installed XSU, and I was hopping to use pl/sql package XMLGEN to generate XML with a given DTD and a sql query.
I can't find input parameter for DTD. Well it seems logical as both DTD and SQL are for defining the XML output file.
How can this be done ?
Thanks.
/KwanSure. You could write an EntityResolver to do that. Attach it to your DocumentBuilder or XMLReader, depending on which you are using.
-
Does IE/Firefox browser validate a give XML with DTD
Hi,
The following is my XML with an internal DTD and below that is the css
<?xml version="1.0" ?>
<!DOCTYPE INVENTORY
<!ELEMENT INVENTORY (BOOK)+ >
<!ELEMENT BOOK (NAME,PRICE)>
<!ELEMENT NAME (#PCDATA)>
<!ELEMENT PRICE (#PCDATA)>
<!ELEMENT IMAGE EMPTY>
>
<?xml-stylesheet type="text/css" href="Inventory01.css"?>
<INVENTORY>
<BOOK>
<NAME> 101 Thins to lie </NAME>
<PRICE> 9494.03</PRICE>
<IMAGE> TEST </IMAGE>
</BOOK>
<BOOK>
<NAME> iT nEVER Gets Better </NAME>
<PRICE> 44.43</PRICE>
</BOOK>
</INVENTORY>The following is the CSS file refered above.
BOOK
display:block;
margin-top:12pt;
font-size:10pt
NAME
display:block;
margin-top:12pt;
font-weight:bold;
font-style:italic;
PRICE
display:block;
margin-left:15pt;
}I was expecting the browser to validate my XML and give me an error. Please tell me if the browsers validate XMLs? If yes, is there any issue with the above code.
Thanks.
Regards,
TechnozI was expecting the browser to validate my XML and
give me an error. Please tell me if the browsers
validate XMLs?Try this experiment: Set up an XML that doesn't validate against its internal DTD. Then load it into a browser to see if the browser validates it or not.
Oh wait, didn't you already try that experiment? What did you find out? -
How can we validate a XML against his external schema XSD
Hi;
I use the XML library for create my XML file, Im extracting the data
from R3 and building the XML document.
I wish to validate this document against his schema XSD built by third party (government organization) before i transfer this data (xml file)
to the external entity.
In my abap program:
¿How can i reach this validation level and if any
error exists then how can i get or trap the detail information?
this is a sample file XML with the external schema reference, as you can see in this part of the code.
<?xml version="1.0" encoding="UTF-8" ?>
- <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/2 http://www.sat.gob.mx/sitio_internet/cfd/2/cfdv2.xsd" version="2.0" serie="A" folio="0000238" fecha="2006-09-01T19:32:03-05:00" sello="o4kAzhytaTKThSk9tbTQGg5OGacAltWZwxQPZuMg1XhfjMq5jJ0GyO7w2//bf8aTuHnbqwpkR7rIgIehGLy88Xb3Ck0EDsWZEAC1QUuqRq2iWKAnGQPS4l9s0QrJHt0Ziojjd0GQFek6BYXPdlmdTjLZ2x+J8ffYEGpIQZRB8=" noAprobacion="2755" anoAprobacion="2006" formaDePago="En una sola exhibicion" noCertificado="00001000000000806462" condicionesDePago="Neto a 30 días sin DPPP" subTotal="2531.99" descuento="0.00" total="2912.90" tipoDeComprobante="ingreso">
<DomicilioFiscal calle="AVE. UNIVERSIDAD" noExterior="992 NTE." colonia="COL. CUAUHTEMOC" municipio="SAN NICOLAS DE LOS GARZA" estado="N.L." pais="MEXICO
We are using SAP R/3 46C
Thanks in Advance for your help.
Alejandro PérezHi, Alejandro
Did you found something on SAP side in order to generated this XML.
Currently I´m trying to find out some on SAP but nothing at this moment.
The company that I´m working needs to implement "Factura Electonica" also.
Probably we will use external broker to do this for us, and we will send just Idoc to the broker.
Please, let me know your progress on SAP side.
Regards, Fabio -
XML VALIDATION WITH EXTERNAL DTD
I've the following problem:
I've stored a dtd into the xdb repository(with createresource function) and all seems work.
In this DTD i've declared some element and one entity in this way :
<!ENTITY emsp " " ><!--=em space-->
When i try to store or extract my xml (with sql extract function) i get :
ORA-19202 Error during xml processing
LPX-00217 : invalid character 8195 (\u2003)
I've to declare the entity in a different way ?
Thanks in advance
GiovanniYou might want to check out the XML DB forum FAQ rather than ask XML questions on the SQL and PL/SQL forum:
XML DB FAQ -
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; -
Validating generated XML file with DTD
Hello all,
my requirement is to test the XML file with its DTD.
we are creating an XML file, before writing it on the application server , we need to test it with its DTD.
i found one method set_validating in the interface if_ixml_parser , for validating XML file, but not getting an idea how to use it, like how to link the DTD to XML etc.
if i try to use the above method am getting the following error:
Unable to retrieve the external entity 'd:\dtdfile.dtd'.
where 'd:\dtdfile.dtd' is the path of the DTD file included in the Doctype of the XML file.
Please help me to solve this.
Thx in advance.Hello,
Did you find your answer ?
I know how to validate an XML file an internal DTD, but not an external one... If you know, can you pelase advice ?
If you didn't found yet, you need to use method get_reason() to get the description of the error.
best regards,
Gilles. -
HOW TO KNOW VALID XML WITH DTD ? WITHOUT PARSING ?
i am creating the xml file
i need to validate the xml with DTD to confirm is it valid or not ?
with out parsing...
could you tell me how ?
Durgawithout parsing u cant do it..
Maybe you are looking for
-
HP 6100 printing problem: process pdftopdf consumes huge amounts of RAM
I did some remote troubleshooting for my uncle's Mac yesterday who had a problem with his MacBookPro. It occured to him last week after trying to print a document with his HP 6100. When I tried to check the problem, the system UI took at least 15 sec
-
Creating and/or editing a TextEdit document invisibly
I have a script in which the text of a result is set to a new TextEdit document, but that text needs editing prior to displaying the document. As in the following example, I can do the editing invisibly, but creating the initial new document results
-
Can i watch a film rented on apple tv on macbook?
can i watch a film rented on apple tv on macbook?
-
Change color of Comment?
Is it possible to change the background color of a comment? It would be nice to be able to indicate the nature of a comment by the color: positive comments in green, negative comments in red. I don't see any way to change this. Am I missing something
-
How can I get rid of Dregol Search opening tab?
Every time I open the Firefox the Dregol Search comes on the screen. I would like to get rid of it and to create my own starting tab.