XML DTD Validation

Hello,
In my application I need to perform some XML validation against an DTD file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Properties SYSTEM "MyFile.dtd">
<Properties>
<Property name="a" value="a1"/>
</Properties> Both XML file and the DTD are located in the same folder.
What I need, is to perform the XML validation against the DTD file from another location(more precisely, a DTD located in my application's jar) instead of the DTD from the same folder as XML file.
The reason for this is because the remote DTD file is most probably outdated.
This is how I do the validation curentlly:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new org.xml.sax.ErrorHandler()
Document xmlDocument = builder.parse(destinationXMLFile.toURI().toString());
DOMSource source = new DOMSource(xmlDocument);
StreamResult result = new StreamResult(System.out);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "MyFile.dtd");
transformer.transform(source, result);Someone any idea?
Thanks,
johnny

Unusual but if you need this way your application just must to implement EntityResolver that always points to resource DTD.
[]s

Similar Messages

  • Ejb-jar.xml DTD validation error?

    I am attempting to deploy a JAR on App Server 8 PE. The application does not contain any EJBs but I understand that the ejb-jar.xml descriptor is still needed. I am running the app server on Windows XP.
    My issue is as follows:
    I understand that the root element for the ejb-jar.xml file (<ejb-jar>) is required. Since I have no EJBs, I should be able to leave this root element blank (as I have in previoius successful deployments to earlier versions of Sun App Server). When I attempt to deploy, I receive the following DTD Validation error via the admin console:
    The content of element type "ejb-jar" is incomplete, it must match "(description?,display-name?,small-icon?,large-icon?,enterprise-beans,relationships?,assembly-descriptor?,ejb-client-jar?)".
    Am I missing something?
    My ejb-jar.xml file looks like:
    <!DOCTYPE ejb-jar PUBLIC
         "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
         "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    </ejb-jar>
    Many thanks in advance to any assistance...

    I am attempting to deploy a JAR on App Server 8 PE.
    The application does not contain any EJBs but I
    I understand that the ejb-jar.xml descriptor is still
    needed. I am running the app server on Windows XP.
    My issue is as follows:
    I understand that the root element for the
    ejb-jar.xml file (<ejb-jar>) is required. Since I
    have no EJBs, I should be able to leave this root
    element blank (as I have in previoius successful
    deployments to earlier versions of Sun App Server).
    When I attempt to deploy, I receive the following
    g DTD Validation error via the admin console:
    The content of element type "ejb-jar" is incomplete,
    it must match
    "(description?,display-name?,small-icon?,large-icon?,e
    nterprise-beans,relationships?,assembly-descriptor?,ej
    b-client-jar?)".
    Am I missing something?
    My ejb-jar.xml file looks like:
    <!DOCTYPE ejb-jar PUBLIC
    "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
    s 2.0//EN"
         "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    </ejb-jar>
    Many thanks in advance to any assistance...I hav tried this and it is working
    <?xml version="1.0" encoding="UTF-8" ?>
    <ejb-jar
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
    version="2.1">

  • How to disable XML´s DTD validation in Weblogic10?

    Hello folks, we are trying to upgrade our server to Weblogic10, but it´s XML parser is validating XML´s DTD and ´cause we are behind a firewall we receive a error like:
    Tried all: ´6´ address, but could not connect over HTTP to server: 'www.w3.org', port: '80'
    Does anyone here known how to disable DTD validation in WL10?
    Regards,
    lottalava

    Well you can create non validating parser programatically .
    http://edocs.bea.com/wls/docs100/xml/programming.html#wp1069856
    i.e.
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setValidating(false);
    Hope this helps.

  • No DTD validation in SAX Parser

    I have a xml document which has a DocTYpe spec in it with a DTD reference, but the dtd file itself is not there. We tried to parsing it in Non validating mode , but it throws a fileNot Found Exception looking for the DTD file. we tried it on the SAXSample too, with same results.
    Is there any way around it.
    Thanks.
    Chirdeep

    We would like to be able to do this also.
    We use XML for messaging between systems and would like to be able to switch this off or on at run-time according to user preference. Validating against the DTD obviously requires extra processing time, we would like to check well-formedness en-route between systems to ensure that the message is complete, without doing a full check against the DTD. (This would then be done at the end-point of the journey).
    If no DTD is referenced then this works fine. However if a DTD is referenced in the XML and validation mode is set to off, it still wants to validate against a DTD.
    Is this a bug or is there are work-around ?

  • JAXP API provides no way to enable XML Schema validation mode

    I am evaluating XDK 9.2.0.5.0 for Java and have encountered another
    problem with XML Schema support when using the JAXP API.
    Using the classes in oracle.xml.jaxp.*, it appears to be impossible to
    enable XML Schema validation mode. I can set the schema object, but
    the parser does not use it for validation.
    If I use DOMParser directly, I can call the setValidationMode(int)
    method to turn on schema validation mode. There is no equivalient
    means to enable XML Schema validation when using the JAXP API.
    Test case for JAXP API:
    === begin OracleJAXPSchemaTest.java ======
    package dfranklin;
    import java.io.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import oracle.xml.parser.schema.XMLSchema;
    import oracle.xml.parser.schema.XSDBuilder;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class OracleJAXPSchemaTest
    private final static String xsd = ""
    +"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"urn:dfranklin:test\">"
    +" <xsd:element name=\"amount\" type=\"xsd:integer\"/>"
    +"</xsd:schema>";
    private final static String xml =
    "<amount xmlns=\"urn:dfranklin:test\">1</amount>";
    public static void main(String[] args)
    throws Exception
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
              "oracle.xml.jaxp.JXDocumentBuilderFactory");
    new OracleJAXPSchemaTest().run();
    public void run()
    throws Exception
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(true);
    dbf.setNamespaceAware(true);
    XMLSchema xmlSchema = buildXMLSchema(new StringReader(xsd));
    dbf.setAttribute("oracle.xml.parser.XMLParser.SchemaObject",
              xmlSchema);
    DocumentBuilder docbldr = dbf.newDocumentBuilder();
    Document doc = docbldr.parse(new InputSource(new StringReader(xml)));
    print(doc);
    private XMLSchema buildXMLSchema(Reader xsdin)
    throws Exception
    XSDBuilder xsdBuilder = new XSDBuilder();
    XMLSchema xmlSchema = (XMLSchema)xsdBuilder.build(xsdin, null);
    return xmlSchema;
    private void print(Document doc)
    throws
    javax.xml.transform.TransformerConfigurationException,
    javax.xml.transform.TransformerException
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(new DOMSource(doc), new StreamResult(System.out));
    System.out.println();
    === end OracleJAXPSchemaTest.java ======
    Running that program:
    java dfranklin.OracleJAXPSchemaTest
    produces this output
    Exception in thread "main" oracle.xml.parser.v2.XMLParseException: Element 'amount' used but not declared.
    at oracle.xml.parser.v2.XMLError.flushErrors(XMLError.java:148)
    at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:269)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
    at oracle.xml.jaxp.JXDocumentBuilder.parse(JXDocumentBuilder.java:96)
    at dfranklin.OracleJAXPSchemaTest.run(OracleJAXPSchemaTest.java:40)
    at dfranklin.OracleJAXPSchemaTest.main(OracleJAXPSchemaTest.java:27)
    This shows that the parser is not using the XML Schema to validate the
    document. I think it's expecting to find a DTD.
    Here is the equivalent program using DOMParser directly, and setting
    validation mode to SCHEMA_VALIDATION.
    === begin OracleParserTest.java ====
    package dfranklin;
    import java.io.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import oracle.xml.parser.schema.XMLSchema;
    import oracle.xml.parser.schema.XSDBuilder;
    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.XMLParser;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class OracleParserTest
    private final static String xsd = ""
    +"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"urn:dfranklin:test\">"
    +" <xsd:element name=\"amount\" type=\"xsd:integer\"/>"
    +"</xsd:schema>";
    private final static String xml =
    "<amount xmlns=\"urn:dfranklin:test\">1</amount>";
    public static void main(String[] args)
    throws Exception
    new OracleParserTest().run();
    public void run()
    throws Exception
    DOMParser dp = new DOMParser();
    XMLSchema xmlSchema = buildXMLSchema(new StringReader(xsd));
    dp.setXMLSchema(xmlSchema);
    dp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    dp.parse(new InputSource(new StringReader(xml)));
    Document doc = dp.getDocument();
    print(doc);
    private XMLSchema buildXMLSchema(Reader xsdin)
    throws Exception
    XSDBuilder xsdBuilder = new XSDBuilder();
    XMLSchema xmlSchema = (XMLSchema)xsdBuilder.build(xsdin, null);
    return xmlSchema;
    private void print(Document doc)
    throws
    javax.xml.transform.TransformerConfigurationException,
    javax.xml.transform.TransformerException
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(new DOMSource(doc), new StreamResult(System.out));
    System.out.println();
    === end OracleParserTest.java ====
    Running that program
    java dfranklin.OracleParserTest
    produces this output
    <?xml version = '1.0'?>
    <amount xmlns="urn:dfranklin:test">1</amount>
    In this case, the parser has validated the document.
    I also tried this with version 10.1.0.0.0 beta, and got the same
    error.
    Darin Franklin

    Thanks for posting that. I tried that code and still got my problem. The big difference is that I'm reading a group of XML files each of which uses a large number of schema files. There are over 50 schema files organized so they can be included as needed. Each of the XML files has a noNamespaceSchemaLocation attribute specifying one of the ten top schma files, that includes many others.
    However, I did solve the problem. I added one line --
           saxb.setFeature( "http://apache.org/xml/features/validation/schema",
                    true);
            // next line is new
            saxb.setProperty( JAXPConstants.JAXP_SCHEMA_LANGUAGE,
                    JAXPConstants.W3C_XML_SCHEMA );after the setFeature to turn on schema validation.
    (It needs an import org.apache.xerces.jaxp.JAXPConstants; statement.)
    Note:With the feature set to true and the setProperty commented out, the EntityResolver is called at construction tiem, and for each schema file, but each element is flagged as needing to be declared.
    With the feature commented out, and the setProperty in place, the EntityResolver is not called, and there is no validation performed. (I added invalid content to one of the files and there were no errors listed.)
    With both the setFeature and the setProperty in place, however, I get the calls from the EntityResolver indicating that it is processing the schema files, and for the good files, I get no errror, but for the bad file, I get an error indicating a bad validation.
    Now I can make the EntityResolver quiet and get what I wanted. Maybe there are other ways to do this, but I've got one that works. :-)
    Thanks to all who have helped.
    Dave Patterson

  • Weblogic 9.2 JDk 1.5 DTD Validation

    Hi
    We are using xerces parser and doing DTD Validation .
    We want to have all the DTD present in the local directory
    C:/temp( as reading from the WAR is a performance hit)
    When we try to run with Weblogic 8.1 ( with JDK1.4 and JDK1.5 ) the xml is being parsed properly and validated with DTD without any errors
    But when we are trying to Validate the DTD with Weblogic 9.2 and JDK 1.5 it gives the error
    C:/temp/a.dtd not found even though the DTD is present in that location .
    Is there a settiing in Weblogic 9.2 which needs to be set for it to read local file system files?
    Thanks
    Sachin

    weblogic 9.2 uses jdk 1.5_04 if i recall correctly.

  • DOM Parser Configuration...how to switch off DTD validation?

    Hi all,
    I am developing some implementation code in Java using JBuilder2005, in which DOM3 parser is also being utilised. Now the question is how to switch off DTD validation (seems its default mode is 'on') so that no validation will be carried out at all even DTD declaration statement is presented in an input XML document?
    Many thanks in advance
    Frank

    First of all, thank you so much for responding, DrClap. =)
    setValidating(false) of the DocumentBuilderFactory instance, factory, does not work as expected; it still stubbornly try to seek the external DTD file and fires 'IOException' error in case of no such a DTD.
    To follow up the EntityResolver approach, I searched online for almost the whole afternoon but still could not figure out how to do it exactly. In particular, I found http://www.jdom.org/docs/faq.html#a0350, which tells a way doing it, but I got 'StringBufferInputStream is deprecated' error. Then I changed to
    new InputStream(new ByteArrayInputStream("".getBytes()))adapted from http://forum.java.sun.com/thread.jspa?threadID=572919&messageID=2842185. But another error occurs: 'java.io.InputStream is abstract; cannot be instantiated'. Furthermore, I have looked at many docs(tutorials, APIs...) on parser configuration, usage of EntityResolver/setEntityResolver()...but they turned out not helpful. Could you please give out more details on how to do this using EntityResolver?? Many many thanks...

  • Message Mapping - Turn Off dtd validation

    Hi,
    I would like to know how to turn off dtd validation in a message map.
    The source message type is based on dtd. When testing, I get the following error
    java.io.IOException: Failed to load resource from the context classloader of the current thread! Loading from classloader was caused by: java.io.FileNotFoundException: D:\usr\sap\XYZ\DVEBMGS01\j2ee\cluster\server0\abc.dtd (The system cannot find the file specified)
    I understand that the map requires the dtd to be present in the application folder. But, can I change some setting not to look up this file.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE MessageContainer SYSTEM "abc.dtd">

    Sorry Arvind. Not able to understand your question.
    The problem we are facing is, when the input xml file contains DocType declaration with reference to a dtd, we get an error stating the dtd is not found in the j2ee application folder.
    It works fine if the dtd is saved in the location. Also, it works fine if the DocType declaration is removed from the xml file. However, we are exploring an option where declaration is used but dtd is not available.
    Is there any way to achieve this?
    Thanks!

  • Transform XML without validating

    Hi, I use Xalan to transform an XML file.
    I use Tranformer.class, I just want to tranform the XML without validating the file.
    In the parser class, you can use setValidate to avoid or not the validating action.
    Do you know how to do the same with Transformer.class
    Thanks C�dric

    This one piqued my interest, and as no one had responded
    yet I thought I'd poke around and see what's up.
    I looked at the Transfermer class, and the javadoc pointed
    me to the OutputKeys class, the only thing that looked
    remotely interesting was the "STANDALONE" feature. I wonder
    if you can set it to "true" and avoid the validation (as I
    think Standalone implies, no DTD to validate against?)
    Eric

  • Disabling dtd validation

    I know it sounds odd.. but I need my appserver to run offline. basically I am creating a stand alone server and application installation that one of our marketing guys can take on the road on a laptop and demo to people where there is no internet.
    you know.. localhost style ;-)
    One problem.. when there is no internet, DTD validation for sun and oracle wesite DTDs all fail. Removing all dtd references or making them local would take as long as it would take me to write a script to do it... I am hoping there is just a setting in the application server that I can set to disable dtd validation. The whole app is done being developed.. I don't need my xml validated anymore! I need to be able to run without the intarwebnets!
    please help!

    Haven't worked with this but possibly this method of "deactivation" is not valid in 11gR2? Have you cross checked that with Oracle support?

  • DTD Validator

    Is there a DTD validator available for download? Also, is there
    a converted to BNF available?
    null

    I am not sure what you mean by "DTD Validator". If you mean
    chcking that a DTD is well-formed and has access to its entities
    then our XML Parser will do the job. As to conversion to BNF, we
    have nothing in this area until our XSL Processor becomes
    available.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Rob Jaeger (guest) wrote:
    : Is there a DTD validator available for download? Also, is
    there
    : a converted to BNF available?
    null

  • Java Stored Procedure SAXParser XML Schema Validation

    Using Oracle XML Developers Kit 10.2.0.2.0 - Production.
    Attempting to validate using XML Schema in a Java stored procedure with the code:
                   if ( schemaDoc == null )
                        // Obtain default connection
                        Connection conn = new OracleDriver().defaultConnection();
                        OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement("SELECT XmlDocObj FROM XmlDoc WHERE XmlDocNbr = 2");
                        OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
                        if ( rset.next() )
                             // get the XMLType
                             XMLType schemaXml = (XMLType)rset.getObject(1);
                             XSDBuilder builder = new XSDBuilder();
                             XMLSchema schemaDoc = (XMLSchema)builder.build(new InputSource(schemaXml.getInputStream()));
                   if ( inst == null )
                        inst = new ValidateCoreRequest();
                   ErrorHandlerImpl handler = inst.getNewErrorHandler();
    SAXParser saxParser = new SAXParser();
    saxParser.setXMLSchema(schemaDoc);
    saxParser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxParser.setErrorHandler(handler);
    saxParser.parse(new InputSource(new StringReader(docStr)));
    if( handler.validationError )
                        errorMsg[0] = handler.saxParseException.getMessage().substring(0, Math.min(199, handler.saxParseException.getMessage().length()));
    Never reports validation errors in the XML. Although the XDK Programmers Guide states "...you can use
    the oracle.xml.parser.schema.XSDBuilder class to build an XML schema and
    then configure the parser to use it by invoking the XMLParser.setXMLSchema()
    method. In this case, the XML parser automatically sets the validation mode to
    SCHEMA_STRICT_VALIDATION and ignores the schemaLocation and
    noNamespaceSchemaLocation attributes." No validation seems to occur. I have tried to set an xsi:noNamespaceSchemaLocation attribute on the root XML node, but this results in URL errors if the URL is not valid or schema build errors if the URL is valid, but does not point to a real location.
    It appears that without a schema location attribute, no schema validation occurs. Using setXMLSchema() with a database source does not seem to cause the schema location attributes to be ignored. At least for Java stored procedures.
    Does XML Schema validation work in the database for externally referenced schemas?
    Thank You,
    Art

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jan Vissers ([email protected]):
    I have two schemas A and B. A contains a java stored procedure which calls a java stored procedure stored in B. Upon resolving the "A" Java Stored Procedures I get the following error:
    ORA-29545: badly formed class: at offset 3093 of Adapter.TFADPBeschikbaarheid.sendAanvraag expecting a class-oracle.xml.parser.v2.XMLDocument but encountered a class-oracle.xml.parser.v2.XMLDocument.
    ... Question:
    it is expecting something which it has in fact encountered... SO!!!! What is the error.
    Thx,
    Jan<HR></BLOCKQUOTE>
    Try this:
    Edit your XSU installation script located on lib directory of Oracle XSU's distribution:
    Find the line:
    loadjava -r -v -u $USER_PASSWORD xmlparserv2.jar
    Replace by:
    loadjava -r -v -g public -u $USER_PASSWORD xmlparserv2.jar
    And installs your Oracle XSU again.
    Best regards, Marcelo.

  • Xml message validation or CSV validaion in PI 7.0

    Hi Gurus,
    I need to validate the incoming XML file (source format) in PI 7.0 and if the message is not valid I need to send an email to the sender that the message is invalid.
    I know there is a feature in PI 7.1 XML schema validation done by IE or AAE but is there is any validation feature or do we need write any logic in the mapping editor to validate the incoming XML file.
    Any help appreciated.
    Thanks,
    Jay

    You have to wite JAVA Mapping for the same to validate XML message in PI7.0.
    Refer below link
    http://wiki.sdn.sap.com/wiki/display/XI/XIschemavalidationusingDOMparserviaJavacode
    Regards,
    Raj

  • Xml schema validation problem

    Hi All
    How to tackle this xml schema validation problem
    i am using the sample code provided by ORacle technet for xml
    schema validation in the Oracle database(817).
    The sample code works perfectly fine.
    Sample as provided by http://otn.oracle.com/tech/xml/xdk_sample/archive/xdksample_093001.zip.
    It works fine for normal xml files validated against
    xml schema (xsd)
    but in this case my validation is failing . Can you let me know why
    I have this main schema
    Comany.xsd
    ===========
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.company.org"
    xmlns="http://www.company.org"
    elementFormDefault="qualified">
    <xsd:include schemaLocation="Person.xsd"/>
    <xsd:include schemaLocation="Product.xsd"/>
    <xsd:element name="Company">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Person" type="PersonType" maxOccurs="unbounded"/>
    <xsd:element name="Product" type="ProductType" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    ================
    which includes the following 2 schemas
    Product.xsd
    ============
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="ProductType">
    <xsd:sequence>
    <xsd:element name="Type" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    ==============
    Person.xsd
    ===========
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="PersonType">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="SSN" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    =================
    now when i try to validate a xml file against Company.xsd
    it throws an error saying unable to find Person.xsd.
    no protocol error
    Now where do i place these 2 schemas(.xsd files) Person & product
    so that the java schemavalidation program running inside Oracle
    database can locate these files
    Rgrds
    Sushant

    Hi Jinyu
    This is the java code loaded in the database using loadjava called by a wrapper oracle stored procedure
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import java.net.*;
    import java.io.*;
    import org.w3c.dom.*;
    import java.util.*;
    import oracle.sql.CHAR;
    import java.sql.SQLException;
    public class SchemaUtil
    public static String validation(CHAR xml, CHAR xsd)
    throws Exception
    //Build Schema Object
    XSDBuilder builder = new XSDBuilder();
    byte [] docbytes = xsd.getBytes();
    ByteArrayInputStream in = new ByteArrayInputStream(docbytes);
    XMLSchema schemadoc = (XMLSchema)builder.build(in,null);
    //Parse the input XML document with Schema Validation
    docbytes = xml.getBytes();
    in = new ByteArrayInputStream(docbytes);
    DOMParser dp = new DOMParser();
    // Set Schema Object for Validation
    dp.setXMLSchema(schemadoc);
    dp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    dp.setPreserveWhitespace (true);
    StringWriter sw = new StringWriter();
    dp.setErrorStream (new PrintWriter(sw));
    try
    dp.parse (in);
    sw.write("The input XML parsed without errors.\n");
    catch (XMLParseException pe)
    sw.write("Parser Exception: " + pe.getMessage());
    catch (Exception e)
    sw.write("NonParserException: " + e.getMessage());
    return sw.toString();
    This is the code i used initially for validating a xml file against single xml schema (.xsd) file
    In the above code could u tell how to specify the second schema validation code for the incoming xml.
    say i create another Schemadoc for the 2nd xml schema.
    something like this with another parameter(CHAR xsd1) passing to the method
    byte [] docbytes1 = xsd1.getBytes();
    ByteArrayInputStream in1 = new ByteArrayInputStream(docbytes1);
    XMLSchema schemadoc1 = (XMLSchema)builder.build(in1,null);
    DOMParser dp = new DOMParser();
    How to set for the 2nd xml schema validation in the above code or can i combine 2 xml schemas.
    How to go about it
    Rgrds
    Sushant

  • Adapter Engine XML Schema Validation Error Surpression

    We recently developed a number of web services that are called by 3rd parties outside our network. The web service request once made is picked up by a Web Dispatcher which then forwards the request to the de-central adapter. Both of these components reside within within a DMZ.
    We have, as an additional security measure made use of the new Adapter Engine XML Schema validation available with PI 7.1, to ensure that the payload of incomming messages is checked to ensure that it is a known structure.
    Now here is my problem, we recently had these services penetration tested by a 3rd party to ensure that they were secure and whilst the report was very good showing no major weaknesses they did pickup on a couple of items including that the fact that if the XSD to be used during payload message validation cannot be found an 'ADAPTER.JAVA_EXCEPTION' is returned to the web service consumer that highlights the path details of where the XSD should be (but could not be found).
    This was viewed as useful to an attacker for a number of reasons:
    1. Feedback in SQL injection attempts via verbatim DB error messages greatly improves attacker efficiency
    2. Path information is useful to the attacker for OS fingerprinting, directory traversal attempts
    3. Other miscellaneous stack trace information is useful to an attacker to understand how the application works
    Is there anyway this can be surpressed so that the adapter does not show this information in the returned error message - see example message below ?
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessageFormatException: Schema MaintenanceOrderByIDQuery_sync.xsd not found in E:\usr\sap\DPI\DVEBMGS40\j2ee\cluster\server0\validation\schema\f7cd3b50a87411e08830ed9d0af006a5\urnstw.contractor.wfm.workorderretrieval\MaintenanceOrderByIDQueryRequest_Out\httpsap.comxiSAPGlobal20~Global\MaintenanceOrderByIDQuery_sync.xsd  (validation\schema)
         at com.sap.aii.adapter.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:1041)
         at sun.reflect.GeneratedMethodAccessor497.invoke(Unknown Source)
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessageFormatException: Schema Schema1.xsd not found in E:\usr\sap\DPI\DVEBMGS40\j2ee\cluster\server0\validation\schema\f7cd3b50a87411e08830ed9d0af006a5\urnstw.contractor.wfm.workorderretrieval\MaintenanceOrderByIDQueryRequest_Out\httpsap.comxiEA-APPLSEGlobal\Schema1.xsd  (validation\schema)
         at com.sap.aii.adapter.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:1041)

    Hi,
    We are having the same problem, so you are not alone.
    I had an extensive call with Azure premium support and we where able to determine that:
    - Nothing is missing or in the wrong place in my exported .xml file.
    - Any changes to the VNET's using the web gui interface of https://manage.windowsazure.com is not possible when you have dns servers and use an gateway
    - You can download the .xml configuration file of the network and make manual changes to it, then import it again , to add/remove dns servers and or subnet's. 
    I am currently waiting for an solution,  i have let them lower the urgency from A to B (because i can make changes trough xml) and responded to the next support contact (saying he will continue with the issue) that the problems seems to be with azure and
    he should speak with the previous person helping me.  I have not heard from Azure support since.
    SR Number:115021812414226
    Open on:02/18/2015 09:28
    > There are networks with and without gateways created and the issue is happening on all the networks.
    > We are unable to add or remove the DNS servers. (by web gui)
    > Also not able to add or remove any subnets. (by web gui)
    > Every time the error message is same but the DNS server name is different. (from another subnet then the one we are changing)
    > Created CRI- 3405931, but they said it will need WATS team.
    > Confirmed with WATS engineer as well and moving case to WATS.
    > Cx agreed to lower the severity of the case as they are able to make changes through the network configuration file.
    > But they still want to get this resolved soon.
    > Agreed and dropped off, reducing severity to B 24/7.
    I hope microsoft is going to resolve this soon, as i do not want to edit my xml for little things like adding a subnet all the time. I have requested an status update in the issue.
    Should anyone have more information on this, please share it here.

