XSL used on XML validated against XSD

Transforming XSD validated XMLType Data
Re: example XSL in Chapter 6 that transforms XML with associated XSD schema definition (Oracle 9i XML Database Developer's Guide)
I noted that this XSL uses only the "general" node identification functions (e.g., name() ) to access nodes in the <xsl:value-of select..>. I have also noted that standard XSL templates from other sections of the documentation, for example in Chapter 3 and in Appendix D, do not work with an XML which is validated against an XSD schema.
Can anyone give me an example <xsl:value-of select..> that addresses a specific node in the "purchase order" example, like the shipTo, name, street -- or any other specific node. This is critical since there is always bound to be node-specific processing in any transformation, and this is not demonstrated by any example of XML which has been validated against an XSD.
I have tried this endlessly on my own examples of XML w/XSD validation. Even if the value-of select="name(.)" tells you that the name of the node is "FooBar", you cannot use FooBar as a select test to do FooBar specific processing.
Help?????

Not quite understand your question. Can you send me the example doc?

Similar Messages

  • XML validation against XSD

    Hi,
    Does Oracle 8i (Release 3) support XML validations against XSD? I know Oracle 9i (Release 2) supports XML validations against XSD.
    Also, Does Oracle support XML validations against XDR?
    Any info is appreciated.
    Thanks
    Pavan

    Validate with DOMParser or the SAXParser.

  • Using XSL on XML validated against XSD

    Transforming XSD validated XMLType Data
    Re: example XSL in Chapter 6 that transforms XML with associated XSD schema definition (Oracle 9i XML Database Developer's Guide)
    I noted that this XSL uses only the "general" node identification functions (e.g., name() ) to access nodes in the <xsl:value-of select..>. I have also noted that standard XSL templates from other sections of the documentation, for example in Chapter 3 and in Appendix D, do not work with an XML which is validated against an XSD schema.
    Can anyone give me an example <xsl:value-of select..> that addresses a specific node in the "purchase order" example, like the shipTo, name, street -- or any other specific node. This is critical since there is always bound to be node-specific processing in any transformation, and this is not demonstrated by any example of XML which has been validated against an XSD.
    I have tried this endlessly on my own examples of XML w/XSD validation. Even if the value-of select="name(.)" tells you that the name of the node is "FooBar", you cannot use FooBar as a select test to do FooBar specific processing.
    Help?????

    Not quite understand your question. Can you send me the example doc?

  • XML validation against XSD Schema in ABAP

    Hi colleagues,
    I'm looking for a way to validate a XML against a XSD schema in ABAP, without using java or command line or something like that. Is there any way to do this only with ABAP?
    Thanks in advance.
    Regards,
    Guenter

    Hi everyone,
    I'm currently facing the same problem. I need to validate a xml file with an existing xsd schema for some export/import functionality. I just found an ABAP program doing this with a Java fallback. But isn't there a way doing this wihtout using Java but only ABAP? There certainly is, anyone an idea?
    Thank you and regards
    Maximilian

  • XML validation against schema in XSD format

    I have a requirement for validation of XML file against XML schema(XSD format). Using IXML liabrary I know how to validate XML file against schema in DTD format. But i am not getting how to do it against XSD. Is it possible using IXML liabrary? Also i wanted to know how to attach one XML or CSV file into another XML file using SAP ABAP.
    Please provide solution!!

    Hi Madhura,
    see here my comparison of the web version against the local file version on my Windows box (which is itself not the fastest): It makes a factor 16 in difference!
    C:\Temp\xsdvalidator>java XsdValidator madhu.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 16353 ms
    C:\Temp\xsdvalidator>java XsdValidator madhu_local.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 994 ms
    Obviously, the w3c.org domain that you specified as ressource location is very slow - and, as the FAQ shows, this delay is intentional!
    The W3C servers are slow to return DTDs. Is the delay intentional?
    Yes. Due to various software systems downloading DTDs from our site millions of times a day (despite the caching directives of our servers), we have started to serve DTDs and schema (DTD, XSD, ENT, MOD, etc.) from our site with an artificial delay. Our goals in doing so are to bring more attention to our ongoing issues with excessive DTD traffic, and to protect the stability and response time of the rest of our site. We recommend HTTP caching or catalog files to improve performance.
    --> They don't want to have requests to their site from productive servers all around the world.
    Regards,
    Rüdiger

  • XML validation using javax.xml.validation

    Hello,
    I am trying to validate some xml against my xsd.
    Here is my xml:
    <host>
        <status>Unknown</status>
    </host>Here is my xsd:
    <?xml version="1.0"?>
                                                                                                                                                                 <xsd:schema targetNamespace="blah"
            xmlns:tns="blah"
            xmlns:xsd="blah">
    <xsd:simpleType name="Status">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Unknown"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:element name="host">
       <xsd:complexType>
         <xsd:all>
           <xsd:element name="status" type="tns:Status"/>
         </xsd:all>
       </xsd:complexType>
    </xsd:element>
                                                                                                                                                                 </xsd:schema>My test code is:
            try
                DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document document = parser.parse(new File("test.xml"));
                // Create a SchemaFactory capable of understanding WXS schemas.
                SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                // Load a WXS schema, represented by a Schema instance.
                StreamSource schemaFile = new StreamSource(new File("schema.xsd"));
                Schema schema = factory.newSchema(schemaFile);
                // Create a Validator object, which can be used to validate the document
                Validator validator = schema.newValidator();
                // Validate the DOM tree.
                validator.validate(new DOMSource(document));
            catch(Exception e)
                fail("XML validation failed: " + e.getMessage());
            }I get the following error:
    ERROR: 'cvc-elt.1: Cannot find the declaration of element 'host'.'
    If i replace "type=tns:Status' in the "status" element with just "type=string", it works fine.
    Does anyone have any idea what the problem is?
    Thank you,
    David

    To daft_davy:
    1. Your XSD document is invalid: the xmlns attribute of schema documents must always have the following value: "http://www.w3.org/2001/XMLSchema"
    All other values will result in the following validation error:
    org.xml.sax.SAXParseException: s4s-elt-schema-ns: The namespace of element 'schema' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
    Your XSD should look like this:
    <?xml version="1.0"?>
    <xsd:schema targetNamespace="blah" xmlns:tns="blah" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:simpleType name="Status">
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value="Unknown"/>
        </xsd:restriction>
      </xsd:simpleType>
      <xsd:element name="host">
        <xsd:complexType>
          <xsd:all>
            <xsd:element name="status" type="tns:Status"/>
          </xsd:all>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>2. Your XML document does not match the XSD schema (even if you use the one above) for the following reasons:
    a) The root element of the XML document must be associated with the namespace defined by the targetNamespace attribute of the schema.
    b) The "blah" namespace at the element <status> in the XML document has to be undeclared because there is no namespace declaration to this element in the schema document either. There are to ways to do this:
    <host xmlns="blah">
      <status xmlns="">Unknown</status>
    </host>or:
    <xxx:host xmlns:xxx="blah">
      <status>Unknown</status>
    </xxx:host>
    To watertownjordan:
    The namespace URI can be virtually any string, so you don't need to specify a valid URI to define a namespace.

  • QUESTION: XML validation against a schema - for beginners

    Hi folks,
    i am new to XML validation.
    i would like to find out how to validate an XML file using a schema given to me by a third part company.
    the business process requires that our company sends a weekly file which complies with their schema.
    in real-life, i am expecting some details of our file to fail against their schema.
    thus i would like to find a way validating the file localy before sending it to this third part.
    this validation would ideally allow me to highlight and identify which records are failing the validation, and enable me to strip those and send only those that are successfully checked.
    on the example below, i would expect to have the record for John Smith to be successful (country has an integer); while Queen Victoria would fail as it uses UK instead of an integer to identify the country.
    thus i would need to find a way validating this XML file, move the record of Queen Victoria to another file to be fixed and to allow, the record for John Smith to be sent out.
    if you guys could post some links to where i can find further information on this type of processing, i would be most grateful.
    Many thanks,
    Nicolas
    using an example from:
    [http://www.codeguru.com/csharp/csharp/cs_data/xml/article.php/c6737]
    XSD
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="address">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="name" type="xs:string"/>
    <xs:element name="street" type="xs:string"/>
    <xs:element name="city"type="xs:string"/>
    *<xs:element name="country"type="xs:integer"/>*
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>XML
    <address>
    <name>John Smith</name>
    <street>109 Abbey Close</street>
    <city>Hayes</city>
    <country>98</country>
    </address>
    <address>
    <name>Queen Victoria</name>
    <street>1 Regent Street</street>
    <city>London</city>
    <country>UK</country>
    </address>Edited by: www.jegue.net on Jan 13, 2009 9:48 AM
    Edited by: www.jegue.net on Jan 13, 2009 9:49 AM

    i would need to find a way validating this XML file, move the record of Queen Victoria to another file to be fixed and to allow, the record for John Smith to be sent out.I don't think any automated tool or API available with such features. You should achieve this by some tricky logic/code.

  • XML Validation with XSD in java mapping

    Hi experts,
    I have created an interface to send differents messages between bussines system, the bussiness system receiver is put in the message, to get this value I have a configuration file indicating the path of this field for each message type. In a java mapping I transform the message sent in this structure:
    <document>
    <message>HERE THE MESSAGE AS STRING</message>
    <parameters>
    <sender>HERE SENDER BUSSINESS SYSTEM</sender>
    <receiver>HERE RECEIVER BUSSINESS SYSTEM</receiver>
    </parameters>
    </document>
    the messaging interface works fine, but now I have to validate the XML vs XSD. I need doing in a java mapping because the messaging interface send the message and a email to sender in error case.
    To do this validation I have implemented two java mappings that works fine in my local, the first way is with class Validator of java 5, but my system PI 7.1 return an error with this class. The second way is with SAX parse:
    String schema = "XXXXXxsd";
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    docBuilderFactory.setNamespaceAware(true);
    docBuilderFactory.setValidating(true);
    docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema");
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(schema);
    docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",is);
    in my local works fine but in PI always return OK never fail.
    For this moment the schema is hardcoded to do proofs, in the future will be loaded from my configuration file.
    Any idea?
    Thanks in advance
    Jose

    hi Jose,
    PI 7.1 has a built in feature available called XML vaidations ..
    your source xml can be validated against a XSD placed at a specific location on the PI server..
    validation can be performed at adapter/integration engine
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1?quicklink=index&overridelayout=true

  • XML validation against DTD.. Is it possible?

    Hello all,
    Sorry for what may be a trivial post, but I'll keep it short..
    According to the docs:
    "The Validate XML command will validate the XML against the schema defined in the XML file. This command on the context menu is disabled whenever an XML file does not have an XML namespace defined."
    I'm used to the XML editor retrieving a DTD from somewhere and validating it against that.. is it possible to do this in JDev?

    Unfortunately it's not. We only have support for validating against XML Schemas.
    Rob

  • XML validation against Schema

    Hi,
    We have SAP WebAS 6.20. Can someone help me understand how I can validate XML document against schema in ABAP.
    Thanks,
    Suman

    hi
    u can check the below links
    XML schema in ABAP
    Can i use XSD / XML in Abap Programs
    Regards,
    Naveen

  • Check XML file against XSD? Via XSLT?

    Hello,
    we´re using a 6.20 system (XI not available) and want to check XML files against a XML-schema definition file (xsd).
    Is there a function in 6.20 available for this? Is it possible to use "CALL TRANSFORMATION" for it? I´ve seen other XSLT parser in the internet which are able to check a source XML against an XSD before transforming it to the result XML.
    But is this possible with an 6.20 system?
    Thank you for your help,
    best regards,
    Stefan

    Here is the sample XML and the schema.
    XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <book isbn="0836217462">
    <title>
      Being a Dog Is a Full-Time Job
    </title>
    <author>Charles M. Schulz</author>
    <character>
      <name>Snoopy</name>
      <friend-of>Peppermint Patty</friend-of>
      <since>1950-10-04</since>
      <qualification>
        extroverted beagle
      </qualification>
    </character>
    <character>
      <name>Peppermint Patty</name>
      <since>1966-08-22</since>
      <qualification>bold, brash and tomboyish</qualification>
    </character>
    </book>
    XSD:
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="book">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="title" type="xs:string"/>
            <xs:element name="author" type="xs:string"/>
            <xs:element name="character" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="name" type="xs:string"/>
                  <xs:element name="friend-of" type="xs:string" minOccurs="0"
                          maxOccurs="unbounded"/>
                  <xs:element name="since" type="xs:date"/>
                  <xs:element name="qualification" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="isbn" type="xs:string"/>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    - Suman

  • Question about XML validation against schema

    My question is probably a basic one about XML. I tried PurchaseOrder example from the book "J2EE Web Services" by Richard Monson-Haefel. A simplified version as followings -
    Address.xsd -
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/Address"
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <element name="address" type="addr:USAddress" />
    <complexType name="USAddress">
    <sequence>
    <element name="name" type="string" />
    <element name="street" type="string" />
    <element name="city" type="string" />
    <element name="state" type="string" />
    <element name="zip" type="string" />
    </sequence>
    </complexType>
    </schema>
    PurchaseOrder.xsd -
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:po="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:ad="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <import namespace="http://xml.netbeans.org/schema/Address" schemaLocation="Address.xsd" />
    <element name="purchaseOrder" type="po:PurchaseOrder" />
    <complexType name="PurchaseOrder">
    <sequence>
    <element name="accountName" type="string" />
    <element name="accountNumber" type="unsignedShort" />
    <element name="shipAddress" type="ad:USAddress" />
    <element name="total" type="float" />
    </sequence>
    <attribute name="orderDate" type="date" />
    </complexType>
    </schema>
    Then PurchaseOrder.xml is -
    <purchaseOrder orderDate="2007-12-12"
    xmlns='http://xml.netbeans.org/schema/PurchaseOrder'
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:schemaLocation='http://xml.netbeans.org/schema/PurchaseOrder ../xsd/PurchaseOrder.xsd'>
    <accountName>Starwood</accountName>
    <accountNumber>220</accountNumber>
    <shipAddress>
    <name>Data Center</name>
    <street>1501 Washington St.</street>
    <city>Braintree</city>
    <state>MA</state>
    <zip>02148</zip>
    </shipAddress>
    <total>250</total>
    </purchaseOrder>
    Then I did a XML validation but have this error -
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"http://xml.netbeans.org/schema/Address":name}' is expected. [19]
    It complains <name> tag in <shipAddrss> needs namespace of "http://xml.netbeans.org/schema/Address". Why?
    Is it possible to change XML so it does not need name space for elements inside <shipAddress>?
    Thanks

    Hi Madhura,
    see here my comparison of the web version against the local file version on my Windows box (which is itself not the fastest): It makes a factor 16 in difference!
    C:\Temp\xsdvalidator>java XsdValidator madhu.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 16353 ms
    C:\Temp\xsdvalidator>java XsdValidator madhu_local.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 994 ms
    Obviously, the w3c.org domain that you specified as ressource location is very slow - and, as the FAQ shows, this delay is intentional!
    The W3C servers are slow to return DTDs. Is the delay intentional?
    Yes. Due to various software systems downloading DTDs from our site millions of times a day (despite the caching directives of our servers), we have started to serve DTDs and schema (DTD, XSD, ENT, MOD, etc.) from our site with an artificial delay. Our goals in doing so are to bring more attention to our ongoing issues with excessive DTD traffic, and to protect the stability and response time of the rest of our site. We recommend HTTP caching or catalog files to improve performance.
    --> They don't want to have requests to their site from productive servers all around the world.
    Regards,
    Rüdiger

  • XML validating with XSD

    Please clarify the following
    1) To validate a XML output with a XSD is it necessary to register the xsd in the database?.
    2) I tried running the below give command to register the .xsd file. It errored out with the below message. Do we need to some additional installation for having dbms_xmlschema in oracle database or am I missing something. My ver of oracle is 9.2.0.6.0.
    ERROR at line 2:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'DBMS_XMLSCHEMA.REGISTERSCHEMA' must be declared
    BEGIN
    DBMS_XMLSchema.registerSchema(
    schemaurl=>'http://ifsddev.na.abc.com/home/vick/105564/batchuserimport.xsd',
    schemadoc=>sys.UriFactory.getUri('/home/vick/105564/batchuserimport.xsd'));
    END;

    1) You could validate XML files against an XSD by using standard Java, PL/SQL, etc. functionality. Just to validate XML you do not need to register the schema in XDB. See e.g. http://www.oracle.com/technology/pub/articles/vohra_xmlschema.html
    2) Also see: DBMS_XMLSCHEMA.REGISTERSCHEMA' must be declared to know whether XML DB has been installed/configured.
    Regards, Ronald

  • XML validation against DTD

    Hi,
    I have an application that receives XML from an external source. The XML received does not have the XML version and the doc type declaration lines. I want to validate the XML against a DTD.
    One dirty way of doing this is to open the XML received and prepend the XML versions and doctype lines to it. And then parse the XML. But is it the right way to do it?
    What I would like to know is that does the XML parser provide any API which can tell it to validate an XML document against a certain DTD.

    Yes, there is an API to do this. You have to do something like this:
    DocumentBuilderFactory dbf          =DocumentBuilderFactory.newInstance();
    dbf.setValidating(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    XMLErrors eh = new XMLErrors(frame);
    db.setErrorHandler(eh);
    Document doc = db.parse(f);
    (where f is the XML file)
    In this example, the class XMLErrors is used as the ErrorHandler. XMLErrors extends the DefaultHandler class and provides the user with information about the various error levels. A call to the over-ridden "error" method notifies the user (using a Dialog box) that the document doesn't meet the DTD.
    Hope this helps.

  • Get errors of a xml validation from xsd file

    hi everyone,
    i created a xml validation from a XSD file as follow:
    public String validate(String xml) {
            String saida = "";
            InputStream xsd = XmlValidator.class.getResourceAsStream("shiporder.xsd");       
            try {
                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                docBuilderFactory.setNamespaceAware(true);
                DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
                ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes());
                Document doc = docBuilder.parse(is);
                SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                Source schemaFile = new StreamSource(xsd);
                Schema newSchema = (Schema) factory.newSchema(schemaFile);
                Validator validator = newSchema.newValidator();
                validator.validate(new DOMSource(doc));           
                saida = "SUCESSO";
            } catch (DOMException ex) {           
                ex.printStackTrace();
                saida =  "DOM";
            } catch (SAXException ex) {           
                saida = ex.getMessage();
            } catch (IOException ex) {           
                ex.printStackTrace();
                saida =  "IO";
            } catch (ParserConfigurationException ex) {           
                ex.printStackTrace();
                saida = "PARSER_CONFIGURATION";
            return saida;
        }this code works perfectly, but i must change one thing.
    When is found a error on a xml structure, one exception is threw, and then the method is finalized. However i need to show up all errors on one shot.
    Because right now when i run and it find a error, the method throw an exception an stop, so i have to adjust, then execute again and adjust another repeatedly until everything is right, so i have to change that.
    Anyone could help me?
    thanks in advance

    That's the rule for XML validation. As soon as the parser finds an error, it must report it and stop.
    If you are having a lot of trouble creating an XML document which conforms to a schema, perhaps you should invest in one of those XML editors which supports validation as you enter the document.

Maybe you are looking for