Identifying an XML document type

I am reading XML message off a queue using JMS and I want to determine the XML document type so I can use the proper schema for validation. Since different XML documents will be coming in off the same queue I need to determine the document type so I can use the proper schema for validation.
Is there a good way to do this? So far I have been doing the following but I am looking for a better solution:
*Use the JMS headers to store the XML message type.  Not always possible.
*Read the first few lines of the XML as a file and parse for the root node or .xsd.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

What I am refering to is a situation where I have one queue that has multiple incoming XML documents.
For example:
PurchaseOrder.xml needs to be read off a queue validated via PurchaseOrder.xsd
PartsOrder.xml needs to be read off the same queue and validated with PartsOrder.xsd. I am trying to find and eloquent solution to identify if I have a PartsOrder or a PurchaseOrder, so I can set the proper schema for validation when parsing the XML doc.

Similar Messages

  • How to identify the po documnet type in automatic creation of po shipment

    hai experts
             we are facing some problem in transportation proess. For us automatic po is not generated we checked all confiuration settings we could't find out that .  how can we identify what po document type
    is linked to this process . can u please give the best soltuion for this
    thank you
    ravi kumar
    09003290189

    hi,
    Go to SE16 enter the table name for P.O. : EKKO
    enter the p.o no -you can check the document type there
    Regards
    G.Ganesh Kumar

  • Document types - wildcard support?

    My understanding of iFS is that I can define an XML document type, and after that any documents of that type would be automatically parsed for me. In another message there was a note that currently wildcards aren't supported. I'm not clear on this. How about this example: I have an XML document 'order.xml', that I 'define' into iFS. Subsequently any documents called order.xml will be parsed - right?
    ok, but what wouldn't work is sending documents called order100.xml, order101.xml... because I'd have to define the format for each one? Right?
    Thanks! I can't get the *()& thing to work, so I'm going at this by just reading.

    Wildcards don't work in the Parser mapping tables. Eg you cannot map x* to a particular parser.

  • Oracle Fusion Middleware 11G  B2B Document Type not getting Identified

    Hello,
    I have installed Oracle Fusion Middleware 11g on my local machine and created a custom document type with proper .xsd definition and XPath Expression Identifier in Oracle B2B interface and configured its trading partners ( Host & Remote ) along with an agreement between the partners.
    I have also configured the host listening channel of Generic-File type which picks xml files from my c:\orclsrvs_in folder.
    My problem is that the moment I drop any sample file in the expected directory, it gets picked up from B2B , but there isn't any record of the same under Reports and Metrics links.
    The Business message, Application message and Conversation message tabs are also not showing any information about the record picked, but in wire message tab, the record is shown in PROCESSING state.
    I am not able to conclude whats wrong behind this.. where can i track the logs for the same ??
    kindly help to resolve this issue.
    Thanks & Regards
    Hiteshkumar Chaudhary

    Hi Hitesh,
    i came to know that B2B extracts the TP name from the filename itselfYes, in case of Generic File, Generic SFTP and Generic FTP, file name provides the necessary values to Oracle B2B to identify the Trading Partner. You can define your own file name format in the Delivery Channel under Transport Protocol Parameters in field "Filename format" (It's an optional field but it is always good to define your own format, otherwise B2B will take it's default format - TradingPartner_DocumentType_Revision_msgType_msgId_replytoMsgID_extension.xml ). Following Filename formats can be used -
    %FROM_PARTY%
    %TO_PARTY%
    %DOCTYPE_NAME%
    %DOCTYPE_REVISION%
    %MSG_ID%
    %TIMESTAMP%
    These file name formats can be used in any combination; for example,
    %TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%.dat
    Note - Any file extension is allowed.
    what are the system parameters to be set in weblogic console and how?? This activity is part of the pre and post installation steps. If you have done those without getting any errors then nothing else is required.
    how shall I reinstall XEngine properly ??XEngine is part of B2B installation. If B2B gets installed without flashing any errors then we assume that other components of this part has installed properly.
    Regards,
    Anuj
    Edited by: Anuj Dwivedi, Infosys on Aug 28, 2009 5:51 PM

  • B2B Custom Document Type not getting identified

    Hello,
    I have installed Oracle Fusion Middleware 11g on my local machine and created a custom document type with proper .xsd definition and XPath Expression Identifier in Oracle B2B interface and configured its trading partners ( Host & Remote ) along with an agreement between the partners.
    I have also configured the host listening channel of Generic-File type which picks xml files from my c:\orclsrvs_in folder.
    My problem is that the moment I drop any sample file in the expected directory, it gets picked up from B2B , but there isn't any record of the same under Reports and Metrics links.
    The Business message, Application message and Conversation message tabs are also not showing any information about the record picked, but in wire message tab, the record is shown in PROCESSING state.
    I am not able to conclude whats wrong behind this.. where can i track the logs for the same ??
    kindly help to resolve this issue.
    Thanks & Regards
    Hiteshkumar Chaudhary

    Hi Hitesh,
    i came to know that B2B extracts the TP name from the filename itselfYes, in case of Generic File, Generic SFTP and Generic FTP, file name provides the necessary values to Oracle B2B to identify the Trading Partner. You can define your own file name format in the Delivery Channel under Transport Protocol Parameters in field "Filename format" (It's an optional field but it is always good to define your own format, otherwise B2B will take it's default format - TradingPartner_DocumentType_Revision_msgType_msgId_replytoMsgID_extension.xml ). Following Filename formats can be used -
    %FROM_PARTY%
    %TO_PARTY%
    %DOCTYPE_NAME%
    %DOCTYPE_REVISION%
    %MSG_ID%
    %TIMESTAMP%
    These file name formats can be used in any combination; for example,
    %TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%.dat
    Note - Any file extension is allowed.
    what are the system parameters to be set in weblogic console and how?? This activity is part of the pre and post installation steps. If you have done those without getting any errors then nothing else is required.
    how shall I reinstall XEngine properly ??XEngine is part of B2B installation. If B2B gets installed without flashing any errors then we assume that other components of this part has installed properly.
    Regards,
    Anuj
    Edited by: Anuj Dwivedi, Infosys on Aug 28, 2009 5:51 PM

  • Problem to validate XML document if the type of root element is abstract

    I have the following XML document:
    <?xml version="1.0" encoding="UTF-8"?>
    <ct013/>
    It corresponds to the following XSD Schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:element name="ct013" type="foo"/>
         <xs:complexType abstract="true" name="foo"/>
         <xs:complexType name="fixedType">
              <xs:complexContent>
                   <xs:restriction base="foo"/>
              </xs:complexContent>
         </xs:complexType>
    </xs:schema>
    Please take attention to the fact that the type of root element of that BDD is abstract.
    XML Schema provides a mechanism to force substitution for a particular element or type. When an element or type is declared to be "abstract", it cannot be used in an instance document. When an element is declared to be abstract, a member of that element's substitution group must appear in the instance document. When an element's corresponding type definition is declared as abstract, all instances of that element must use xsi:type to indicate a derived type that is not abstract.
    Declaring an element as abstract requires the use of a substitution group. Declaring a type as abstract simply requires the use of a type derived from it (and identified by the xsi:type attribute) in the instance document.
    For more information of using abstract types please see chapter 4.7 Abstract Elements and Types of XML Schema Part 0: Primer Second (http://www.w3.org/TR/xmlschema-0/#abstract).
    In this case there is Oracle bug when I try to validate this XML document using Oracle XDK:
    String validate(String xml, String schema)
    throws XSDException, XMLParseException, SAXException, IOException
    System.setPropert("oracle.xml.parser.debugmode", "true");
    XSDValidator xsdValidator = new XSDValidator();
    XMLError xmlError = new XMLError();
    xmlError.setErrorHandler(new DocErrorHandler());
    XMLDocument xmlDocument = parseXMLDocument(xml);
    XMLDocument schemaXMLDocument = parseXMLDocument(schema);
    XMLSchema xmlSchema = (XMLSchema) new XSDBuilder().build(schemaXMLDocument, null);
    xsdValidator.setError(xmlError);
    xsdValidator.setSchema(xmlSchema);
    xsdValidator.validate(xmlDocument);
    return getValidationError(xsdValidator);
    I get the following error:
    Can't find resource for bundle oracle.xml.mesg.XMLResourceBundle, key XSD-2046.
    I tried to validate this XML document using two other libraries - XSD Schema Validator (http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx) and xsdvalid-29 (http://www.w3.org/XML/Schema#XSDValid). Both libraries pointed me on the error that the type of root element is abstract and it cannot be used for doing validation.
    I think that Oracle should return me explaining message but not to throw exception.
    Am I right? Is there really Oracle bug or I miss something?
    Any help, hits, advices would be gratfully apriciated.

    Define Element1 as follows:
    <xs:element name="Element1">
    <xs:complexType>
    <xs:complexContent>
    <xs:restriction base="xs:string"/>
    </xs:complexContent>
    </xs:complexType>
    </xs:element>
    Does the XML document get validated if the element is specified as
    <Element1></Element1>

  • Adding XML Declaration and Document Type Declaration.

    I'm using Oracle's XML Class Generator C++ version 1.0.2.0.0. I can create classes from a defined external DTD and create my XML document. But the document does not contain the XML Declaration <?xml version='1.0?> nor does it contain the Document Type Declaration <!DOCTYPE root-element-name SYSTEM "system-identifier">. What do I need to do to get these as part of my XML document? Does the class generator have methods to do this? Could someone show me an example?

    If you invoke the print method on the top-level ELEMENT, you get
    just the body of the document with no DTD or XMLDecl. if you invoke
    print on the top level NODE (the DOCUMENT node), then the output
    document will contain the XMLDecl and DTD.
    So please try to print from DOCUMENT node.

  • Identify individual elements in repeated elements in an XML document

    Hello,
    I'd like to identify individual elements in repeated elements in an XML document.
    For example a table 'dataXML' which has a column 'sample' (XMLType). If I have an XML document such as,
    <ELEMENT>
    <PO>
    <PONO>100</PONO>
    <PONO>200</PONO>
    </PO>
    </ELEMENT>
    I can use //PONO[1] to identify the first "PONO" element (with value 100) and //PONO[2] to identify the second "PONO" element in the document.
    If I write this query:
    select L.sample.extract('ELEMENT/PO/PONO/text()')).getStringVal()"SAMP"
    from dataXML L
    I'll receive this result:
    SAMP
    100200 (the first row)
    And if I write this query:
    select L.sample.extract('ELEMENT/PO/PONO[1]/text()')).getStringVal()"SAMP"
    from dataXML L
    I'll receive this result:
    SAMP
    100 (the first row)
    But I'd like the following result:
    SAMP
    100 (the first row)
    200 (the second row).
    Could you help me, please?
    Thank you very much.
    Melissa Lemos

    you have to use something like this.
    select extractvalue(xmltype_column, '/Name/@attributename')
    from table_name
    For more details see
    XMLDB Developers Guide (Oracle 9i)
    Chapter - XPATH and namespace Primer
    Table C2 - Location Path Examples Using Abbreviated Syntax.
    Page Number 907/1044
    Hope this helps.

  • List all documents types in a XML file...

    Hi, i want to list all document files that are on the portal and make a XML file with result. I found the Interface Query where i can use "search" method. Is there a way to use the APIs from hyperion, i try to do a servlet and obtain a list of all document type like with NAME, DATE CREATED, TYPE, UUID, DESC, etc.. The list can be order by NAME, DATE, etc... And put the result in a XML file. Is it possible to do this with that Hyperion API, or i spend my time to find the solution with this restricted/limited APIs? And first, is there a documentation for the developpers on what we can do with API's Hyperion? The JavaDoc Hyperion just give a little bit information, nothing consisting!! Thanks in advance for any help : [email protected]!Max

    hello
    you can rename the wsp with a.rar or a.cab extension and take a look inside
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

  • Help - Inserting an XML document into a Oracle 8i Column (CLOB Type)

    Hi JavaGurus,
    I am looking for a simple java code which will take my XML document as input and insert the same into a Oracle 8i database's column which is of type CLOB.
    Insert statement won't work and I can not use SQL Loader.
    Any one?
    JK

    Maybe you can adapt some of the code in Oracle's "LOB Datatype" example, which is a complete working program that stores and retrieves BLOBs and CLOBs.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.html

  • Japanese characters alone are not passing correctly (passing like ??? or some unreadable characters) to Adobe application when we create input variable as XML data type. The same solution works fine if we change input variable data type to document type a

    Dear Team,
    Japanese characters alone are not passing correctly (passing like ??? or some unreadable characters) to Adobe application when we create input variable as XML data type. The same solution works fine if we change input variable data type to document type. Could you please do needful. Thank you

    Hello,
    most recent patches for IGS and kernel installed. Now it works.

  • Example for calling document type service using a XML

    Hi,
    Can anybody give me some pointers to any examples about Document type webservice
    that is passed an XML document? The service expects a custom java object.
    I am running WLS 7.0 with sp2.
    This is what i have done so far:
    I have created a document type web-service with the following signature
    public CustomReturnObject provideService(customParameter) { }
    The 'customParameter' is based on a "CustomParameter.xsd" and 'CustomReturnObject'
    is based on its schema. I ran the "autotype" to generate the java classes for
    the schema.
    Now, we would like to invoke the service by passing an XML document instead of
    calling it by creating instances of "CustomParameter" java class. Also we would
    like to get the XML represented by "CustomReturnObject" in the client program
    instead of the java object.
    Can anybody help?
    Thanks
    Raghu

    The latest version of WLS is 8.1.
    I think the the "endpoint" needs to be string.
    String endpoint =
    http://RASUBR-2K:7001/SubscriptionServicesWS/SSApplicationService.jws;
    Regards,
    -manoj.
    http://manojc.com
    "Raghu Subramaniam" <[email protected]> wrote in message
    news:[email protected]...
    >
    SAAJ did work!
    But it is not working with the BEA client libraries (WLS 8.0 Beta). I amgetting
    the following exception
    exception ejava.lang.IllegalArgumentException: endpoint shou
    ld be String or URL
    java.lang.IllegalArgumentException: endpoint should be String or URL
    atweblogic.webservice.core.soap.SOAPConnectionImpl.call(SOAPConnectionI
    mpl.java:43)
    at TestMain.main(TestMain.java:51)
    Attached is my test file.
    I used the libraries from Sun's web services kit and it works.
    Is it a known problem? Any fixes?
    Raghu
    "manoj cheenath" <[email protected]> wrote:
    SAAJ will work. You can also use DII client with
    generic type mapping. Check this out:
    http://manojc.com/tutorial/sample27/Main.java
    Regards,
    -manoj
    http://manojc.com
    "Raghu Subramaniam" <[email protected]> wrote in message
    news:[email protected]...
    But how did you call the web service. Did you use the stubs in yourclient
    code?
    We don't want to use the stubs generated from "clientgen". Rather wantto
    call
    the service by passing a XML string that adheres to our schema expectedby
    our
    service. Our service is document-style.
    I am trying to use the SAAJ api to generate a SOAPMessage and callthe
    service.
    Anybody has tried this before. Does it work?
    Raghu
    "Mike DeAngelo" <[email protected]> wrote:
    I just did this the first time a few weeks ago, but I had some
    gotchas...
    >>>>
    First, run the autotype ant task against your xsd file to generateyour
    value
    objects (I think you already did this).
    Second, write your java class or EJB to use the value objects asparameter/return
    type. (I think you did this too.) If you are going to invoke anEJB,
    create
    the EJB-Jar file.
    Third, use the servicegen ant task to create the an ear file. Theear
    file will
    contain both the ejb-jar and file webservice.war which is generatedby
    weblogic.
    Fourth, unbundle the ear file, then unbundle the war file. Edit the
    file WEB-INF/web-service.xml
    Add the contents of your original xsd under the <types> element (iftypes
    doesn't
    exist, it should be the first subelement under the root element).Add
    the contents
    of types.xml (generated by autotype) to the <type-mapping> element(It
    should
    be the second element under the root element.
    Rebundle the war file, rebundle the ear file, and deploy it.
    Here is a fragment of the ant stuff...
    <taskdef name="servicegen"
    classname="weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask"/>
    <target name="check-servicegen" depends="stage">
    <uptodate property="servicegen.notRequired"
    targetfile="${stage}/my_webservice.ear"
    srcfile="${stage}/my_ejb.jar">
    </uptodate>
    </target>
    <target name="servicegen"
    depends="check-servicegen"
    unless="servicegen.notRequired">
    <servicegen destEar="${stage}/my_webservice.ear"
    warName="my_webservice.war">
    <classpath refid="compile.classpath"/>
    <service ejbJar="${stage}/my_ejb.jar"
    targetNamespace="http://foo/bar/baz"
    serviceName="process"
    serviceURI="/process"
    generateTypes="False"
    expandMethods="True"
    style="document">
    </service>
    </servicegen>
    </target>
    Mike
    "Raghu Subramaniam" <[email protected]> wrote:
    Hi,
    Can anybody give me some pointers to any examples about Document
    type
    webservice
    that is passed an XML document? The service expects a custom javaobject.
    I am running WLS 7.0 with sp2.
    This is what i have done so far:
    I have created a document type web-service with the following
    signature
    >>>>>
    public CustomReturnObject provideService(customParameter) { }
    The 'customParameter' is based on a "CustomParameter.xsd" and'CustomReturnObject'
    is based on its schema. I ran the "autotype" to generate the javaclasses
    for
    the schema.
    Now, we would like to invoke the service by passing an XML documentinstead
    of
    calling it by creating instances of "CustomParameter" java class.
    Also
    we would
    like to get the XML represented by "CustomReturnObject" in the client
    program
    instead of the java object.
    Can anybody help?
    Thanks
    Raghu

  • How to set Document Type Declaration of xml Document?

    Hi,
    I am referring to "org.w3c.dom.Document".
    How can we set the Document Type Declaration (DTD) of a document?
    Thanks.

    Hi,
    But when we have to create a document(org.w3c.dom.Document) dynamically, and that document has to be validated against a DTD......How can we do it?
    I am using the following code
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    DOMImplementation domi = builder.getDOMImplementation();
    DocumentType docType = domi.createDocumentType("query", null, "c:\\queryDtd.dtd");
    Document doc = domi.createDocument(null, "query", docType);But this code is not working. Resulting document is not having <!DOCTYPE...> tag
    I have to build a Doument object (not xml file) whose content is as below
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE query SYSTEM "queryDtd.dtd">
    <query id="abc123">
         <data-source-name>EmployeeDB</data-source-name>
         <fields>
                     <field>id</field>
                     <field>name</field>
                     <field>salary</field>
                     <field>joindate</field>
         </fields>
         <fetch-limit>10</fetch-limit>
    </query>

  • XMLTYPE as CLOB storage "inserting large xml document in xml type column"

    Hi All,
    i have a table containing an xml datatype(non schema based)
    i would like to insert a large xml document in it
    but an exception is thrown-->"string literal too long"
    i tried to use bind variables as a solution"prepared statements as i write in java"
    but it didn't work....as xml document is large
    when i tried to change the column type to CLOB,it worked but without xml validataion,
    although the xml type is mapped to a CLOB in storage, xml type couldn't insert the document
    if anyone have a solution plz tell,i needed it urgently
    thanks,in advance :-)

    thx it was very useful :-)
    but i am not having any success getting the following statement working using a JDBC connection pool rather than a hard coded URL connection
    tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    it works with:
    "jdbc:oracle:thin:@server:port:dbname"
    Does NOT work with:
    datasource.getConnection()
    if anyone colud help...

  • Encoding Type XML Document

    Hi,
    I have an XML document which is essentially data pulled from the craigs list website. It contains alot of Ampersands and pound signs and other stuff which i have been told does not follow the UTF-8 encoding which i put in the tag at the top of the document. Could someone tell me what the correct encoding would be so that i can parse the file using the Java DOM parser without it throwing out errors such as;
    Invalid byte 1 of 1-byte UTF-8 sequence.
    Thanks Alot
    Richard.

    Sounds like you don't know too much about XML and encoding. Try reading this tutorial, it's long but it's thorough:
    [http://skew.org/xml/tutorial/|http://skew.org/xml/tutorial/]
    That should take care of the XML part. Now you need to know the Java part: the simple rule is to not create XML documents if you don't know what encoding they will have. Your best bet is to write them using UTF-8 in the first place. I don't know how you're writing the documents but my bet is you're using plain old Java I/O. In that case use an OutputStreamWriter which specifies UTF-8 for the encoding. Here's a link to the Java I/O tutorial if you don't know how to do that:
    [http://java.sun.com/docs/books/tutorial/essential/io/|http://java.sun.com/docs/books/tutorial/essential/io/]

Maybe you are looking for

  • Will the new 10.6.8 update fix SATA3 issues related with 2011 MacBook Pros?

    Will the new 10.6.8 update fix SATA3 issues related with 2011 MacBook Pros?

  • Receiving Error in Shopping Cart : Order Does not exist

    Hi While creating Shopping Cart and click Insert From Clipboard button, I am receiving " Order xxxx does not exist (Item yyy ). Please tell me why I receive this error and what causes and possible fixes to this? Details: The scenario I am doing is I

  • Air Help not a valid option for some projects?

    RH9, multiple projects that are currently deployed as merged webhelp. I opened the project we use as the 'parent' project and was able to change the output to Air, no problem. But when I try to open the other projects that we use as 'child' projects,

  • Blank log in screen (blue screen with clouds)

    Hello, I have already scoured throughout the forums and tried every solution I have seen to no avail. I am running Windows 7, 32 BIT. Internet Explorer 11 The following is a list of procedures I have already tried: -tried to register the javascript .

  • Adobe Flash player 10.1

    I have checked the all the security settings for active EX on my 32 bit IE8. When download manager starts doanload it immediately shows "server error" and stops downloading. How can I overcome this problem? Can any body help please? I have also check