How to use Xerces to validate an XML file against a DTD

Hi, can anybody tell me how to use Xerces to validate an XML file against a DTD. its urgent. post some sample code. it would be helpful for my project. isupposed to use SAX parser(Xerces)
Thanx in advance

Come on, I googled "xerces validate" and the first link is the Xerces FAQ:
http://xerces.apache.org/xerces-j/faq-general.html
And of course "how to validate" is a Xerces FAQ. Help yourself by doing a little research instead of waiting for other people.

Similar Messages

  • Validate a XML file against multiple schema files

    Hello everybody!
    How can I validate a XML file against multiple schema files?
    I have the following XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <bulkCmConfigDataFile xmlns:es="SpecificAttributes.3.0.xsd"
                             xmlns:xn="genericNrm.xsd"
    xmlns="configData.xsd">
    <fileHeader fileFormatVersion="32.615 V4.2" vendorName=""/>
    <configData dnPrefix="Undefined">
    <xn:SubNetwork id="3G">
    <xn:SubNetwork id="RNC01">
    <xn:MeContext id="RNC01">
    <xn:VsDataContainer id="RNC01">
    <xn:attributes>
    <xn:vsDataType>vsDataMeContext</xn:vsDataType>
    <xn:vsDataFormatVersion>SpecificAttributes.3.0</xn:vsDataFormatVersion>
    <es:vsDataMeContext>
    <es:userLabel>RNC01</es:userLabel>
    <es:ipAddress>172.21.3.17</es:ipAddress>
    <es:neMIMversion>vF.5.0</es:neMIMversion>
    </es:vsDataMeContext>
                                  </xn:attributes>
    </xn:VsDataContainer>
    </xn:MeContext>
    </xn:SubNetwork>
    </xn:SubNetwork>
    </configData>
    <fileFooter dateTime="2006-11-24T11:56:07Z"/>
    </bulkCmConfigDataFile>
    I want to load this file into a table, validate it (against SpecificAttributes.3.0.xsd, genericNrm.xsd and configData.xsd) and query that table. How would the INSERT .. and the SELECT ... for userLabel attribute look like?
    Many thanks!

    Hi Peter,
    Please use the validateXML BPEL Property : This property validates incoming and outgoing XML documents. If set to true, the Oracle BPEL Process Manager applies schema validation for incoming and outgoing XML documents. This property is applicable to both durable and transient processes. The default value is false.
    Cheers
    A

  • Best way to validate and xml file against a schema?

    As the subject states, I want to validate my xml file against a given schema....
    Currently my code looks like this:
    InputSource ipSource = new InputSource(new ByteArrayInputStream(bytesData)); // my xml file
    DOMParser parser = new DOMParser();
    parser.parse(ipSource);
    Document doc = parser.getDocument();
    I see that there is a setFeature method on DomParser.... but from what I read that doesnt support
    xml schema's, just DTD's. So what is the best way to validate with schema's?
    Any help would be appreciated

    This is the other way I tried doing it.... the problem with this way is I am building my xml file through DOM
    operations... and I haven't figured out how to add the schema line to the xml file through DOM manipulations.
    Has anyone done this bofore?
    try
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(false);
         factory.setValidating(true);
         InputSource ipSource = new InputSource(new ByteArrayInputStream(bytesData));
         DocumentBuilder builder = factory.newDocumentBuilder();
         doc      = builder.parse(ipSource);
         return doc;
    catch(Throwable t)
         System.out.println("parse error: " +t);
    return doc;
    }

  • How to use JAXP to print a xml file?

    I know that in ProjectX, there is a class called XmlDocument, it can print a xml document. But in JAXP , I cannot find a class like XmlDocument, then how to print a xml file?
    Thanks a lot!

    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(new DOMSource(doc), new StreamResult(new FileOutputStream("c:/temp/myJollyDoc.xml", false)));

  • How to use requestScope in faces-config.xml file?

    a managed-bean need get value from request as its property
    so i configure the manged-bean as below:(use requestScope object)
    <managed-bean>
    <description>this is for item test bean.</description>
    <managed-bean-name> item </managed-bean-name>
    <managed-bean-class> test.Item </managed-bean-class>
    <managed-bean-scope> request </managed-bean-scope>
    <managed-property>
    <property-name>id</property-name>
    <value-ref>requestScope.id</value-ref>
    </managed-property>
    </managed-bean>
    but it didnot work.
    after i restart tomcat with above configure file, it report
    HTTP Status 404 error.
    and seemed that the context donot start...
    if i change the line
    <value-ref>requestScope.id</value-ref>
    to:
    <value>7</value>
    then everything will be OK...but this isnot fit my require.
    any body can help me?
    I use JSF 1.0 beta.

    Rather than starting a new thread, I thought I'd just add on to this one, since it already lays the grounds for my question. I'm using the
    I noticed that my setId() method is being called once during the ApplyRequestValuesPhase, and then again in the UpdateModelValuesPhase. The first time, it sets the ID to null, despite the fact that I'm posting an id to the page. When it comes around the second time, it sets the id properly, and the data is loaded from the database and everything works great. If I'm not posting anything to the page, it is only hit once and the value is null.
    Normally I wouldn't fuss over such small things like this, but there's a bit of a probelm. I have a few buttons which are rendered based on this id. If the id is zero (i.e. null or empty string is passed into the setId() method), I want the add button to appear, else I want the update/delete/cancel buttons to appear. If any of these buttons are false after the ApplyRequestValuesPhase, the button's action will not be executed. In other words, when I'm editing an entry and I press the update button the life cycle goes a little like this...
    Object constructed
    ApplyRequestValuesPhase calls setId(null),add button to be rendered, update/delete/cancel to not be rendered
    // the call to save() is not queued up! (save() is the method associated with the action of my update button)
    UpdateModelValuesPhase calls setId("34"), data loaded from database, add button is not to be rendered, update/delete/cancel are to be rendered
    Since save() is never called, it renders the data loaded from the database, and the update/delete/cancel buttons are shown. So, from the user's perspective... nothing happened other than a page refresh. A.k.a. the update button is broken!
    I can, of course, choose to not update the boolean flags which determine if the buttons are rendered or not when setId() is called with a null. Since the default is to render everything (which was a decision specifically to avoid the buttons not being rendered in the early stages of the JSF life cycle, and the action not being executed). That works when I post an id to the page because it's called a second time and the correct buttons are rendered. The problem is when no parameters are given... it isn't called a second time, so it renders all buttons when I only want it to render the add button.
    So how can I get the values to post during the ApplyRequestValuesPhase? I thought that would be how it would work, but apparently not. Anyone know why it explicitly sets the id to null the first time aroud?
    Here's all you should need...
        <managed-bean>
            <managed-bean-name>dropdownEntry</managed-bean-name>
            <managed-bean-class>org.dc949.bugTrack.DropdownEntry</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
            <managed-property>
                <property-name>id</property-name>
                <value>#{param.id}</value>
            </managed-property>
        </managed-bean>
        public void setId(String id) {
            try {
                this.id = Long.parseLong(id);
                load();  // loads data from DB
            } catch(Exception e) {
                if(id != null && !id.equals(""))
                    log.warn("Unable to convert id from String to long ("+id+")", e);
            if(id != null) {  // this was my solution while I was frusterated that my save method wasn't being called
                if(this.getIdAsLong() == 0) {
                    this.showAdd = true;
                    this.showUpdate = false;
                    this.showDelete = false;
                } else {
                    this.showAdd = false;
                    this.showUpdate = true;
                    this.showDelete = true;
                        <t:div>
                            <h:commandButton id="add" value="Add dropdown entry"
                                             rendered="#{dropdownEntry.showAddButton}"
                                             action="#{dropdownEntry.save}" />
                            <h:commandButton id="update" value="Update dropdown entry"
                                             rendered="#{dropdownEntry.showUpdateButton}"
                                             action="#{dropdownEntry.save}" />
                            <h:commandButton id="delete" value="Delete dropdown entry"
                                             rendered="#{dropdownEntry.showDeleteButton}"
                                             action="#{dropdownEntry.deleteDropdownEntry}" />
                            <h:commandButton id="cancel" value="Cancel"
                                             rendered="#{dropdownEntry.showUpdateButton}"
                                             action="#{dropdownEntry.reset}" immediate="true" />
                        </t:div>I could, and probably will get rid of the showDeleteButton flag and isShowDeleteButton() method and make it like the cancel button since these update/delete/cancel will always be shown/hidden together.
    Edit: Now I feel like a fool. A little clean and build, and it's working perfectly. If any one of the above people read this, I thank you for your help from years past. <img class="emoticon" src="images/emoticons/happy.gif" border="0" alt="" />
    Edited by: AdamNichols on Apr 18, 2008 9:57 PM

  • Validating XML documents against a DTD

    Guys I am new to XML and I have this requirement to validate a XML document against a DTD.This validation has to be done through my java application.In short , a user enters a XML data thru a JSP form ,and moment he presses the SAVE button my java program should validate the XML data against a DTD and then display any error or else save the data into an Oracle table.
    I was wondering lot of program/utitlities must be available out there which will do the validation for me ,rather than me re-inventing the wheel.
    Please advice.
    Thanks
    Manohar.

    You should go through this to learn more on XML with Java :
    http://www.onjava.com/pub/a/onjava/excerpt/learnjava_23/index1.html
    You can check following how to to parse XML doc against a schema
    http://otn.oracle.com/sample_code/tech/java/codesnippet/xdk/SchemaValidation/SchemaValidation.html
    You should also look at chapter 4 of following doc for parsing XML using java :
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96621/toc.htm
    Chandar

  • URGENT---Validating XML file against DTD

    I have a XML & DTD file.I want to validate that xml file against the specified DTD without using any editor.Through program how can i validate?Pl. help me.It's URGENT.

    >
    and i recieved ORA-31001: Invalid resource handle or path name "/testdtd.dtd"
    when the DBMS_XMLPARSER.parseClob( PARSER , v_xml ); is executed
    i removed the <!DOCTYPE family SYSTEM "testdtd.dtd"> from the XML file
    the procedures worked , but not sure if really validated against the DTD file>
    you have to load your DTD into XDB repository.
    <a href ="http://forums.oracle.com/forums/thread.jspa?threadID=416366">How do I use DTD's with XML DB ?
    Ants

  • Can I validate an XML file using an external DTD

    Hi,
    I'm trying to use an external DTD to validate an XML
    file (which does not refer to this DTD). The java docs that ship
    with the XML parser aren't clear on how exactly to do this (or
    whether it can be done). I'd appreciate any advice on how I
    should perform this operation.
    Here's what I'm doing right now.
    1) The Java file
    import oracle.xml.parser.v2.*;
    public class ParseWithExternalDTD
    public static void main(String args[]) throws Exception
    DOMParser dp=new DOMParser();
    dp.parseDTD
    ("file:d:/jdk1.2/sample/test/family.DTD","family");
    DTD dtd=dp.getDoctype();
    dp.setDoctype(dtd);
    dp.parse("file:d:/jdk1.2/sample/test/family.xml");
    System.out.println("Finished with no errors!");
    2) The family.DTD file
    <!ELEMENT family (member*)>
    <!ATTLIST family lastname CDATA #REQUIRED>
    <!ELEMENT member (#PCDATA)>
    <!ATTLIST member memberid ID #REQUIRED>
    <!ATTLIST member dad IDREF #IMPLIED>
    <!ATTLIST member mom IDREF #IMPLIED>
    3) The family.xml file
    <?xml version="1.0" standalone="no"?>
    <family lastname="Smith">
    <TagToFoilParserValidation>
    </TagToFoilParserValidation>
    <member memberid="m1">Sarah</member>
    <member memberid="m2">Bob</member>
    <member memberid="m3" mom="m1" dad="m2">Joanne</member>
    <member memberid="m4" mom="m1" dad="m2">Jim</member>
    </family>
    4) The output
    Finished with no errors!
    As you can see, the DOMParser failed to validate the family.xml
    file against the family dtd otherwise, it would have reported a
    validation error when it came across the
    TagToFoilParserValidation.
    Any insight as to what I'm doing wrong would be much appreciated.
    Sincerely,
    Keki
    Project Iona
    Manufacturing Applications
    Oracle Corporation
    The views and opinions expressed here are
    my own and do not reflect the views and
    opinions of Oracle Corporation
    null

    Keki Burjorjee (Oracle) (guest) wrote:
    : 2 further questions related to this issue.
    : 1) Say I am using XSLT to transform A.xml into B.xml, and I
    : want to embed a reference to B.dtd within the B.xml file. Is
    : there an XSLT command which will allow me to do this?
    : 2) Is it possible for your team to give me a mechanism whereby
    I
    : can preset the xml parser to validate the next xml file (or
    : inputstream) it receives against a particular DTD? This scheme
    : does not require the dtd to be present within the XML file
    : Thanks,
    : - Keki
    : Oracle XML Team wrote:
    : : What you are doing wrong is not including a reference to the
    : : applicable DTD in your XML document. Without it there is no
    : way
    : : that the parser knows what to validate against. Including
    the
    : : reference is the XML standard way of specifying an external
    : : DTD. Otherwise you need to embed the DTD in your XML
    Document.
    : : Oracle XML Team
    : : http://technet.oracle.com
    : : Oracle Technology Network
    : : Keki Burjorjee (guest) wrote:
    : : : Hi,
    : : : I'm trying to use an external DTD to validate an XML
    : : : file (which does not refer to this DTD). The java docs that
    : : ship
    : : : with the XML parser aren't clear on how exactly to do this
    : (or
    : : : whether it can be done). I'd appreciate any advice on how I
    : : : should perform this operation.
    : : : Here's what I'm doing right now.
    : : : 1) The Java file
    : : : import oracle.xml.parser.v2.*;
    : : : public class ParseWithExternalDTD
    : : : public static void main(String args[]) throws Exception
    : : : DOMParser dp=new DOMParser();
    : : : dp.parseDTD
    : : : ("file:d:/jdk1.2/sample/test/family.DTD","family");
    : : : DTD dtd=dp.getDoctype();
    : : : dp.setDoctype(dtd);
    : : : dp.parse("file:d:/jdk1.2/sample/test/family.xml");
    : : : System.out.println("Finished with no errors!");
    : : : 2) The family.DTD file
    : : : <!ELEMENT family (member*)>
    : : : <!ATTLIST family lastname CDATA #REQUIRED>
    : : : <!ELEMENT member (#PCDATA)>
    : : : <!ATTLIST member memberid ID #REQUIRED>
    : : : <!ATTLIST member dad IDREF #IMPLIED>
    : : : <!ATTLIST member mom IDREF #IMPLIED>
    : : : 3) The family.xml file
    : : : <?xml version="1.0" standalone="no"?>
    : : : <family lastname="Smith">
    : : : <TagToFoilParserValidation>
    : : : </TagToFoilParserValidation>
    : : : <member memberid="m1">Sarah</member>
    : : : <member memberid="m2">Bob</member>
    : : : <member memberid="m3" mom="m1" dad="m2">Joanne</member>
    : : : <member memberid="m4" mom="m1" dad="m2">Jim</member>
    : : : </family>
    : : : 4) The output
    : : : Finished with no errors!
    : : : As you can see, the DOMParser failed to validate the
    : : family.xml
    : : : file against the family dtd otherwise, it would have
    : reported
    : : a
    : : : validation error when it came across the
    : : : TagToFoilParserValidation.
    : : : Any insight as to what I'm doing wrong would be much
    : : appreciated.
    : : : Sincerely,
    : : : Keki
    : : : Project Iona
    : : : Manufacturing Applications
    : : : Oracle Corporation
    : : : The views and opinions expressed here are
    : : : my own and do not reflect the views and
    : : : opinions of Oracle Corporation
    1) No XSLT commands exist that allow you to embed a DTD while
    doing the transformation.
    2) You can use the setDocType() method in the parser, to set a
    DTD based on which the XML document will be validated. The
    parseDTD() method allows you to parse a DTD file separately and
    get a DTD object. Here is a sample code :
    DOMParser domparser = new DOMParser();
    domparser.setValidationMode(true);
    // parse the DTD file
    domparser.parseDTD(new FileReader(dtdfile));
    DTD dtd = domparser.getDocType();
    // Parse XML file - XML file will be validated based on the DTD.
    domparser.setDocType(dtd);
    domparser.parse(new FileReader(xmlfile));
    Document doc = domparser.getDocument();
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • How to get the "encoding" of a XML file using JDOM

    As in XML file, <?xml version="1.0" encoding="UTF-8" ?> indicates the encoding of this file
    while using JDOM to parse a XML file, how can I get the encoding type?
    thanx!!!

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

  • How to validate an XML file in BPEL ?

    Hi All,
    I have 2 Bpel processes.
    One for creating supplier and one for formate Validations.
    I am having problems with formate Validations.
    I am trying to validate an xml file that is passed to my Bpel Process (SupplierValidation).
    My process contains the following:
    I have a client which its property Name is set to ValidateXML and its value set to true.
    I have a recieve activity and a reply out !
    very simple process, but its working !
    This process is synchronous.
    Help is needed !
    Thanks,
    aj

    you have to use bpelx:validate as sown below
    <bpelx:validate variables="inputVariable" name="ValidateInputXML"/>

  • Not able to validate the xml document against DTD using SAX

    Hi ,
    i am not able to validate xml document against its DTD using SAX parser even after setting setValidating = true. even if the file is not correct according to DTD , it is not throwing any exception. what could be the reason.? please help..
    kranthi
    this is the code sample i used.
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
         try {
    factory.newSAXParser().parse(new File("sample.xml"), handler);
         } catch (SAXException e) {
         e.printStackTrace();                         System.exit(2);
         } catch (ParserConfigurationException e) {
    e.printStackTrace();
    }

    Hi karthik
    Thanks for your response
    Actually iam a beginner in java coding hence struggling to come up with the things
    I tried putting your code and onserver side i see it is returning 09:12:17,234 INFO [STDOUT] [root: null]
    actually the same program i wrote in java
    and the same method i was calling from the main
    and it is working fine and the xml document is getting displayed one important thing to be noted here is that the factory.newDocumentBuilder().parse(new File(filename));is returing XmlDocument
    and the printing takes place
    but the in same method public static Document parseXMLFile(String filename, boolean b) in servlet
    the line factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    and this creating problem , had it returned XmlDocument
    i would have printed the elements one one
    but as it is returning deferredimpl
    iam unable to print the elements
    could you please tell me why factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    in servlets but in plain java pogram it is returing XmlDocument
    Thanks
    Bhanu

  • How to validate the Xml File With Java

    Hi,
    Can pls tell me. I want to validate the XML File for the Some Mandartory TAG. if that if Tag null i want to generate error xml file with error and i want move another folder with java. pls help me as soon as possible

    Use a validating parser (any recent Xerces, for one) and switch on the validation feature. Very much vendor-specific, so look at the docs of your parser. Oh, you do have a schema for these documents, don't you?

  • How to use XMLEncoder to save Complicated XML??

    I think I posted in an improper forum: java programming, so repost here. Please excuse me.
    Dear friends, good weekend and happy thanksgivings.
    I met a problem when I use XMLEncoder to generate a complicated XML like following:
    <?xml version="1.0"?>
    <messages>
      <note ID="501">
        <to>Tove</to>
         <DeliveryAddress>
              <Street>12345</Street>
              <City>Parsinpany</City>
              <County>ABC</County>
              <State>NJ</State>
              <Country>USA</Country>
             </DeliveryAddress>
         <ContactID>
              <CompanyID>
                   <Address>12345</Address>
                   <City>Alnomre</City>
                   <County>BBB</County>
                   <State>TX</State>
                   <Country>USA</Country>
                  </CompanyID>
              <phone>1800-1234567</phone>
              <fax>123-456-7890</fax>
             </ContactID>
        <from>Jani</from>
        <heading>Reminder</heading>
        <body>Don't forget me this weekend!</body>
      </note>
      <note ID="502">
        <to>Jani</to>
        <from>Tove</from>
        <heading>Re: Reminder</heading>
        <body>I will not!</body>
      </note>
    </messages>How to use XMLEncoder to generate abobe XML or one that has namespaces in it??
    I can use simple
    XMLEncoder o = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(filename)));
                                  o.writeObject(mm.getBounds());     //get all position;
    but cannot generate above complicated XML.
    What is the right way to do it??
    any good example??
    Thanks

    My question is also how to use XMLEncoder to create attributes and and namespace, add child nodes to its parent, or remove nodes from their parent etc
    Thanks

  • How to write the nodevalue back to xml file?

    Hi, Everybody:
    These are two packages I used. javax.xml.parsers.*,org.w3c.dom.*
    Now I use "setNodeValue("abc") to set the node value to "abc". But it is not really saved back into XML file. It only change the node value in memory.
    How to write the changes back to XML file? Thank you very much for your help.
    Michelle

    * Version : 1.00
    * File Purpose : Given the xml file loads into dom and recreate the file with the updated values.
    * Developer : Kashif Qasim : 25/july/04
    * Modify detail :
    import java.lang.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import org.w3c.dom.*;
    import org.apache.xerces.parsers.DOMParser;
    import org.apache.xerces.*;
    public class XMLWriter
    private String displayStrings[] = new String[5000];
    private int numberDisplayLines = 0;
    private Document document;
    //private final Node c;
    public synchronized void displayDocument(String uri,Vector UpdatedValues,String getTaskID)
    try {
    DOMParser parser = new DOMParser();
    parser.parse(uri);
    document = parser.getDocument();
    display(document, "",UpdatedValues);
    } catch (Exception e) {
    e.printStackTrace(System.err);
    ReadXmlConfig objReadXmlConfig = null;
    FileWriter filewriter = null;
    try {
    filewriter = new FileWriter(uri);
    for(int loopIndex = 0; loopIndex < numberDisplayLines; loopIndex++){
    filewriter.write(displayStrings[loopIndex].toCharArray());
    //System.out.println("displayStrings[loopIndex].toCharArray() "+displayStrings[loopIndex].toString());
    //filewriter.write("\n");
    filewriter.close();
    System.gc();
    objReadXmlConfig = new ReadXmlConfig();
    objReadXmlConfig.ITSLog("File updated for "+getTaskID+" succesfully, file is closed now ");
    } catch (IOException e) {
    System.err.println("Caught IOException: " + e.getMessage());
    objReadXmlConfig = new ReadXmlConfig();
    objReadXmlConfig.ITSErrorLog("File updated FAILED for "+getTaskID+". Reason for file error "+e.toString());
    }finally {
    if (filewriter != null) {
    System.out.println("Closing File");
    objReadXmlConfig =null;
    try{
    filewriter.close();
    }catch(IOException e){
    System.err.println("Caught IOException: " + e.getMessage());
    } else {
    System.out.println("File not open");
    private void display(Node node, String indent, Vector UpdtRecs)
    if (node == null) {
    return;
    int type = node.getNodeType();
    NodeList nodeList = document.getElementsByTagName("QueryParm");
    int TotalRecs = UpdtRecs.size();
    switch (type) {
    case Node.DOCUMENT_NODE: {
    displayStrings[numberDisplayLines] = indent;
    displayStrings[numberDisplayLines] +=
    "<?xml version=\"1.0\" encoding=\""+
    "UTF-8" + "\"?>";
    numberDisplayLines++;
    displayStrings[numberDisplayLines] += "\n";
    display(((Document)node).getDocumentElement(), "",UpdtRecs);
    break;
    case Node.ELEMENT_NODE: {
    if(node.getNodeName().equals("QueryParm")) {
    for(int i =0 ; i< nodeList.getLength() ; i++)
    Node nodeQry = nodeList.item(i);
    NamedNodeMap nnp = nodeQry.getAttributes();
    for(int j= 0 ; j < nnp.getLength() ; j++)
    Attr atr = (Attr) nnp.item(j);
    if(atr.getName().equalsIgnoreCase("value_"+(i+1)))
    //System.out.println(atr.getName() +" : " + atr.getNodeValue() );
    atr.setNodeValue(UpdtRecs.get(i).toString());
    displayStrings[numberDisplayLines] = indent;
    displayStrings[numberDisplayLines] += "<";
    displayStrings[numberDisplayLines] += node.getNodeName();
    int length = (node.getAttributes() != null) ?
    node.getAttributes().getLength() : 0;
    Attr attributes[] = new Attr[length];
    for (int loopIndex = 0; loopIndex < length; loopIndex++) {
    attributes[loopIndex] = (Attr)node.getAttributes().item(loopIndex);
    for (int loopIndex = 0; loopIndex < attributes.length; loopIndex++) {
    Attr attribute = attributes[loopIndex];
    displayStrings[numberDisplayLines] += " ";
    displayStrings[numberDisplayLines] += attribute.getNodeName();
    displayStrings[numberDisplayLines] += "=\"";
    displayStrings[numberDisplayLines] += attribute.getNodeValue();
    displayStrings[numberDisplayLines] += "\"";
    displayStrings[numberDisplayLines]+=">";
    numberDisplayLines++;
    NodeList childNodes = node.getChildNodes();
    if (childNodes != null) {
    length = childNodes.getLength();
    indent += " ";
    for (int loopIndex = 0; loopIndex < length; loopIndex++ ) {
    display(childNodes.item(loopIndex), indent,UpdtRecs);
    break;
    case Node.CDATA_SECTION_NODE: {
    displayStrings[numberDisplayLines] = "";
    displayStrings[numberDisplayLines] += "<![CDATA[";
    displayStrings[numberDisplayLines] += node.getNodeValue();
    displayStrings[numberDisplayLines] += "]]>";
    numberDisplayLines++;
    break;
    case Node.TEXT_NODE: {
    displayStrings[numberDisplayLines] = "";
    String newText = node.getNodeValue().trim();
    if(newText.indexOf("\n") < 0 && newText.length() > 0) {
    displayStrings[numberDisplayLines] += newText;
    displayStrings[numberDisplayLines] += "\n";
    numberDisplayLines++;
    break;
    case Node.PROCESSING_INSTRUCTION_NODE: {
    displayStrings[numberDisplayLines] = "";
    displayStrings[numberDisplayLines] += "<?";
    displayStrings[numberDisplayLines] += node.getNodeName();
    String text = node.getNodeValue();
    if (text != null && text.length() > 0) {
    displayStrings[numberDisplayLines] += text;
    displayStrings[numberDisplayLines] += "?>";
    displayStrings[numberDisplayLines] += "\n";
    numberDisplayLines++;
    break;
    if (type == Node.ELEMENT_NODE) {
    displayStrings[numberDisplayLines] = indent.substring(0,
    indent.length() - 4);
    displayStrings[numberDisplayLines] += "</";
    displayStrings[numberDisplayLines] += node.getNodeName();
    displayStrings[numberDisplayLines] += ">";
    displayStrings[numberDisplayLines] += "\n";
    numberDisplayLines++;
    indent += " ";
    public static void main(String args[])
    Vector xmlValue = new Vector();
    xmlValue.add(0,"Kashif");
    xmlValue.add(1,"Qasim");
    //displayDocument("NewMediation.xml",xmlValue);
    <?xml version="1.0" encoding="UTF-8"?>
    <Mediation>
    <Task1>
    <Source>
    <SourceDriver>com.microsoft.jdbc.sqlserver.SQLServerDriver</SourceDriver>
    <SourceConnection>jdbc:microsoft:sqlserver://10.2.1.58:1433;DatabaseName=MTCVB_HDS;</SourceConnection>
    <SourceUser>sa</SourceUser>
    <SourcePassword>sa</SourcePassword>
    <Table>
    <SourceTable>t_Agent</SourceTable>
    <SourceQuery><![CDATA[SELECT SkillTargetID,PersonID,PeripheralID,EnterpriseName,PeripheralNumber,Deleted,TemporaryAgent,AgentStateTrace,ChangeStamp FROM t_Agent where SkillTargetID > {value_1} order by SkillTargetID]]>
    </SourceQuery>
    <SourceParm BusinessRule="" ColumnName="SKILLTARGETID" ColumnNumber="1" DataType="Numeric" DefaultValue="0" Format="mm/dd/yyyy xx:xx:xx XX">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="PERSONID" ColumnNumber="2" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="PERIPHERALID" ColumnNumber="3" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="ENTERPRISENAME" ColumnNumber="4" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="PERIPHERALNUMBER" ColumnNumber="5" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="DELETED" ColumnNumber="6" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="TEMPORARYAGENT" ColumnNumber="7" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="AGENTSTATETRACE" ColumnNumber="8" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <SourceParm BusinessRule="" ColumnName="CHANGESTAMP" ColumnNumber="9" DataType="String" DefaultValue="" Format="">
    </SourceParm>
    <QueryParm FldName_1="SkillTargetID" FldType_1="Number" value_1="0">
    </QueryParm>
    </Table>
    </Source>
    </Task1>
    </Mediation>
    The QueryParm values are updated thru this code :)
    Hope it helps u ...

  • Create a Purchase order using the BAPI using the data in the XML file.

    Hello Gurus,
    here is the scenario can anyone help me how to proceed explaining the procedure?
    Create a Purchase order using the BAPI using the data in the XML file.
    comprehensive explanations are appreciated.
    thanks in advance.

    hi,
      first use fm "bapi_po_create".
      then use fm "BAPI_ACC_GL_POSTING_POST"
    The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
    •     No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
    •     In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
    •     A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM).

Maybe you are looking for

  • BAPI_CUSTOMERQUOTATION_CHANGE for changing VC info

    Hello ABAPers: I am using BAPI_CUSTOMERQUOTATION_CHANGE for changing Variant Configuration information on quotes. I am filling the table quotation_item_inx with quotation_item_inx-UPDATEFLAG = 'U'  quotation_item_inx-CONFIG_ID = 'X' and other VC tabl

  • Generate warning on Delivery date

    Hello Everybody, We are on SRM 550 R3 ECC 6.0 classic scenario. As our requisitioners often forget to enter a correct delivery date we want to implement a warning when they are creating the shopping cart. plan is to delete the default of today date s

  • How to print a doc using  Reader 11.0.3.37

    I am unable to print a document using Adobe Reader 11.0.3.37. Any ideas about how to do so?

  • Employee master change pointer

    Hello All, I need to send emplyee data like emp-no, name, email, phone, title etc from SAP system to a 3rd partysystem. Would it be advisable to use Change pointers or a custom Z* program which would pick data and send it to 3rd party. I am using XI

  • Obiee

    Hi team, What are the errors that we can found other than the odbc error in obiee can please share the answer for this quesion as erly as posibble Edited by: 799666 on Nov 18, 2010 1:56 AM