Maybe you are looking for

  • Error installing MaxDB 7.6.03.09 on windows 32 bit on NW70 SR2 sapinst

    MaxDB experts, Hello.  I am trying to install SAP NW70SR2 (JAVA AS) on MaxDB 7.6.03.09 with windows 32 bit OS.  Brand new install, JAVA AS central system. Our problem is in the SAPINST phase: Install database server software I see this in the sapinst

  • [Solved] Conky doesn't show network speed

    Hello Archers! I have my old conky config with net speed indication which worked in past but stopped working this installation. My user is in "network" group and I have ${font monospace:bold:size=10}NETWORK ${hr 2} ${font monospace:normal:size=10}Dow

  • Question about my fitness icon

    I push on my fitness icon and I just get pedometer and history not walk,run and history. Why is that? thanks

  • Internet Explorer Security Support on Windows 7 & WIndows 2008 Std Server

    I have an app page (tomcat https) that i was able to open from a windows 7 professional remotely but could not open from a windows 2008 std server.  Is there a security settings I need to disable from windows 2008 std server?  The firewall is disable

  • Problem reinstalling mac os

    I was attempting to reinstall mac os on my macbook. The reinstall got to the end of the installation and then it ended. It told me that there was an error and that I would have to reinstall. I hit ok and when it came back on the only thing that comes