Instance variable to hold the element of a tag in the xml file

Hi I have an xml file that is handled using this parser
<attr id="MY_NAME" >
this parser hanled the above tag but now I want to have it handle
<attr id="MY_NAME" desc="GOOD">
but I need to create an instance variable to handle the desc element in the attr tag .
Can some one help me out as this is not my file and I am having trouble to do please......
import java.util.*;
import java.io.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
   The SupportMatrix class provides static variables and methods to simplify
   the determination of whether or not a given attribute is supported for a
   certain object type (queue manager, channel, etc.), depending on the version
   and platform of the queue manager to which it belongs.
   The SupportMatrix class may not be instantiated. Its constructor is private.
   An instance of the class is created internally in the static initializer so
   that the XML parsing methods are available.
   A corresponding XML document, SupportMatrix.xml, is parsed to create the various
   HashMaps which contain the version/platform dependency information. A number of
   inner classes are used to represent the various elements of the XML matrix
   definition.
   Here's a sample document:
   <!-- The supportmatrix tag opens the document -->
   <supportmatrix>
     <!-- Objects are keyed by classid. "1" is the classid of a queue manager object. -->
     <object classid="1">
       <!-- Versions group attributes according to the queue manager version where they
            were introduced. The "base" cmdlevel encompasses all versions up to 5.1. -->
       <version cmdlevel="base">
         <!-- Attributes are defined by the attr tag. -->
         <attr id="MQCA_Q_MGR_NAME">
           <!-- Support elements define the platform-specific requirements for an attribute. -->
           <support platforms="UNIX,WINDOWS,OS400,VMS,NSK" maxlen="48" type="MQCFST"/>
           <support platforms="MVS" maxlen="4" type="MQCFST"/>
         </attr>
         <attr id="MQCA_Q_MGR_DESC">
           <!-- Specific attribute characteristics, most notably maximum len for string parms,
                are defined in the support element. As shown in the following example, it may
                apply to all platforms. -->
           <support platforms="all" maxlen="64" type="MQCFST"/>
         </attr>
         <!-- Support elements are optional. -->
         <attr id="MQIA_PLATFORM"/>
         <attr id="MQIA_COMMAND_LEVEL"/>
       </version>
       <!-- The version element may 'include' other versions. Note that object elements
            may also refer to other objects via the 'include' parm of the object tag.
            This is to allow common attributes (especially for queues and channels) to
            be shared by multiple definitions in order to reduce some of the
            redundancy. -->
       <version cmdlevel="520" include="base">
       </version>
     </object>
   </supportmatrix>
   The inner classes, and their hierarchical relationships are as follows:
     SupportObject - corresponds to the <object> element. Stored in a static HashMap, and
                     keyed by classid.
       VersionObject - corresponds to the <version> element. Stored in a HashMap instance
                       variable of the SupportObject class, keyed by cmdlevel.
         AttributeObject - corresponds to the <attr> element. Stored in a HashMap instance
                           variable of the VersionObject class, keyed by attribute name.
           PlatformObject - corresponds to the <support> element. Stored in HashMaps belonging
                            to the AttributeObjects, keyed by platform. A single PlatformObject
                            instance is created when the support tag is encountered. The
                            "platforms" attribute of the support element is then processed. For
                            each platform in the comma-delimited list, an entry is added to the
                            collection of PlatformObjects. This is to greatly simplify later
                            lookups.
   In order to support the 'include' feature of object and version elements, certain
   functions are recursive. If the attribute to be validated is not found for the passed
   cmdlevel, the 'parent' VersionObject is consulted by means of the 'include' value. If
   the chain of VersionObjects has been exhausted and the attribute in question has still not
   been located, the next SupportObject in the chain is consulted in a similar fashion.
public class SupportMatrix extends DefaultHandler {
    /** The objects collection holds all the SupportObjects, keyed by classid. */
    private static HashMap objects;
    /** xmlFile will name the xml document to be parsed. Note that using the
        default class loader expects the string to be the path to the file. It must
        NOT begin with the '/' character. */
    private static String xmlFile =
        ResourceManager.getApplicationProperties().getProperty("SupportMatrixFile");
    private Stack stack;
    /** This static initializer allocates the static objects collection, creates an
        instance of the SupportMatrix class for xml parsing purposes, and initiates
        the parse operation to populate the collection. */
    static {
        objects = new HashMap();
        // Create a parser and process the xml doc
        SupportMatrix handler = new SupportMatrix();
        InputSource is = null;
        try {
            is = new InputSource(ClassLoader.getSystemClassLoader().getResourceAsStream(xmlFile));
            XMLReader xmlReader =
                SAXParserFactory.newInstance().newSAXParser().getXMLReader();
            xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
            xmlReader.setContentHandler(handler);
            if (is == null) {
                System.err.println("No input stream, dammit");
            xmlReader.parse(is);
        } catch(Exception e) {
            e.printStackTrace();
    /** Private constuctor, used only for XML parsing. */
    private SupportMatrix() {
        stack = new Stack();
    /** Add a SupportObject instance to the objects collection. */
    private void addObject(SupportObject obj) {
        String key = obj.getClassId();
        objects.put(key, obj);
    /* DefaultHandler methods                                              */
    /** Not used. */
    public void characters(char[] ch, int start, int length) {}
    /** Not used. */
    public void endDocument() {}
    /** For the version, object, and attr elements, pop the top element of the stack. */
    public void endElement(String uri, String localName, String qName) {
        if (localName.equals("version") || localName.equals("object") || localName.equals("attr")) {
            stack.pop();
    /** Not used. */
    public void setDocumentLocator(Locator locator) {}
    /** Not used. */
    public void startDocument() {}
    /** Most of the work is done here. Create the appropriate inner class instance for
        element; for object, version, and attr, push the element onto the stack so that
        child elements may be added to their collections as needed. */
    public void startElement(String uri, String localName, String qName,
                             Attributes attributes) {
        String include = attributes.getValue("include");
        if (localName.equals("object")) {
            SupportObject obj = new SupportObject(attributes.getValue("classid"), include);
            addObject(obj);
            stack.push(obj);
        } else if ( localName.equals("version")) {
            VersionObject ver = new VersionObject(attributes.getValue("cmdlevel"), include);
            ((SupportObject)stack.peek()).addVersion(ver);
            stack.push(ver);
        } else if ( localName.equals("attr")) {
            AttributeObject a = new AttributeObject(attributes.getValue("id"));
            //String desc = StringFactory.getString(attributes.getValue("desc"));
            //if(desc != null)
               //     a.setAttribute();
            String readonly = attributes.getValue("readonly");
            String exclude = attributes.getValue("exclude");
            if (include != null && exclude != null) {
                Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                exclude = null;
            if (include != null) {
                a.setCondition(include, true);
            if (exclude != null) {
                a.setCondition(exclude, false);
            if (readonly != null)
                a.setReadonly(readonly.equals("y"));
            ((VersionObject)stack.peek()).addAttr(a);
            stack.push(a);
        } else if (localName.equals("support")) {
            String platforms = attributes.getValue("platforms");
            String readonly = attributes.getValue("readonly");
            String maxlen = attributes.getValue("maxlen");
            String type = attributes.getValue("type");
            int attrType = 0;
            if (type != null) {
                if (type.equals("MQCFIN")) {
                    attrType = CMQCFC.MQCFT_INTEGER;
                } else if (type.equals("MQCFIL")) {
                    attrType = CMQCFC.MQCFT_INTEGER_LIST;
                } else if (type.equals("MQCFST")) {
                    attrType = CMQCFC.MQCFT_STRING;
                } else if (type.equals("MQCFSL")) {
                    attrType = CMQCFC.MQCFT_STRING_LIST;
                } else if (type.equals("EXBIN")) {
                    attrType = MqcConstants.EXCFT_BINARY;
                } else if (type.equals("EXPCF")) {
                    attrType = MqcConstants.EXCFT_PCF;
            PlatformObject p = null;
            if (readonly == null) {
                p = new PlatformObject(platforms);
            } else {
                p = new PlatformObject(platforms, readonly.equals("y"));
            String exclude = attributes.getValue("exclude");
            if (include != null && exclude != null) {
                Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                exclude = null;
            if (include != null)
                p.setCondition(include, true);
            if (exclude != null)
                p.setCondition(exclude, false);
            if (attrType != 0)
                p.setType(attrType);
            if (maxlen != null)
                p.setLen(Integer.parseInt(maxlen));
            ((AttributeObject)stack.peek()).addPlatform(p);
    public static boolean isExported(int attribute, TopologyModelNode node) {
        String name = ResourceManager.getAttributeName(attribute);
        return isExported(name, node);
    public static boolean isExported(String attribute, TopologyModelNode node) {
        // Find the qmgr node to fetch platform and cmdlevel
        TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
        // If there's no qmgr for this node, it must be one of 'ours'.
        if (qmgr == null)
            return false;     // None of 'our' objects can be exported to MQSC.
        String classId = node.getClassId();
        String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
        String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
        return isExported(attribute, classId, cmdLevel, platform, node);
    public static boolean isExported(int attribute, String classId, String cmdLevel, String platform,
                                     TopologyModelNode node) {
        String name = ResourceManager.getAttributeName(attribute);
        return isExported(name, classId, cmdLevel, platform, node);
    /** Determine if an attribute is exportable. The attribute name, the classid of the object to
        which it belongs, plus the command level and platform of the queue manager are all needed
        to make this determination.
        Start by finding the AttributeObject for the combination of attribute, classid, and
        command level. If we can't find the AttributeObject, we assume that the attribute
        is not exported. Otherwise, find out if it is exportable for the selected platform.
    public static boolean isExported(String attribute, String classId, String cmdLevel, String platform,
                                     TopologyModelNode node) {
        AttributeObject attr = getAttributeObject(attribute, classId, cmdLevel);
        if (attr == null) {
            return false;
        } else {
            return attr.isExported(platform, node);
    public static boolean isSupported(int attribute, TopologyModelNode node) {
        String name = ResourceManager.getAttributeName(attribute);
        return isSupported(name, node);
    public static boolean isSupported(String attribute, TopologyModelNode node) {
        // Find the qmgr node to fetch platform and cmdlevel
        TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
        // If there's no qmgr for this node, it must be one of 'ours'.
        if (qmgr == null)
            return true;
        String classId = node.getClassId();
        String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
        String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
        return isSupported(attribute, classId, cmdLevel, platform);
    public static boolean isSupported(int attribute, String classId, String cmdLevel, String platform) {
        String name = ResourceManager.getAttributeName(attribute);
        return isSupported(name, classId, cmdLevel, platform);
    /** Determine if an attribute is supported. The attribute name, the classid of the object to
        which it belongs, plus the command level and platform of the queue manager are all needed
        to make this determination.
        Start by finding the SupportObject for the classid. If it isn't there, we make the assumption
        (for now) that the attribute is supported. The only classids for which this can occur are
        broker, agent, and the various container objects.
        Propagate the isSupported request to the chain of SupportObjects (based on 'include' values)
        until we get a 'true' result or we run out of SupportObjects. */
    public static boolean isSupported(String attribute, String classId, String cmdLevel, String platform) {
        if (attribute == null)
            return false;
        SupportObject obj = (SupportObject)objects.get(classId);
        // If the object type isn't even in the support matrix, we interpret that to
        // mean that it's a Broker or Agent, in which case all attributes are supported
        // at present.
        if (obj == null)
            return true;
        boolean result = false;
        while (result == false && obj != null) {
            result = obj.isSupported(attribute, cmdLevel, platform);
            if (result == false && obj.getInclude() != null) {
                obj = (SupportObject)objects.get(obj.getInclude());
            } else
                obj = null;
        return result;
    /** Locate an AttributeObject for a given attribute name, object type, and command level.
        This is a helper function for the getMaxLen and getType methods. */
    private static AttributeObject getAttributeObject(String attr, String classID, String cmdLevel) {
        AttributeObject result = null;
        SupportObject obj = (SupportObject)objects.get(classID);
        while (result == null && obj != null) {
            result = obj.getAttr(attr, cmdLevel);
            if (result == null && obj.getInclude() != null) {
                obj = (SupportObject)objects.get(obj.getInclude());
            } else
                obj = null;
        return result;
    /** Determine the maximum length for a given combintation of attribute name, object type,
        command level, and platform. If the AttributeObject can't be found, or if the length
        hasn't been set, return -1. */
    public static int getMaxLen(String attr, String classId, String cmdLevel, String platform) {
        AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
        if (a == null)
            return -1;
        return a.getMaxLen(platform);
    /** Determine the PCF parm type for a given combintation of attribute name, object type,
        command level, and platform. If the AttributeObject can't be found, or if the length
        hasn't been set, return -1. */
    public static int getType(String attr, String classId, String cmdLevel, String platform) {
        AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
        if (a == null)
            return -1;
        return a.getType(platform);
    /** Inner class to contain platform-specific info for an attribute. */
    class PlatformObject {
        /** This instance variable will contain the comma-delimited string of all
            platforms to which this object applies. */
        private String platform;
        private int maxlen;
        private String condition = null;
        private boolean include;
        private boolean readonly;
        private boolean lenSet;
        private int attrType;
        private boolean typeSet;
        public PlatformObject(String p, boolean readonly) {
            platform = p;
            this.readonly = readonly;
            lenSet = false;
            typeSet = false;
        public PlatformObject(String p) {
            this(p, false);
        public void setCondition(String condition, boolean include) {
            this.condition = condition;
            this.include = include;
        public boolean isReadonly() {
            return readonly;
        public boolean isExported(TopologyModelNode node) {
            if (condition != null) {
                boolean test = false;
                try {
                    test = Utilities.evaluateCondition(node, condition);
                } catch (Exception e) {}
                if (include ^ test)
                    return false;
            return !readonly;
        public void setLen(int len) {
            maxlen = len;
            lenSet = true;
        public void setType(int type) {
            attrType = type;
            typeSet = true;
        public String getPlatform() {
            return platform;
        public int getMaxLen() {
            if (!lenSet)
                return -1;
            return maxlen;
        public int getType() {
            if (!typeSet)
                return -1;
            return attrType;
    /** This class represents a specific MQSeries attribute. It can optionally contain
        instances of the PlatformObject class as needed. When the 'platforms' collection
        is empty, the attribute is supported on all platforms. It is also possible to
        include a PlatformObject for the 'all' platform, if specific attribute characteristics
        need representation. When the 'platforms' collection is non-empty, it will include one
        entry for each platform where the attribute is supported. */
    class AttributeObject {
        private String attribute;
        private String attrValue;
        private HashMap platforms;
        private String condition = null;
        private boolean include;
        private boolean readonly = false;
        public AttributeObject(String a) {
            this(a, false);
        public AttributeObject(String a, boolean readonly) {
            attribute = a;
            platforms = new HashMap();
            this.readonly = readonly;
        public void setCondition(String condition, boolean include) {
            this.condition = condition;
            this.include = include;
        public void setReadonly(boolean readonly) {
            this.readonly = readonly;
        public boolean isReadonly() {
            return readonly;
        public void addPlatform(PlatformObject p) {
            for (StringTokenizer st = new StringTokenizer(p.getPlatform(), ","); st.hasMoreTokens() ;) {
                platforms.put(st.nextToken(), p);
        public PlatformObject getPlatform(String platform) {
            PlatformObject p = (PlatformObject)platforms.get(platform);
            if (p == null)
                p = (PlatformObject)platforms.get("all");
            return p;
        public String getAttribute() {
            return attribute;
        public int getMaxLen(String platform) {
            PlatformObject p = getPlatform(platform);
            if (p == null)
                return -1;
            return p.getMaxLen();
        public int getType(String platform) {
            PlatformObject p = getPlatform(platform);
            if (p == null)
                return -1;
            return p.getType();
        public boolean isSupported(String platform) {
            if (platforms.isEmpty()) {
                return true;
            if (platforms.containsKey(platform)) {
                return true;
            if (platforms.containsKey("all")) {
                return true;
            return false;
        public boolean isExported(String platform, TopologyModelNode node) {
            if (readonly) {
                Log.log(Log.DEBUG, this, attribute + " is readonly, returning false");
                return false;
            if (condition != null) {
                Log.log(Log.DEBUG, this, "Testing condition = " + condition);
                boolean test = false;
                try {
                    test = Utilities.evaluateCondition(node, condition);
                    Log.log(Log.DEBUG, this, "Condition result is " + test);
                } catch (Exception e) {
                    Log.log(Log.ERROR, this, "Condition through an exception");
                if (include ^ test)
                    return false;
            if (platforms.isEmpty()) {
                return true;
            PlatformObject p = getPlatform(platform);
            if (p == null) {
                Log.log(Log.DEBUG, this, platform + " not found for " + attribute + ", returning false");
                return false;
            return p.isExported(node);
    /** This class represents a specific value of a queue manager's command level. A
        given instance of this class may 'include' a 'parent' instance through its
        include instance variable. The traversal of the parent/child hierarchy is
        delegated to the SupportObject class, since that is where the collection of
        VersionObjects lives. */
    class VersionObject {
        private String cmdLevel;
        private String include;
        private HashMap attributes;
        public VersionObject(String cmdLevel, String include) {
            this.cmdLevel = cmdLevel;
            this.include = include;
            attributes = new HashMap();
        public void addAttr(AttributeObject attr) {
            attributes.put(attr.getAttribute(), attr);
        public AttributeObject getAttr(String attr) {
            return (AttributeObject)attributes.get(attr);
        public String getCmdLevel() {
            return cmdLevel;
        public String getInclude() {
            return include;
        public boolean isSupported(String attr, String platform) {
            AttributeObject obj = (AttributeObject)attributes.get(attr);
            if (obj == null) {
                return false;
            } else
                return obj.isSupported(platform);
    /** This class represents an MQSeries object type, as identified by its classid, e.g.
        queue manager or local queue. This class implements an include facility similar to
        that described for the VersionObject. The traversal of that hierarchy is delegated
        to the static isSupported method, because the collection of SupportObject instances
        is a static variable of the SupportMatrix class. */
    class SupportObject {
        private String classId;
        private String include;
        private HashMap versions;
        public SupportObject(String classId, String include) {
            this.classId = classId;
            this.include = include;
            versions = new HashMap();
        public void addVersion(VersionObject obj) {
            String key = obj.getCmdLevel();
            versions.put(key, obj);
        public String getClassId() {
            return classId;
        public String getInclude() {
            return include;
        public boolean isSupported(String attr, String cmdLevel, String platform) {
            boolean result = false;
            VersionObject obj = (VersionObject)versions.get(cmdLevel);
            if (obj == null)
                obj = (VersionObject)versions.get("base");
            // I don't actually know what it means if obj is null at this point.
            // It probably can't happen.
            if (obj == null)
                return false;
            while (result ==  false && obj != null) {
                result = obj.isSupported(attr, platform);
                if (result == false && obj.getInclude() != null) {
                    obj = (VersionObject)versions.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        public AttributeObject getAttr(String attr, String cmdLevel) {
            AttributeObject result = null;
            VersionObject obj = (VersionObject)versions.get(cmdLevel);
            if (obj == null)
                obj = (VersionObject)versions.get("base");
            // I don't actually know what it means if obj is null at this point.
            // It probably can't happen.
            if (obj == null)
                return null;
            while (result ==  null && obj != null) {
                result = obj.getAttr(attr);
                if (result == null && obj.getInclude() != null)
                    obj = (VersionObject)versions.get(obj.getInclude());
                else
                    obj = null;
            return result;
}

Are you the one who commented out the code you're looking for ?//String desc = StringFactory.getString(attributes.getValue("desc"));You just have to modify you AttributeObject class to hold a new field : String description. And then, it's up to you to create a new constructor or a new setter method.
Btw, this is not a Swing related question.

Similar Messages

  • Issue in reading the XML file

    Hi Gurus,
    I am dier need of one of the xml issue which I am facing right now.
    I am reading one of the xml file which is like this
    <?xml version="1.0" encoding="UTF-8" ?>
    - <GEBIZ_ORDER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    - <HEADER>
      <MINISTRY_CODE>RPO</MINISTRY_CODE>
      <DEPARTMENT_CODE>000</DEPARTMENT_CODE>
      <ORDER_CODE>RPO000EPO11000953</ORDER_CODE>
      <EXTERNAL_SYSTEM_CODE>E</EXTERNAL_SYSTEM_CODE>
      <AMENDMENT_NUMBER>0</AMENDMENT_NUMBER>
      <VARIATION_NUMBER>0</VARIATION_NUMBER>
      <DESCRIPTION>Purchase Order for Air tickets for SOT to Korea (from 17th - 26th Sep 2011) off PC(RPO000ECN11000100)for SAS</DESCRIPTION>
      <STATUS>NEW</STATUS>
      <STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
      <PAYMENT_TERMS xsi:nil="true" />
      <BILL_TO>One-Stop Centre, 9 Woodlands Avenue 9, S(738964)</BILL_TO>
      <JUSTIFICATION>Please refer to attached approval email.</JUSTIFICATION>
      <CREATE_TIMESTAMP>2011-07-08T16:57:39</CREATE_TIMESTAMP>
      <TERMINATE_REASON xsi:nil="true" />
      <TERMINATE_TIMESTAMP xsi:nil="true" />
      <ORDER_TYPE>1</ORDER_TYPE>
    - <FINANCIAL_SYSTEM>
      <SUB_BUSINESS_UNIT>RPS01</SUB_BUSINESS_UNIT>
      </FINANCIAL_SYSTEM>
    - <SUPPLIER>
      <CODE>200003048E</CODE>
      <NAME>Safe2Travel Pte Ltd</NAME>
      <GST_NUMBER>20-0003048-E</GST_NUMBER>
      <CONTACT_NAME>ONG PEI LENG</CONTACT_NAME>
      <CONTACT_PHONE>68233103</CONTACT_PHONE>
      <CONTACT_EMAIL>[email protected]</CONTACT_EMAIL>
      <CONTACT_FAX>68221636</CONTACT_FAX>
    - <SITES>
    - <SITE>
      <ID>1</ID>
      <NAME>ravel Pte Ltd</NAME>
      <PHONE>68233013</PHONE>
      <PHONE_EXTENSION xsi:nil="true" />
      <FAX>68221636</FAX>
      <EMAIL>[email protected]</EMAIL>
      <ADDRESS_LINE1>10 Eunos Road 8</ADDRESS_LINE1>
      <ADDRESS_LINE2>#08-03 (North Lobby)</ADDRESS_LINE2>
      <ADDRESS_LINE3>Singapore Post Centre</ADDRESS_LINE3>
      <COUNTRY_CODE>SG</COUNTRY_CODE>
      <PROVINCE xsi:nil="true" />
      <STATE xsi:nil="true" />
      <CITY xsi:nil="true" />
      <AREA_CODE xsi:nil="true" />
      <ZIP>408600</ZIP>
      <REGION_CODE xsi:nil="true" />
      </SITE>
    - <SITE>
      <ID>2</ID>
      <NAME>ravel Pte Ltd</NAME>
      <PHONE>62208866</PHONE>
      <PHONE_EXTENSION xsi:nil="true" />
      <FAX>62265578</FAX>
      <EMAIL>[email protected]</EMAIL>
      <ADDRESS_LINE1>3 Lim Teck Kim Road</ADDRESS_LINE1>
      <ADDRESS_LINE2>#02-02</ADDRESS_LINE2>
      <ADDRESS_LINE3>Singapore Technologies Building</ADDRESS_LINE3>
      <COUNTRY_CODE>SG</COUNTRY_CODE>
      <PROVINCE xsi:nil="true" />
      <STATE xsi:nil="true" />
      <CITY xsi:nil="true" />
      <AREA_CODE xsi:nil="true" />
      <ZIP>088934</ZIP>
      <REGION_CODE xsi:nil="true" />
      </SITE>
    - <SITE>
      <ID>3</ID>
      <NAME>Safe2Travel Pte Ltd</NAME>
      <PHONE>62208866</PHONE>
      <PHONE_EXTENSION xsi:nil="true" />
      <FAX>62265578</FAX>
      <EMAIL>[email protected]</EMAIL>
      <ADDRESS_LINE1>3 Lim Teck Kim Road</ADDRESS_LINE1>
      <ADDRESS_LINE2>#02-02</ADDRESS_LINE2>
      <ADDRESS_LINE3>Singapore Technologies Building</ADDRESS_LINE3>
      <COUNTRY_CODE>SG</COUNTRY_CODE>
      <PROVINCE xsi:nil="true" />
      <STATE xsi:nil="true" />
      <CITY xsi:nil="true" />
      <AREA_CODE xsi:nil="true" />
      <ZIP>088934</ZIP>
      <REGION_CODE xsi:nil="true" />
      </SITE>
      </SITES>
      </SUPPLIER>
    - <USER>
      <CODE>JOYCE SOON</CODE>
      <NAME>JOYCE SOON</NAME>
      <ORGANISATION_NAME>Republic Polytechnic</ORGANISATION_NAME>
      </USER>
    - <FUND_COMMIT_AMOUNT>
      <CURRENCY_CODE>SGD</CURRENCY_CODE>
      <CURRENCY_RATE>1</CURRENCY_RATE>
      <CURRENCY_RATE_DATE>1900-01-01T00:00:00</CURRENCY_RATE_DATE>
      <CURRENCY_RATE_TYPE>BOOK</CURRENCY_RATE_TYPE>
      <CURRENCY_AMOUNT>21551.4</CURRENCY_AMOUNT>
      </FUND_COMMIT_AMOUNT>
    - <PERIOD_CONTRACT>
      <CODE>RPO000ECN11000100</CODE>
      <AGENCY_CODE>RPO000</AGENCY_CODE>
      <ADMIN_FEE_SGD_AMOUNT>0</ADMIN_FEE_SGD_AMOUNT>
      </PERIOD_CONTRACT>
    - <BUYER>
      <ORGANISATION_CODE>1</ORGANISATION_CODE>
      <ORGANISATION_NAME>Republic Polytechnic</ORGANISATION_NAME>
      <NAME>Sally Ang</NAME>
      <PHONE>31001711</PHONE>
      <FAX>64151310</FAX>
      <EMAIL>[email protected]</EMAIL>
      </BUYER>
      <APPROVING_OFFICERS />
      </HEADER>
    - <ITEMS>
    - <ITEM>
      <LINE_NUMBER>1</LINE_NUMBER>
      <STATUS>NEW</STATUS>
      <STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
      <DESCRIPTION>Return Air Ticket including Airport Taxes and Fuel Surcharges (2 staff and 24 students)</DESCRIPTION>
      <UNIT_OF_MEASURE>PAX</UNIT_OF_MEASURE>
      <QUANTITY>26</QUANTITY>
      <LINE_TYPE>SERVICES</LINE_TYPE>
      <UNIT_PRICE>828.9</UNIT_PRICE>
      <PRICE_UNIT>1</PRICE_UNIT>
      <TOTAL_AMOUNT>21551.4</TOTAL_AMOUNT>
      <MATERIAL_MASTER_CODE xsi:nil="true" />
      <MATERIAL_GROUP_CODE xsi:nil="true" />
      <PLANT_CODE xsi:nil="true" />
      <ITEM_CATEGORY_CODE xsi:nil="true" />
      <ADMIN_FEE_SGD_AMOUNT>0</ADMIN_FEE_SGD_AMOUNT>
      <INSTRUCTION_TO_SUPPLIER>Purchase of goods/services is subject to the Terms & Conditions found in www.rp.sg/purchase and/or in the ITQ/ITT Specifications. Please liaise with the Contact Person for delivery details. Invoice MUST be addressed to the Contact Person. PO number MUST be included in the Description field under e-Invoice Details section at Vendor@Gov.</INSTRUCTION_TO_SUPPLIER>
      <PERIOD_CONTRACT_LINE_NUMBER>1</PERIOD_CONTRACT_LINE_NUMBER>
      <GOODS_INSPECT_FLAG>N</GOODS_INSPECT_FLAG>
    - <PURCHASE_REQUEST>
      <CODE>RPO000EPR11000465</CODE>
      <LINE_NUMBER>1</LINE_NUMBER>
      </PURCHASE_REQUEST>
    - <PART_NUMBER_INFORMATION>
      <NATO_STOCK_NUMBER xsi:nil="true" />
      <MANUFACTURER_PART_NUMBER xsi:nil="true" />
      <PART_NUMBER xsi:nil="true" />
      <CAGE_CODE xsi:nil="true" />
      <CAGE_NAME xsi:nil="true" />
      <ITEM_CONDITION xsi:nil="true" />
      <MINIMUM_SHELF_LIFE xsi:nil="true" />
      <SHELF_LIFE_REMAINING xsi:nil="true" />
      <CERTIFICATE_OF_CONFORMANCE xsi:nil="true" />
      <EXPORT_LICENSE xsi:nil="true" />
      </PART_NUMBER_INFORMATION>
    - <LOCATIONS>
    - <LOCATION>
      <LINE_NUMBER>1</LINE_NUMBER>
      <STATUS>NEW</STATUS>
      <STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
      <QUANTITY>26</QUANTITY>
      <DELIVERY_DESTINATION>Republic Polytechnic, One-Stop Centre, 9 Woodlands Avenue 9, S(738964)</DELIVERY_DESTINATION>
      <DELIVERY_DATE>2011-07-11T00:00:00</DELIVERY_DATE>
      <DELIVERY_TERMS>LOC</DELIVERY_TERMS>
      <PORT_OF_ORIGIN>-</PORT_OF_ORIGIN>
    - <RECIPIENT>
      <CODE>OSC</CODE>
      <NAME>One Stop Centre</NAME>
      <PHONE>65103000</PHONE>
      <EMAIL>[email protected]</EMAIL>
      </RECIPIENT>
    - <DISTRIBUTIONS>
    - <DISTRIBUTION>
      <LINE_NUMBER>1</LINE_NUMBER>
      <STATUS>NEW</STATUS>
      <STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
      <QUANTITY>26</QUANTITY>
      <CHART_OF_ACCOUNT>1/G01/3SAS/020/220908/0000/0000/0000</CHART_OF_ACCOUNT>
      <PROJECT_DISTRIBUTION xsi:nil="true" />
      </DISTRIBUTION>
      </DISTRIBUTIONS>
      </LOCATION>
      </LOCATIONS>
      </ITEM>
      </ITEMS>
      </GEBIZ_ORDER>I was able to read this kind of file structure but due to some constraints now they added supplier sites and increment that one which will be like variable kind of thing now.
    And below mentioned is the script which I am using right now for reading that xml file
    PROCEDURE XGBZPROD.XGBZ_PUR_ORD_XMLTAG_PROC(P_XML_FILE IN VARCHAR2, P_FOLDER_NAME IN VARCHAR2)
    IS
      lv_supp_file     XMLTYPE;
      lv_hdr_error     VARCHAR2(240);
      lv_line_error    VARCHAR2(240);
      lv_line_loc_err  VARCHAR2(240);
      lv_dist_err      VARCHAR2(240);
      l_file_name      VARCHAR2(300);
      l_folder_name    VARCHAR2(300);
      lv_sysdate       DATE := sysdate;
    BEGIN
      l_file_name     := p_xml_file;
      l_folder_name   := p_folder_name;
      -- this clause to check whether is xml file or NODATA FILE.
      IF upper(substr(l_file_name,instr(l_file_name,'.',1)+1,3)) ='XML' THEN
        lv_supp_file  := xmltype( bfilename('XMLDIR',P_XML_FILE), nls_charset_id('AL32UTF8'));
        dbms_output.put_line('P_XML_FILE '||P_XML_FILE);
    -- Initially insert data into 11g table
    -- This is to read xml datafile
      INSERT INTO XGBZ_PO_XML_DETAILS
       (ministry_code                ,
        department_code              ,
        order_code                   ,
        external_system_code         ,
        amendment_number             ,
        variation_number             ,
        description                  ,
        status                       ,
        status_date                  ,
        payment_terms                ,
        bill_to                      ,
        justification                ,
        create_timestamp             ,
        terminate_reason             ,
        terminate_timestamp          ,
        order_type                   ,
        sub_business_unit            ,
        cost_center_group            ,
        buyer_code                   ,
        financial_system_order_code  ,
        user_nric                    ,
        supplier_code                ,
        supplier_name                ,
        gst_number                   ,
        contact_name                 ,
        contact_phone                ,
        contact_email                ,
        contact_fax                  ,
        supp_site_id                 ,
        supp_site_name               ,
        supp_site_phone              ,
        supp_sit_phone_ext           ,
        supp_site_fax                ,
        supp_site_email              ,
        supp_site_add_line1          ,
        supp_site_add_line2          ,
        supp_site_add_line3          ,
        supp_site_country_code       ,
        supp_site_province           ,
        supp_site_state              ,
        supp_site_city               ,
        supp_site_area_code          ,
        supp_site_zip                ,
        supp_site_region_code        ,
        user_code                    ,
        user_name                    ,
        user_org_name                ,
        currency_code                ,
        currency_rate                ,
        currency_rate_date           ,
        currency_rate_type           ,
        currency_amount              ,
        tx_field_2                   ,
        agency_code                  ,
        admin_fee_sgd                ,
        buyer_orgn_code              ,
        buyer_orgn_name              ,
        buyer_name                   ,
        buyer_phone                  ,
        buyer_fax                    ,
        buyer_email                  ,
        ao_code                      ,
        ao_name                      ,
        line_no                      ,
        line_status                  ,
        line_status_date             ,
        line_description             ,
        unit_of_measure              ,
        line_qty                     ,
        line_type                    ,
        unit_price                   ,
        line_total_amount            ,
        material_master_code         ,
        material_group_code          ,
        item_category_code           ,
        line_admin_fee_sgd_amt       ,
        instruction_supplier         ,
        period_contract_line_no      ,
        goods_inspect_flag           ,
        pr_code                      ,
        pr_line_number               ,
        nato_stock_number            ,
        manufacturer_part_no         ,
        part_number                  ,
        cage_code                    ,
        cage_name                    ,
        item_condition               ,
        minimum_shelf_life           ,
        shelf_life_remaining         ,
        cert_of_conformance          ,
        export_license               ,
        line_location_no             ,
        line_loc_status              ,
        line_loc_status_date         ,
        line_loc_qty                 ,
        delivery_destination         ,
        delivery_date                ,
        delivery_terms               ,
        port_of_origin               ,
        recipient_code               ,
        recipient_name               ,
        recipient_phone              ,
        recipient_email              ,
        dist_line_no                 ,
        dist_line_status             ,
        dist_line_status_date        ,
        dist_line_qty                ,
        chart_of_account             ,
        project_distribution
       SELECT --Header Data
              ministry_code                ,
              department_code              ,
              order_code                   ,
              external_system_code         ,
              amendment_number             ,
              variation_number             ,
              description                  ,
              status                       ,
              status_date                  ,
              payment_terms                ,
              bill_to                      ,
              justification                ,
              create_timestamp             ,
              terminate_reason             ,
              terminate_timestamp          ,
              order_type                   ,
              sub_business_unit            ,
              cost_center_group            ,
              buyer_code                   ,
              financial_system_order_code  ,
              user_nric                    ,
              supplier_code                ,
              supplier_name                ,
              gst_number                   ,
              contact_name                 ,
              contact_phone                ,
              contact_email                ,
              contact_fax                  ,
              supp_site_id                 ,
              supp_site_name               ,
              supp_site_phone              ,
              supp_sit_phone_ext           ,
              supp_site_fax                ,
              supp_site_email              ,
              supp_site_add_line1          ,
              supp_site_add_line2          ,
              supp_site_add_line3          ,
              supp_site_country_code       ,
              supp_site_province           ,
              supp_site_state              ,
              supp_site_city               ,
              supp_site_area_code          ,
              supp_site_zip                ,
              supp_site_region_code        ,
              user_code                    ,
              user_name                    ,
              user_org_name                ,
              currency_code                ,
              currency_rate                ,
              currency_rate_date           ,
              currency_rate_type           ,
              currency_amount              ,
              tx_field_2                   ,
              agency_code                  ,
              admin_fee_sgd                ,
              buyer_orgn_code              ,
              buyer_orgn_name              ,
              buyer_name                   ,
              buyer_phone                  ,
              buyer_fax                    ,
              buyer_email                  ,
              ao_code                      ,
              ao_name                      ,
              line_no                      ,
              line_status                  ,
              line_status_date             ,
              line_description             ,
              unit_of_measure              ,
              line_qty                     ,
              line_type                    ,
              unit_price                   ,
              line_total_amount            ,
              material_master_code         ,
              material_group_code          ,
              item_category_code           ,
              line_admin_fee_sgd_amt       ,
              instruction_supplier         ,
              period_contract_line_no      ,
              goods_inspect_flag           ,
              pr_code                      ,
              pr_line_number               ,
              nato_stock_number            ,
              manufacturer_part_no         ,
              part_number                  ,
              cage_code                    ,
              cage_name                    ,
              item_condition               ,
              minimum_shelf_life           ,
              shelf_life_remaining         ,
              cert_of_conformance          ,
              export_license               ,
              line_location_no             ,
              line_loc_status              ,
              line_loc_status_date         ,
              line_loc_qty                 ,
              delivery_destination         ,
              delivery_date                ,
              delivery_terms               ,
              port_of_origin               ,
              recipient_code               ,
              recipient_name               ,
              recipient_phone              ,
              recipient_email              ,
              dist_line_no                 ,
              dist_line_status             ,
              dist_line_status_date        ,
              dist_line_qty                ,
              chart_of_account             ,
              project_distribution
         FROM XMLTable('/GEBIZ_ORDER'
              passing lv_supp_file
              columns
              ministry_code                      VARCHAR2(3)    path    'HEADER/MINISTRY_CODE',
              department_code                    VARCHAR2(3)    path    'HEADER/DEPARTMENT_CODE',
              order_code                         VARCHAR2(17 )  path    'HEADER/ORDER_CODE',
              external_system_code               VARCHAR2(1)    path    'HEADER/EXTERNAL_SYSTEM_CODE',
              amendment_number                   VARCHAR2(5)    path    'HEADER/AMENDMENT_NUMBER' ,
              variation_number                   VARCHAR2(5)    path    'HEADER/VARIATION_NUMBER',
              description                        VARCHAR2(500)  path    'HEADER/DESCRIPTION',
              status                             VARCHAR2(500)  path    'HEADER/STATUS',
              status_date                        VARCHAR2(24)   path    'HEADER/STATUS_DATE',
              payment_terms                      VARCHAR2(400)  path    'HEADER/PAYMENT_TERMS',
              bill_to                            VARCHAR2(200)  path    'HEADER/BILL_TO',
              justification                      VARCHAR2(400)  path    'HEADER/JUSTIFICATION',
              create_timestamp                   VARCHAR2(24)   path    'HEADER/CREATE_TIMESTAMP',
              terminate_reason                   VARCHAR2(400)  path    'HEADER/TERMINATE_REASON',
              terminate_timestamp                VARCHAR2(24)   path    'HEADER/TERMINATE_TIMESTAMP',
              order_type                         VARCHAR2(2 )   path    'HEADER/ORDER_TYPE',
              sub_business_unit                  VARCHAR2(5 )   path    'HEADER/FINANCIAL_SYSTEM/SUB_BUSINESS_UNIT',
              cost_center_group                  VARCHAR2(20 )  path    'HEADER/FINANCIAL_SYSTEM/NFS/COST_CENTER_GROUP',
              buyer_code                         VARCHAR2(30 )  path    'HEADER/FINANCIAL_SYSTEM/NFS/BUYER_CODE',
              financial_system_order_code        VARCHAR2(20 )  path    'HEADER/FINANCIAL_SYSTEM/NFS/FINANCIAL_SYSTEM_ORDER_CODE',
              user_nric                          VARCHAR2(9 )   path    'HEADER/FINANCIAL_SYSTEM/NFS/USER_NRIC',
              supplier_code                      VARCHAR2(10)   path    'HEADER/SUPPLIER/CODE',
              supplier_name                      VARCHAR2(140)  path    'HEADER/SUPPLIER/NAME' ,
              gst_number                         VARCHAR2(30 )  path    'HEADER/SUPPLIER/GST_NUMBER',
              contact_name                       VARCHAR2(140 ) path    'HEADER/SUPPLIER/CONTACT_NAME',
              contact_phone                      VARCHAR2(23 )  path    'HEADER/SUPPLIER/CONTACT_PHONE',
              contact_email                      VARCHAR2(100)  path    'HEADER/SUPPLIER/CONTACT_EMAIL',
              contact_fax                        VARCHAR2(23 )  path    'HEADER/SUPPLIER/CONTACT_FAX',
              supp_site_id                       NUMBER         path    'HEADER/SUPPLIER/SITES/SITE/ID',
              supp_site_name                     VARCHAR2(140)  path    'HEADER/SUPPLIER/SITES/SITE/NAME',
              supp_site_phone                    VARCHAR2(23)   path    'HEADER/SUPPLIER/SITES/SITE/PHONE',
              supp_sit_phone_ext                 VARCHAR2(4 )   path    'HEADER/SUPPLIER/SITES/SITE/PHONE_EXTENSION',
              supp_site_fax                      VARCHAR2(23 )  path    'HEADER/SUPPLIER/SITES/SITE/FAX',
              supp_site_email                    VARCHAR2(100 ) path    'HEADER/SUPPLIER/SITES/SITE/EMAIL',
              supp_site_add_line1                VARCHAR2(254 ) path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE1',
              supp_site_add_line2                VARCHAR2(35 )  path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE2',
              supp_site_add_line3                VARCHAR2(35 )  path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE3',
              supp_site_country_code             VARCHAR2(2 )   path    'HEADER/SUPPLIER/SITES/SITE/COUNTRY_CODE',
              supp_site_province                 VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/PROVINCE',
              supp_site_state                    VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/STATE',
              supp_site_city                     VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/CITY',
              supp_site_area_code                VARCHAR2(10 )  path    'HEADER/SUPPLIER/SITES/SITE/AREA_CODE',
              supp_site_zip                      VARCHAR2(20 )  path    'HEADER/SUPPLIER/SITES/SITE/ZIP',
              supp_site_region_code              VARCHAR2(3 )   path    'HEADER/SUPPLIER/SITES/SITE/REGION_CODE',
              user_code                          VARCHAR2(16 )  path    'HEADER/USER/CODE',
              user_name                          VARCHAR2(25 )  path    'HEADER/USER/NAME',
              user_org_name                      VARCHAR2(95 )  path    'HEADER/USER/ORGANISATION_NAME',
              currency_code                      VARCHAR2(3 )   path    'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_CODE',
              currency_rate                      NUMBER         path    'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_RATE',
              currency_rate_date                 VARCHAR2(24)   path    'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_RATE_DATE',
              currency_rate_type                 VARCHAR2(5 )   path    'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_RATE_TYPE',
              currency_amount                    NUMBER         path    'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_AMOUNT',
              tx_field_2                         VARCHAR2(17 )  path    'HEADER/PERIOD_CONTRACT/CODE',
              agency_code                        VARCHAR2(6 )   path    'HEADER/PERIOD_CONTRACT/AGENCY_CODE',
              admin_fee_sgd                      NUMBER         path    'HEADER/PERIOD_CONTRACT/ADMIN_FEE_SGD_AMOUNT'  ,
              buyer_orgn_code                    VARCHAR2(5 )   path    'HEADER/BUYER/ORGANISATION_CODE',
              buyer_orgn_name                    VARCHAR2(95 )  path    'HEADER/BUYER/ORGANISATION_NAME',
              buyer_name                         VARCHAR2(80 )  path    'HEADER/BUYER/NAME',
              buyer_phone                        VARCHAR2(23 )  path    'HEADER/BUYER/PHONE',
              buyer_fax                          VARCHAR2(23 )  path    'HEADER/BUYER/FAX',
              buyer_email                        VARCHAR2(100 ) path    'HEADER/BUYER/EMAIL',
              ao_code                            VARCHAR2(16 )  path    'HEADER/APPROVING_OFFICERS/APPROVING_OFFICER/CODE',
              ao_name                            VARCHAR2(40 )  path    'HEADER/APPROVING_OFFICERS/APPROVING_OFFICER/NAME',
              items                              XMLTYPE        path    'ITEMS'
              ) x1,
            XMLTABLE('/ITEMS/ITEM'
            passing x1.items
            columns
              line_no                            VARCHAR2(5)    path    'LINE_NUMBER',
              line_status                        VARCHAR2(15)   path    'STATUS',
              line_status_date                   VARCHAR2(24)   path    'STATUS_DATE',
              line_description                   VARCHAR2(500)  path    'DESCRIPTION',
              unit_of_measure                    VARCHAR2(3)    path    'UNIT_OF_MEASURE',
              line_qty                           NUMBER         path    'QUANTITY',
              line_type                          VARCHAR2(20)   path    'LINE_TYPE',
              unit_price                         NUMBER         path    'UNIT_PRICE',
              line_total_amount                  NUMBER         path    'TOTAL_AMOUNT',
              material_master_code               VARCHAR2(20)   path    'MATERIAL_MASTER_CODE',
              material_group_code                VARCHAR2(10)   path    'MATERIAL_GROUP_CODE',
              item_category_code                 VARCHAR2(18)   path    'ITEM_CATEGORY_CODE',
              line_admin_fee_sgd_amt             NUMBER         path    'ADMIN_FEE_SGD_AMOUNT',
              instruction_supplier               VARCHAR2(400)  path    'INSTRUCTION_TO_SUPPLIER',
              period_contract_line_no            NUMBER         path    'PERIOD_CONTRACT_LINE_NUMBER',
              goods_inspect_flag                 VARCHAR2(1)    path    'GOODS_INSPECT_FLAG',
              pr_code                            VARCHAR2(17)   path    'PURCHASE_REQUEST/CODE',
              pr_line_number                     VARCHAR2(5)    path    'PURCHASE_REQUEST/LINE_NUMBER',
              nato_stock_number                  VARCHAR2(14)   path    'PART_NUMBER_INFORMATION/NATO_STOCK_NUMBER',
              manufacturer_part_no               VARCHAR2(32)   path    'PART_NUMBER_INFORMATION/MANUFACTURE_PART_NUMBER',
              part_number                        VARCHAR2(200)  path    'PART_NUMBER_INFORMATION/PART_NUMBER',
              cage_code                          VARCHAR2(10)   path    'PART_NUMBER_INFORMATION/CAGE_CODE',
              cage_name                          VARCHAR2(140)  path    'PART_NUMBER_INFORMATION/CAGE_NAME',
              item_condition                     VARCHAR2(1)    path    'PART_NUMBER_INFORMATION/ITEM_CONDITION'  ,
              minimum_shelf_life                 NUMBER         path    'PART_NUMBER_INFORMATION/MINIMUM_SHELF_LIFE',
              shelf_life_remaining               VARCHAR2(3)    path    'PART_NUMBER_INFORMATION/SHELF_LIFE_REMAINING',
              cert_of_conformance                VARCHAR2(1000) path    'PART_NUMBER_INFORMATION/CERTIFICATE_OF_CONFORMANCE',
              export_license                     VARCHAR2(3)    path    'PART_NUMBER_INFORMATION/EXPORT_LICENSE',
              locations                          XMLTYPE        path    'LOCATIONS'
             )x2,
             XMLTABLE('/LOCATIONS/LOCATION'
             passing x2.locations
             columns
              line_location_no                   NUMBER         path     'LINE_NUMBER',
              line_loc_status                    VARCHAR2(15)   path     'STATUS',
              line_loc_status_date               VARCHAR2(24)   path     'STATUS_DATE',
              line_loc_qty                       NUMBER         path     'QUANTITY',
              delivery_destination               VARCHAR2(1000) path     'DELIVERY_DESTINATION',
              delivery_date                      VARCHAR2(24)   path     'DELIVERY_DATE',
              delivery_terms                     VARCHAR2(3)    path     'DELIVERY_TERMS',
              port_of_origin                     VARCHAR2(150)  path     'PORT_OF_ORIGIN',
              recipient_code                     VARCHAR2(16 )  path     'RECIPIENT/CODE',
              recipient_name                     VARCHAR2(40 )  path     'RECIPIENT/NAME',
              recipient_phone                    VARCHAR2(23 )  path     'RECIPIENT/PHONE',
              recipient_email                    VARCHAR2(100 ) path     'RECIPIENT/EMAIL',
              distributions                      XMLTYPE        path     'DISTRIBUTIONS'
             )x3,
             XMLTABLE('/DISTRIBUTIONS/DISTRIBUTION'
             passing x3.distributions
             columns
              dist_line_no                       NUMBER         path     'LINE_NUMBER',
              dist_line_status                   VARCHAR2(15)   path     'STATUS',
              dist_line_status_date              VARCHAR2(24)   path     'STATUS_DATE',
              dist_line_qty                      NUMBER         path     'QUANTITY',
              chart_of_account                   VARCHAR2(420)  path     'CHART_OF_ACCOUNT',
              project_distribution               VARCHAR2(4000) path     'PROJECT_DISTRIBUTION'
              )x4;
    end;As there is change in requirement now I need to read the multiple supplier sites at the header level. Current this is my structure please give an idea how to read the mulitple sites as one record, probably i can increase the supplier site columns at table level so as to capture second site level information.
    But if in case if i receive that time it should not fail please provide some good solution for this issue.
    Thanks in advance for your help.
    Regards
    Nagendra

    Hi odie,
    Thanks for your response. But here my supplier site will always be maxiumum 2 times and minimum 1 time. My thinking is to fit this one in the existing code by repeating the supplier site only like this
              supp_site_id                       NUMBER         path    'HEADER/SUPPLIER/SITES/SITE/ID',
              supp_site_name                     VARCHAR2(140)  path    'HEADER/SUPPLIER/SITES/SITE/NAME',
              supp_site_phone                    VARCHAR2(23)   path    'HEADER/SUPPLIER/SITES/SITE/PHONE',
              supp_sit_phone_ext                 VARCHAR2(4 )   path    'HEADER/SUPPLIER/SITES/SITE/PHONE_EXTENSION',
              supp_site_fax                      VARCHAR2(23 )  path    'HEADER/SUPPLIER/SITES/SITE/FAX',
              supp_site_email                    VARCHAR2(100 ) path    'HEADER/SUPPLIER/SITES/SITE/EMAIL',
              supp_site_add_line1                VARCHAR2(254 ) path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE1',
              supp_site_add_line2                VARCHAR2(35 )  path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE2',
              supp_site_add_line3                VARCHAR2(35 )  path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE3',
              supp_site_country_code             VARCHAR2(2 )   path    'HEADER/SUPPLIER/SITES/SITE/COUNTRY_CODE',
              supp_site_province                 VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/PROVINCE',
              supp_site_state                    VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/STATE',
              supp_site_city                     VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/CITY',
              supp_site_area_code                VARCHAR2(10 )  path    'HEADER/SUPPLIER/SITES/SITE/AREA_CODE',
              supp_site_zip                      VARCHAR2(20 )  path    'HEADER/SUPPLIER/SITES/SITE/ZIP',
              supp_site_region_code              VARCHAR2(3 )   path    'HEADER/SUPPLIER/SITES/SITE/REGION_CODE',
              supp_site_id2                       NUMBER         path    'HEADER/SUPPLIER/SITES/SITE/ID',
              supp_site_name2                     VARCHAR2(140)  path    'HEADER/SUPPLIER/SITES/SITE/NAME',
              supp_site_phone2                    VARCHAR2(23)   path    'HEADER/SUPPLIER/SITES/SITE/PHONE',
              supp_sit_phone_ext2                 VARCHAR2(4 )   path    'HEADER/SUPPLIER/SITES/SITE/PHONE_EXTENSION',
              supp_site_fax2                      VARCHAR2(23 )  path    'HEADER/SUPPLIER/SITES/SITE/FAX',
              supp_site_email2                    VARCHAR2(100 ) path    'HEADER/SUPPLIER/SITES/SITE/EMAIL',
              supp_site_add_line1_2                VARCHAR2(254 ) path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE1',
              supp_site_add_line2_2                VARCHAR2(35 )  path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE2',
              supp_site_add_line3_2                VARCHAR2(35 )  path    'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE3',
              supp_site_country_code_2             VARCHAR2(2 )   path    'HEADER/SUPPLIER/SITES/SITE/COUNTRY_CODE',
              supp_site_province_2                 VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/PROVINCE',
              supp_site_state_2                    VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/STATE',
              supp_site_city_2                     VARCHAR2(25 )  path    'HEADER/SUPPLIER/SITES/SITE/CITY',
              supp_site_area_code_2                VARCHAR2(10 )  path    'HEADER/SUPPLIER/SITES/SITE/AREA_CODE',
              supp_site_zip_2                      VARCHAR2(20 )  path    'HEADER/SUPPLIER/SITES/SITE/ZIP',
              supp_site_region_code_2              VARCHAR2(3 )   path    'HEADER/SUPPLIER/SITES/SITE/REGION_CODE',As this table I am being used in many areas, it will be problem for me if try to go for different levels of tables. Or else can it be possible to read only once
    I mean only the first in the xml tags and leave the second xml. As there is not much significant for the second one.
    I appreciate your ideas on this, as the structure we are following is to rigid so I don't have much options to explore, please provide me your inputs in this context.
    Thanks for your help.
    Regards
    Nagendra
    Edited by: 838961 on Jul 13, 2011 1:43 AM

  • How can I take the part that parses the .XML file and make it a procedure.

    CREATE OR REPLACE PACKAGE BODY XMLSTUD6 AS
    Author: Jimmy Harris
    Created: 5/25/2006
    Purpose: 1.This package has an XML file initialized to a variable called DOC .
              2.It will then take the values from the XML file and insert them into a PL/SQL table.
              3.From the PL/SQL table it will insert values into the STUDENTS table.
              4.After step four above, the STUDLOAD procedure will insert (Sequence,Status, .XML file, USER, SYSDATE, ERROR_Message
                             into the AUDIT_XMLSTUD table regardless if insert status was successfull or not status is indicated by either an Y or
              NO and the original XML filed that was currently processed, the date and user who executed the procedure.
              If the status was NO then it will insert the Oracle SQLERRM massage, into the REASON_FOR_ERROR column.
                             If status is Y then REASOK_FOR_ERROR IS NULL.
                             5,Make sure you embed the xml file with an inner and outer ' ' ie: ' the whole .xml file string ' as the input
                             parameter into the STUDLOAD procedure.
    This package excepts the whole .XML file as a CLOB as an input parameter, so that the end-user will not have
                                  modify the code.      
    Modification History:     1.6/09/2006 JImmy Harris Modified code, added the Function "WORD_CONVERTER1" to accept the requested text data and
    return a coded value back to our Welligent system.     
                                  2. Was advised that a front end type of functionality was not neccesary for this issue so I removed the INSERT_XML_FILE,
                                  UPDATE_XML_FILE and the INSERT_XML_file.
    FUNCTION WORD_CONVERTER1 (v_domain IN VARCHAR2 := null,
    v_incoming IN VARCHAR2 := null) RETURN VARCHAR2 IS
    v_well VARCHAR2(32);
    v_editdd BOOLEAN;
    v_code VARCHAR2(32);
    CURSOR C_conv_wrd IS
    SELECT WELL
    INTO v_code
    FROM CONVERSION_TABLE
    WHERE DOMAIN = UPPER(TRIM(v_domain))
    AND INCOMING = UPPER(TRIM(v_incoming));
    BEGIN
    OPEN c_conv_wrd;
    LOOP
    FETCH c_conv_wrd INTO v_code;
    EXIT WHEN c_conv_wrd%NOTFOUND;
    END LOOP;
    CLOSE c_conv_wrd;
    RETURN v_code;
    END WORD_CONVERTER1;
    PROCEDURE STUDLOAD (DOC CLOB) IS
    v_parser xmlparser.Parser;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_n xmldom.DOMNode;
    v_mm NUMBER;
    v_dd NUMBER;
    v_yyyy NUMBER;
    v_DATE DATE;
    v_race VARCHAR2(1);
    v_eth VARCHAR2(1);
    v_prim_lang VARCHAR2(1);
    v_house_lang VARCHAR2(1);
    v_gender VARCHAR2(1);
    TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
    s_tab stuxml_type := stuxml_type();
    v_success VARCHAR2(200);
    v_failure VARCHAR2(200);
    l_error_code varchar2(200);
    BEGIN
    -- Create a parser.
    v_parser := xmlparser.newParser;
    xmlparser.setValidationMode(v_parser, FALSE);
    -- Parse the document and create a new DOM document.
    SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
    v_doc := SYS.XMLPARSER.getDocument(v_parser);
    -- Free resources associated with the Parser now it is no longer needed.
    xmlparser.freeParser(v_parser);
    -- Get a list of all the STUD nodes in the document using the XPATH syntax.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
    -- Loop through the list and create a new record in a table collection for each STUD record.
    FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, stud);
    s_tab.extend;
    -- Use XPATH syntax to assign values to he elements of the collection.
    s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
         s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
         s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
         v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
         v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
    v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
         v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
         s_tab(s_tab.last).STUDENT_DOB := v_date;
         s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
         s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
         s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
         s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
         s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
    v_race := WORD_CONVERTER1('RACE',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Race')));
         v_eth := WORD_CONVERTER1('EHTNICITY',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Ethnicity')));
         v_prim_lang:= WORD_CONVERTER1('PRIMARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/PrimaryLanguage')));
         v_house_lang:= WORD_CONVERTER1('SECONDARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/HouseholdLanguage')));
         v_gender := WORD_CONVERTER1('GENDER',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Gender')));
    s_tab(s_tab.last).STUDENT_RACE := v_race;
         s_tab(s_tab.last).STUDENT_ETHNIC := v_eth;
         s_tab(s_tab.last).STUDENT_PRI_LANG :=v_prim_lang;
         s_tab(s_tab.last).STUDENT_SEC_LANG := v_house_lang;
         s_tab(s_tab.last).STUDENT_GENDER :=v_gender;
    END LOOP;
    FOR stud IN s_tab.first..s_tab.last LOOP
    INSERT INTO STUDENTS (SHISID, SSN, DOE_SCHOOL_NUMBER,PATIENT_TYPE, TEACHER, HOMEROOM,STUDENT_LAST_NAME, STUDENT_FIRST_NAME, STUDENT_MI,STUDENT_DOB,
    STUDENT_BIRTH_CERT, STUDENT_COMM,STUDENT_MUSA, STUDENT_FAMSIZE, STUDENT_FAMINCOME,STUDENT_UNINSURED, STUDENT_LUNCH, STUDENT_ZIP,STUDENT_STATE,
    STUDENT_COUNTY, STUDENT_STREET,STUDENT_APART_NO, STUDENT_PHONE, STUDENT_H2O_TYPE,STUDENT_WASTE_TRT, STUDENT_HOME_SET, STUDENT_NONHOME_SET,
    STUDENT_GENDER, STUDENT_RACE, STUDENT_ETHNIC,STUDENT_PRI_LANG, STUDENT_SEC_LANG, STUDENT_ATRISK,EMER_COND_MEMO, ASSIST_DEVICE_TYPE,
    SCHOOL_ENTER_AGE,STUDENT_CURR_GRADE, S504_ELIG_DATE, S504_DEV_DATE,S504_REV_DATE, STUDENT_504, STUDENT_IEP,IEP_EXP_DATE, GRAD_CLASS, TYPE_DIPLOMA,
    GRADE_RETAIN, LIT_PASS_TEST_MATH, LIT_PASS_DATE_MATH,LIT_PASS_TEST_WRITE, LIT_PASS_DATE_WRITE, LIT_PASS_TEST_READ,LIT_PASS_DATE_READ, SPEC_ED_ELIG,
    SPEC_ED_CODE,TRANSPORT_CODE, TRANSPORT_NO, PRIME_HANDICAP,PRIME_HANDICAP_PERCENT, PRIME_HANDI_MANAGER, FIRST_ADD_HANDI,FIRST_ADD_HANDICAP_PERCENT,
    FIRST_ADD_HANDI_504, FIRST_ADD_HANDI_504_DATE, SECOND_ADD_HANDI, SECOND_ADD_HANDICAP_PERCENT, MED_EXTERNAL_NAME, INS_TYPE, INS_PRI, INS_NAME,
    INS_MEDICAID_NO, ELIGDATE, INS_PRIV_INSURANCE, INS_APPR_BILL, INS_APPR_DATE, INS_PARENT_APPR,INS_POL_NAME, INS_POL_NO, INS_CARRIER_NO,
    INS_CARRIER_NAME, INS_CARRIER_RELATE, INS_AFFECT_DATE, INS_COPAY_OV, INS_COPAY_RX, INS_COPAY_AMBUL,INS_COPAY_EMER, INS_COPAY_OUTPAT,STUDENT_INACTIVE,
    PHYS_ID, ENCOUNTERNUM,USERID,MODDATE, STUDENT_ID, S504_DISABILITY,CHAPTER1, WELLNESS_ENROLL, SCHOOL_OF_RESIDENCE,INITIAL_IEP_DATE, CALENDAR_TRACK,
    USA_BORN,ALT_ID, FUTURE_SCHOOL, IEP_LAST_MEETING,IEP_LAST_SETTING, IEP_LAST_REFER_EVAL, THIRD_ADD_HANDI,LEP, GIFTED, IEP_EXIT_REASON,
    CASE_MANAGER_ID, INTAKE_NOTES, CALLER_PHONE,CALL_DATE, CALLER_RELATIONSHIP, CALLER_NAME,BUSINESS_PHONE, FAX, EMAIL,HIGHEST_EDUCATION, INTAKE_DATE,
    SERVICE_COORDINATOR, DISCHARGE_DATE, DISCHARGE_REASON, DISCHARGE_NOTES,INTAKE_BY, INTAKE_STATUS, IEP_LAST_SERVED_DATE,IEP_APC_DATE, IEP_EXIT_DATE,
    ADDRESS2, LEGAL_STATUS, RELIGION, EMPLOYMENT_STATUS, TARG_POP_GROUP1, TARG_POP_GROUP2, MARITAL_STATUS,THIRD_ADD_HANDI_PERCENT, LAST_INTERFACE_DATE,
    SERVICE_PLAN_TYPE,CURRENT_JURISDICTION, FIPS, BIRTH_PLACE_JURISDICTION,BIRTH_PLACE_HOSPITAL, BIRTH_PLACE_STATE, BIRTH_PLACE_COUNTRY,
    OTHER_CLIENT_NAME, SIBLINGS_WITH_SERVICES, PERM_SHARE_INFORMATION,PERM_VERIFY_INSURANCE, REFERRING_AGENCY, REFERRING_INDIVIDUAL,AUTOMATIC_ELIGIBILITY,
    INTAKE_IEP_ID, FUTURE_SCHOOL2,FUTURE_SCHOOL3, TRANSLATOR_NEEDED, TOTAL_CHILDREN_IN_HOME,REFERRED_BY, FAMILY_ID, SCREENING_CONSENT_FLAG,PICTURE_FILE,
    DUAL_ENROLLED, DOE_SCHOOL_NUMBER2)
    VALUES (123456789025, null,null ,null,null,null ,s_tab(stud).STUDENT_LAST_NAME,s_tab(stud).STUDENT_FIRST_NAME,s_tab(stud).STUDENT_MI,
    s_tab(stud).STUDENT_DOB,null ,null,null ,null,null,null,null,s_tab(stud).STUDENT_ZIP,s_tab(stud).STUDENT_STATE ,s_tab(stud).STUDENT_COUNTY,
    s_tab(stud).STUDENT_STREET,s_tab(stud).STUDENT_APART_NO,null,null,null ,null , null,
    s_tab(stud).STUDENT_GENDER ,s_tab(stud).STUDENT_RACE , s_tab(stud).STUDENT_ETHNIC,
    s_tab(stud).STUDENT_PRI_LANG ,s_tab(stud).STUDENT_SEC_LANG, null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null,
    null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null ,null , null, null, null,null );
    END LOOP;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
    HTP.HTMLOPEN;
    v_success:= 'The values from the .XML file have been successfully inserted into the STUDENTS table in the Oracle Database.';
    htp.bold(v_success);
    HTP.HTMLCLOSE;
    COMMIT;
    -- Free any resources associated with the document now it that it is no longer needed.
    xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN OTHERS THEN
    l_error_code := SQLERRM;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
    HTP.HTMLOPEN;
    v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
    htp.bold(v_failure);
    HTP.HTMLCLOSE;
    COMMIT;
    END STUDLOAD;
    PROCEDURE UPDSTUDLOAD (DOC CLOB) IS
    v_parser xmlparser.Parser;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_n xmldom.DOMNode;
    v_mm NUMBER;
    v_dd NUMBER;
    v_yyyy NUMBER;
    v_DATE DATE;
    v_race VARCHAR2(1);
    v_eth VARCHAR2(1);
    v_prim_lang VARCHAR2(1);
    v_house_lang VARCHAR2(1);
    v_gender VARCHAR2(1);
    TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
    s_tab stuxml_type := stuxml_type();
    v_success VARCHAR2(200);
    v_failure VARCHAR2(200);
    l_error_code varchar2(200);
    BEGIN
    -- Create a parser.
    v_parser := xmlparser.newParser;
    xmlparser.setValidationMode(v_parser, FALSE);
    -- Parse the document and create a new DOM document.
    SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
    v_doc := SYS.XMLPARSER.getDocument(v_parser);
    -- Free resources associated with the Parser now it is no longer needed.
    xmlparser.freeParser(v_parser);
    -- Get a list of all the STUD nodes in the document using the XPATH syntax.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
    -- Loop through the list and create a new record in a table collection for each STUD record.
    FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, stud);
    s_tab.extend;
    -- Use XPATH syntax to assign values to he elements of the collection.
    s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
         s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
         s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
         v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
         v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
    v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
         v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
         s_tab(s_tab.last).STUDENT_DOB := v_date;
         s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
         s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
         s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
         s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
         s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
    v_race := WORD_CONVERTER1('RACE',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Race')));
         v_eth := WORD_CONVERTER1('EHTNICITY',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Ethnicity')));
         v_prim_lang:= WORD_CONVERTER1('PRIMARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/PrimaryLanguage')));
         v_house_lang:= WORD_CONVERTER1('SECONDARY_LANG',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/HouseholdLanguage')));
         v_gender := WORD_CONVERTER1('GENDER',UPPER(xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Gender')));
    s_tab(s_tab.last).STUDENT_RACE := v_race;
         s_tab(s_tab.last).STUDENT_ETHNIC := v_eth;
         s_tab(s_tab.last).STUDENT_PRI_LANG :=v_prim_lang;
         s_tab(s_tab.last).STUDENT_SEC_LANG := v_house_lang;
         s_tab(s_tab.last).STUDENT_GENDER :=v_gender;
    END LOOP;
    FOR stud IN s_tab.first..s_tab.last LOOP
         UPDATE STUDENTS
         SET
         STUDENT_LAST_NAME = s_tab(stud).STUDENT_LAST_NAME,
         STUDENT_FIRST_NAME = s_tab(stud).STUDENT_FIRST_NAME,
         STUDENT_MI = s_tab(stud).STUDENT_MI,
         STUDENT_DOB = s_tab(stud).STUDENT_DOB,
         STUDENT_ZIP = s_tab(stud).STUDENT_ZIP,
         STUDENT_STATE = s_tab(stud).STUDENT_STATE,
         STUDENT_COUNTY = s_tab(stud).STUDENT_COUNTY,
         STUDENT_STREET = s_tab(stud).STUDENT_STREET,
         STUDENT_APART_NO = s_tab(stud).STUDENT_APART_NO
         WHERE SHISID = 123456789025;
    END LOOP;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
    HTP.HTMLOPEN;
    v_success:= 'The updated .XML file has been successfully saved to the STUDENTS table in the Oracle Database.';
    htp.bold(v_success);
    HTP.HTMLCLOSE;
    COMMIT;
    -- Free any resources associated with the document now it that it is no longer needed.
    xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN OTHERS THEN
    l_error_code := SQLERRM;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
    HTP.HTMLOPEN;
    v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
    htp.bold(v_failure);
    HTP.HTMLCLOSE;
    COMMIT;
    END UPDSTUDLOAD;
    PROCEDURE DELSTUDLOAD (DOC CLOB) IS
    v_parser xmlparser.Parser;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_n xmldom.DOMNode;
    v_mm NUMBER;
    v_dd NUMBER;
    v_yyyy NUMBER;
    v_DATE DATE;
    TYPE stuxml_type IS TABLE OF STUDENTS%ROWTYPE;
    s_tab stuxml_type := stuxml_type();
    v_success VARCHAR2(200);
    v_failure VARCHAR2(200);
    l_error_code varchar2(200);
    BEGIN
    -- Create a parser.
    v_parser := xmlparser.newParser;
    xmlparser.setValidationMode(v_parser, FALSE);
    -- Parse the document and create a new DOM document.
    SYS.XMLPARSER.PARSECLOB ( v_parser, DOC );
    v_doc := SYS.XMLPARSER.getDocument(v_parser);
    -- Free resources associated with the Parser now it is no longer needed.
    xmlparser.freeParser(v_parser);
    -- Get a list of all the STUD nodes in the document using the XPATH syntax.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent');
    -- Loop through the list and create a new record in a table collection for each STUD record.
    FOR stud IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, stud);
    s_tab.extend;
    -- Use XPATH syntax to assign values to he elements of the collection.
    s_tab(s_tab.last).STUDENT_LAST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/LastName');
         s_tab(s_tab.last).STUDENT_FIRST_NAME :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/FirstName');
         s_tab(s_tab.last).STUDENT_MI :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Name/MiddleName');
         v_dd := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Day');
         v_mm := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Month');
    v_yyyy := xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/BirthDate/Year');
         v_DATE := TO_DATE(v_mm||' '||v_dd||' '||v_yyyy,'MMDDYYYY');
         s_tab(s_tab.last).STUDENT_DOB := v_date;
         s_tab(s_tab.last).STUDENT_STREET :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/Street');
         s_tab(s_tab.last).STUDENT_APART_NO :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ApartmentNumber');
         s_tab(s_tab.last).STUDENT_COUNTY :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/County');
         s_tab(s_tab.last).STUDENT_STATE :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/State');
         s_tab(s_tab.last).STUDENT_ZIP :=xslprocessor.valueOf(v_n,'/com.welligent.Student.BasicStudent.Create/DataArea/NewData/BasicStudent/Address/ZipCode');
    END LOOP;
    FOR stud IN s_tab.first..s_tab.last LOOP
         DELETE FROM STUDENTS
         WHERE SHISID = 123456789025;
    END LOOP;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,DOC,'Y',NULL,SYSDATE);
    HTP.HTMLOPEN;
    v_success:= 'The .XML file has been successfully deleted from the STUDENTS table in the Oracle Database.';
    htp.bold(v_success);
    HTP.HTMLCLOSE;
    COMMIT;
    -- Free any resources associated with the document now it that it is no longer needed.
    xmldom.freeDocument(v_doc);
    EXCEPTION
    WHEN OTHERS THEN
    l_error_code := SQLERRM;
    INSERT INTO AUDIT_XMLSTUD1(XMLSTUDPK,USERID,XMLFILE,STATUS,REASON_FOR_ERROR,DATE_MODIFIED)
    VALUES(SEQ_XMLSTUD1.NEXTVAL,USER,nvl(DOC,TO_CLOB('No .XML file entered, user pressed button without entering correct information.')),'NO',l_error_code,SYSDATE);
    HTP.HTMLOPEN;
    v_failure:= 'The attempt made to insert files to the Student table has failed because,'||l_error_code;
    htp.bold(v_failure);
    HTP.HTMLCLOSE;
    COMMIT;
    END DELSTUDLOAD;
    END XMLSTUD6;

    Try opening the problem files using a text editor or file viewer to see what the first few bytes contain. All valid FM binary files for FM 11 will contain <MakerFile 11.0> in the first bytes of the file.
    When updating books, it's sometimes better to just to create a new book file and add the files to that.
    When renaming files in a book, changes at the system level will break any links/cross-references between files, so it's always best to use the Rename option in the Book file to change FM file names. This will maintain the correct linkages.

  • To Place the XML file from one folder to another folder in AL11

    Hi All,
      Here my requirement is to create the quotes using XML document. The XML document will come from the Application server. this one is fine.
    Now my prob is after processing the XML file, we have to place the XML file into another folder.
    Please let me know how to move the data inot XML file.
    Now iam reading the data into one variable V_string(it will contains the total XML file). From this variable how to move the data into APplication server.
    Please do the needful.
    Regards,
    Sreehari

    Hi,
    Use FM WS_FILE_COPY To FIrst Copy the File to some Location
    and Next Use FM TMP_GUI_DELETE_FILE To Delete the File from Old LOcation.
    Regards
    Bala.M

  • Error while opening the XML file

    Hi all,
    i'am trying to download data from internal table to XML file with root node and its
    corresponding child nodes.i have written the program in this way.
    tables: mara.
    include bcciixml_decl.
    include bcciixml_impl.
    parameters: p_matnr like mara-matnr.
    start-of-selection.
    data: piXML          type ref to if_ixml,
            pDocument      type ref to if_ixml_document,
            pStreamFactory type ref to if_ixml_stream_factory,
            pIStream       type ref to if_ixml_istream,
            pParser        type ref to if_ixml_parser,
            pNode          type ref to if_ixml_node,
            pText          type ref to if_ixml_text,
            string         type string,
            count          type i,
            index          type i,
            totalSize      type i,
            dsn(40)        type C,
            xstr           type xstring.
      types: begin of it_mara,
                matnr like mara-matnr,
                ernam like mara-ernam,
                aenam like mara-aenam,
                vpsta like mara-vpsta,
            end of it_mara.
    data: itab_mara type table of it_mara.
    select matnr ernam aenam vpsta from mara into table itab_mara where
           matnr =  p_matnr.
    types: begin of xml_line,
            data(256) type X,
          end of xml_line.
    data: xml_table type table of xml_line.
    parameters: filename like rlgrap-filename.
    pixml = cl_ixml=>create( ).
    *-- create the initial document
      pDocument = pixml->create_document( ).
      pStreamFactory = pixml->create_stream_factory( ).
    *-- create an input stream for the table
    *pIStream = pStreamFactory->create_istream_itable( table = xml_table
                                                     size  = totalSize ).
      pParser = piXML->create_parser( stream_factory = pStreamFactory
                                      istream        = pIStream
                                      document       = pDocument ).
    data: pOStream type ref to if_ixml_ostream.
    pOStream = pStreamFactory->create_ostream_itable( table = xml_table ).
    call method pDocument->render( ostream   = pOStream ).
    *-- how many bytes were written to the table?
    totalSize = pOStream->get_num_written_raw( ).
    *-- write the XML document back to the frontend
    concatenate filename '.out' into filename.
    condense filename no-gaps.
    CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
              BIN_FILESIZE            = totalSize
              FILENAME                = filename
              FILETYPE                = 'BIN'
         TABLES
              DATA_TAB                = itab_mara
         EXCEPTIONS
              OTHERS                  = 11
    IF SY-SUBRC <> 0.
    ENDIF.
    *-- print the whole DOM tree as a list...
    pNode = pDocument.
    perform print_node using pNode.
          FORM print_node                                               *
    form print_node using value(pNode) type ref to if_ixml_node.
      data: indent      type i.
      data: pText       type ref to if_ixml_text.
      data: string      type string.
      indent  = pNode->get_height( ) * 2.
      case pnode->get_type( ).
        when if_ixml_node=>co_node_element.
          string = pNode->get_name( ).
          write: at /indent '<', string, '> '.
        when if_ixml_node=>co_node_text.
           pText ?= pNode->query_interface( ixml_iid_text ).
           if pText->ws_only( ) is initial.
            string = pNode->get_value( ).
            write: at /indent string.
           endif.
      endcase.
      pNode = pNode->get_first_child( ).
      while not pNode is initial.
         perform print_node using pNode.
         pNode = pNode->get_next( ).
      endwhile.
    endform.
    but when open the XML file which i created on the desktop it shows the following error.
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'file:///C:/Documents and Settings/anilda/Desktop/sim...
    how to rectify this error.
    Regards,
    satish.

    You are going to need to provide more details about this shell script file you are executing and the environment it is in. Beyond being on a Windows box, you have provided none of those details.
    If the SQL statement will execute cleanly in SQLDeveloper but not your script, then the issue lies in the script. How do you know the error is that SQL statement? Can your script even "select * from dual;" successfully?
    Also, SQLDeveloper (which I don't use) may contain its own libraries for accessing the DB. You probably should consider upgrading to a SQL*Plus client that is at least the same version or later as your database.
    Note:
    As I recall, xmlgen in 9.2 is now a synonym for dbms_xmlgen. You should change the package name accordingly [url http://docs.oracle.com/cd/B10501_01/appdev.920/a96612/d_xmlge2.htm#1010709]dbms_xmlgen.getXML

  • Error in reading the XML file

    Hi,
    I am trying to read the values of the node of XML file. The structure of the XML file is:
    <?xml version = "1.0"?>
    <DOCUMENT>
    <LANGUAGE_TRANS>
    <TRANSLATION>
    <CODE>3</CODE>
    <VALUE>Please select a number</VALUE>
    </TRANSLATION>
    <TRANSLATION>
    <CODE>5</CODE>
    <VALUE>Patni</VALUE>
    </TRANSLATION>
    <TRANSLATION>
    <CODE>6</CODE>
    <VALUE>Status Messages</VALUE>
    </TRANSLATION>
    <TRANSLATION>
    <CODE>7</CODE>
    <VALUE>Progress</VALUE>
    </TRANSLATION>
    <TRANSLATION>
    <CODE>8</CODE>
    <VALUE>Create Data Files...</VALUE>
    </TRANSLATION>
    <TRANSLATION>
    <CODE>9</CODE>
    <VALUE>OK</VALUE>
    </TRANSLATION>
    </LANGUAGE_TRANS>
    </DOCUMENT>
    I have written the code to read the value of the code from the XML file. When I run the code as written below. It doesnot give any error or exception. The node name returned is CODE as desired but the Node value returned is null which is not the desired result. Can anyone please help me to find where I am going wrong. Thanks a lot.
    Regards,
    Shweta
    import java.net.*;
    import java.util.*;
    import oracle.xml.parser.v2.*;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    public class MergeXMLTest
    private static XMLDocument mDoc;
    public MergeXMLTest () {
    try {
    // Get an instance of the parser
    DOMParser lParser = new DOMParser();
    // Generate a URL from the filename for UPDATE.XML file.
    URL lUrl = createURL("mot.xml");
    System.out.println("after creating the URL object ");
    lParser.setErrorStream(System.out);
    lParser.showWarnings(true);
    lParser.parse(lUrl);
    mDoc = lParser.getDocument();
    System.out.println("after creating the URL object "+mDoc);
    lParser.reset();
    } catch (Exception e) {
    e.printStackTrace();
    } // end catch block
    } // End of constructor
    public void merge() throws DOMException {
    try {
         NodeList lTrans1 = this.mDoc.getElementsByTagName("CODE");
         if(lTrans1.getLength()>0) {
              Node lTransTag1 = lTrans1.item(0);
              System.out.println("lTrans1.item(0).getNodeName : " + lTrans1.item(0).getNodeName());
              System.out.println("lTrans1.item(0).getNodeValue : " + lTrans1.item(0).getNodeValue());
         } catch (Exception e) {
         System.out.println("Exception "+e);
         e.printStackTrace();
         } catch (Throwable t) {
              System.out.println("Exception "+t);
    public static URL createURL(String pFileName) throws MalformedURLException {
    URL url = null;
    Block of code to create a URL object from the file name
    that is passed as parameter.
    try {
    url = new URL(pFileName);
    } catch (MalformedURLException ex) {
    File f = new File(pFileName);
    String path = f.getAbsolutePath();
    String fs = System.getProperty("file.separator");
    System.out.println(" path of file : "+path +"separator " +fs);
    if (fs.length() == 1) {
    char sep = fs.charAt(0);
    if (sep != '/')
    path = path.replace(sep, '/');
    if (path.charAt(0) != '/')
    path = '/' + path;
    path = "file://" + path;
    System.out.println("path is : "+path);
    // Try again, if this throws an exception we just raise it up
    url = new URL(path);
    } // End catch block
    return url;
    } // end method create URL
    public static void main (String args[]) {
         MergeXMLTest mXML = new MergeXMLTest();
         mXML.merge();
    }

    see my answer here: http://forum.java.sun.com/thread.jsp?forum=34&thread=304647
    ps. if you know a little of XPath, this is why text() is a special kind of node()...

  • Getting error while running the XML file using XML Publisher Desktop

    Hi all,
    We have successfully loaded the XML file using XML Publisher Desktop. But when we preview the same using PDF format we are getting the following error.
    Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\Documents and Settings\smanmadh\Desktop\ProductCompensationDT.xml
    FOProcessor setLocale: en-us
    java.lang.NullPointerException
         at oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
         at oracle.apps.xdo.template.fo.IDManager.registerId(IDManager.java:44)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageJoinSeq(AreaTree.java:1106)
         at oracle.apps.xdo.template.fo.area.AreaTree.incrementJoinSequenceIndex(AreaTree.java:219)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageDocument(AreaTree.java:1089)
         at oracle.apps.xdo.template.fo.area.AreaTree.forceOutput(AreaTree.java:471)
         at oracle.apps.xdo.template.fo.elements.FORoot.end(FORoot.java:58)
         at oracle.apps.xdo.template.fo.FOHandler.endElement(FOHandler.java:386)
         at oracle.xml.parser.v2.XMLContentHandler.endElement(XMLContentHandler.java:196)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1212)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
         at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:279)
         at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1022)
         at RTF2PDF.runRTFto(RTF2PDF.java:626)
         at RTF2PDF.runXDO(RTF2PDF.java:460)
         at RTF2PDF.main(RTF2PDF.java:251)
    Thanks in Advance.
    Sudeep.

    This is BI related. You will get a quicker answer from the BI Publisher forum
    BI Publisher

  • Error while running the XML file using XML Publisher Desktop

    Hi All,
    We have successfully loaded the XML file using XML Publisher Desktop.But when we try to preview it using the PDF format we are getting the following error.
    Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\Documents and Settings\smanmadh\Desktop\ProductCompensationDT.xml
    FOProcessor setLocale: en-us
    java.lang.NullPointerException
         at oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
         at oracle.apps.xdo.template.fo.IDManager.registerId(IDManager.java:44)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageJoinSeq(AreaTree.java:1106)
         at oracle.apps.xdo.template.fo.area.AreaTree.incrementJoinSequenceIndex(AreaTree.java:219)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageDocument(AreaTree.java:1089)
         at oracle.apps.xdo.template.fo.area.AreaTree.forceOutput(AreaTree.java:471)
         at oracle.apps.xdo.template.fo.elements.FORoot.end(FORoot.java:58)
         at oracle.apps.xdo.template.fo.FOHandler.endElement(FOHandler.java:386)
         at oracle.xml.parser.v2.XMLContentHandler.endElement(XMLContentHandler.java:196)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1212)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
         at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:279)
         at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1022)
         at RTF2PDF.runRTFto(RTF2PDF.java:626)
         at RTF2PDF.runXDO(RTF2PDF.java:460)
         at RTF2PDF.main(RTF2PDF.java:251)
    Any pointers will be of great help.
    Thanks in Advance
    Sudeep.


    I had a similar error which when I searched, came up with this thread.
    My issue was resolved after I discovered that my RTF template was not really RTF. It was sill in MS Word DOC format. This was discovered by reviewing two templates in NOTEPAD. The MS-DOC files have a lot of "special" characters in them. My RTF was not really RTF.
    After doing a SAVE AS - RTF format, then the preview worked as expected.
    Just Sharing...
    --Tim                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error while validating the xml file

    Hello All,
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    DocumentBuilder db = dbf.newDocumentBuilder();
    doc = db.parse(new ByteArrayInputStream(xmlString.getBytes()));
    In this code even though I have set the validation of instance of DocumentBuilderFactory to false it still tries to validate the xml file using the dtd. How do I avoid the validation of the xml file by the dtd file ?.
    Is anybody having any suggestions for that ?.
    Help needed urgently.
    Thanks and regards,
    Sachin

    Thanks for the prompt help. Is there any other way instead of removing the DTD line ?. Because the xml is coming as a string and removing the dtd and then adding it will unneccesary hamper performance. Do you any other way in which even though I don't remove the line I get the output without removing the dtd line ?.
    thanks and regards,
    Sachin

  • Problems with and tags while reading the xml file

    Hi
    I am using the xml files in my project. The project uses Tomcat, JMS. The project is divided into some components which communicate with each oher thru JMS. The component for which I am responsible gets a dcoument object from the JMS which is a processed xml of the following format (the processing is done by the DBMS_XMLGEN package of oracle)
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <filename>157_1000000001</filename>
    <querydata>
    <tabdata>
    <tabinfo>Tab-id3</tabinfo>
    <queryset>
    <query name="Fax">
    select a.ARLN_NAME,d.TICKETED_ORIGIN,d.TICKETED_DESTINATION, d.ENDORSEMENTS,to_char(d.DATE_OF_ISSUE,'DDMONYY') as DATE_OF_ISSUE ,d.EXCHANGE_DOC_TYPE,
                   d.PASSENGER_NAME,d.ORIG_ISS_AIRLINE,d.ORIG_DOC_NO,d.ORIG_PLACE_OF_ISSUE,
                   to_char(d.ORIG_DATE_OF_ISSUE,'DDMONYY'),d.ORIG_ISSUE_AGENT,d.CUR_OF_SALE,d.GROSS_FARE,d.EQUIV_CUR_OF_SALE,d.EQUIV_FARE,
                   d.PANDA_DEAL_CODE,d.ISI,d.reporting_date
                   from airline_master a,ticket_main d,ticket_conj e where d.doc_no = e.doc_no and d.iss_airline = e.iss_airline
                   and e.conj_doc_no = (select DOC_NO from TICKET_CONJ where CONJ_DOC_NO = 1000000001 and ISS_AIRLINE = 157)
                   and e.ISS_AIRLINE = 157 and d.iss_airline = a.ARLN_NUM_CODE
    </query>
    </queryset>
    </tabdata>
    </querydata>
    the function on my side is like this
    private void processMessage(ObjectMessage objmessage)
         Document XMLreqObject = (Document) objmessage.getObject();
         Element root = XMLreqObject.getRootElement();                
         String resultFilename = root.getChildText("filename");
         Element tabSet = root.getChild("querydata");//doesnt work
         ArrayList tabSetlist = new ArrayList(tabSet.getChildren ("tabdata"));//doesnt work
    The code commented with "doesnt work", is not working. What must be the problem ?
    Thanks in Advance
    Martin

    Okay. Your original example XML didn't include < or > which was rather confusing if that particular feature was supposed to be the cause of the problem. Also calling them "tags" was rather confusing since "tags" is the term for the things that come at the beginning and of an element, like this:<data>...</data>Anyway, I assume your theory is that documents that don't have < in a text element process correctly and documents that do have < in a text element get "stuck" in the parser? Well, from your original description the process appears to be:
    1. Create XML
    2. Parse it into a Document
    3. Send the Document via JMS
    4. Receive the Document via JMS
    5. Process it.
    And it's step 4 that is "stuck"? That would be my guess based on the code you posted.

  • Reading the xml file in customized table.

    Hi Experts ,
    I have a requirement to read the xml file in one "z" table . Can anyone let me know the exact steps .
    Thank you
    Ashutosh

    Hi Ashutosh,
    1. First read the file in BINARY MODE into an XSTRING.
    2. Then use the method create_istream_xstring to create the input stream
    3. Then you need to create the document tree and the parser
    4. Once your Document tree and your parser are created now can use the document tree to access individual elements.
    Some Class interfaces that maybe helpful to you are as follows: if_ixml_node, if_ixml_node_iterator, if_ixml_element....etc
    DATA:o_ixml                    TYPE REF TO if_ixml,
               o_streamfactory   TYPE REF TO if_ixml_stream_factory,
               o_istream              TYPE REF TO if_ixml_istream.
               o_parser               TYPE REF TO if_ixml_parser          
               o_document          TYPE REF TO if_ixml_document
    o_ixml = cl_ixml=>create( ).
    o_istream = o_streamfactory->create_istream_xstring( string = <give the xstring name here>).
    o_document = o_ixml->create_document( ).
    o_parser = o_ixml->create_parser( stream_factory = o_streamfactory
                                                                           istream = o_istream
                                                                       document = o_document ).
    You can make the final code as dynamic as possible to read into an internal table.
    Regards
    -Joe

  • Unable to open the XML files in Nakisa

    Hi Gurus,
    We are unable to open certain XML files in Nakisa. They show up as encrypted in the notepad or fail to open using the XML Marker. The files in question are
    AppResources.xml
    LoginConfiguration_SAP_Standard
    LoginConfiguration_Anonymous
    Purpose: We want to enable the SSO with the portal . We have checked the radio button but nakisa does not recognize the SSO ticket from the portal (Any folder in Nakisa where we need to place the Portal ticket?)
    Also we want Nakisa to show the org chart for the logged in user. Luke had mentioned that some changes need to be made in the AppResources.xml (hope i correctly remember this) and we were looking to make these changes (rather try out.. any pointers please..?)
    Thanks and Regards,
    Arun E V

    Hi Arun,
    These files are encrypted. If your organisation is a partner with Nakisa you can obtain the decrypter from them.
    Portal SSO works without any configuration directly in the XML files. If you are getting an error stating that the Portal ticket cannot be interpreted then your configuration is not correct. In your URL iView you need to ensure the fully qualified domain name (FQDN) is used for the application URL. In the Administrator Console you need to ensure you enter the system details (Host, Sys Nr and Client) for the backend system which holds your SSO ticket for that Portal. You need to use FQDN here too.
    There is additional security configuration that can be done in the XML files but SSO will still work with just the Administrator Console configuration.
    I hope that helps!
    Luke

  • How to write inline DTD  to the xml file?

    Hi All,
    I have java program which outputs a xml file! Currently I need to alter this program to insert inline DTD code in the output xml file.
    I want the xml file to look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE students[
    <!ELEMENT firstname (#PCDATA)>
    <!ELEMENT ssn (#PCDATA)>
    <!ELEMENT student (ssn, firstname)>
    <!ELEMENT students (student+)>
    ]>
    <students>
    <student>
    <ssn>444111110</ssn>
    <firstname>Jacob</firstname>
    </student>
    </students>
    Existing file is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE students SYSTEM "StudentsDTDfile.dtd">
    <students>
    <student>
    <ssn>444111110</ssn>
    <firstname>Jacob</firstname>
    </student>
    </students>
    The DOCTYPE line can be inserted into the xml using transfomer output key but then that always is for external dtd.
    It brings in the line <!DOCTYPE name SYSTEM " path"> .
    But i need an internal DTD. SO it should look like
    <!DOCTYPE name [<ELEMNETS>]>
    I am using DocumentBuilder class.
    Thanks in advance,
    Mathew
    Edited by: Mathew_Jacob on Jul 12, 2008 12:49 AM

    Or If Labview schema is acceptable, it is fairly straight forward.
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • How to import the xml file into bcc?

    My input file to atg is xml which contain category or products assets.
    I want the scheduler to run in such a way that it should auto create a project and send an email to client for approval.
    When the client approves the xml file,then run the scheduler to input the xml file datas into bcc.
    i will be using : SingletonSchedulableService for this
    Give me a guidance for the same.
    Thanks in advance.

    I want to implement this in bcc.
    Which listener will listen for the approval of the client for the email (which contains the xml to import)we sent to him?
    You would have to do custom development to hook your custom workflow with the inbound email. For sending email notifications the action is already there and while creating its element in ACC you can specify a JSP for the email template. You may refer following relevant documentation:
    Oracle ATG Web Commerce - Workflows
    Oracle ATG Web Commerce - Workflow Action Elements
    I recommend to refer the existing DeploymentEmailer source in <ATG>\Publishing\samples\Java and see different DeploymentEvent types and states can be used based on your requirement in your custom component. Also refer these API javadocs to know about the available deployment events and process:
    DeploymentEvent (ATG Java API)
    DeploymentServer (ATG Java API)
    ATG does have a /atg/dynamo/service/POP3Service component to retrieve mails from a POP3 e-mail server but it is primarily used for detecting the bounced email. Not too sure if it would help or fit in your case but still you can go through about its details to know what is already there:
    Oracle ATG Web Commerce - Bounced E-mail
    You may also refer to the InboundEmail event and API javadocs for InboundEmailMessage which are used in this bounced email detection feature:
    Oracle ATG Web Commerce - InboundEmail Event
    InboundEmailMessage (ATG Java API)
    Now based on all this, if you extend and customize a lot of things it would be bit complex and tedious to detect the inbound approval mail based on its content and then advance your workflow. Another approach can be to put a URL in the mail template of your notification email which the approver would have to click and on the landing page you can authenticate and advance your custom workflow as required.

  • How to generate the XML file to HTML?

    Hi all,
    I am new to XML.
    Can I somehow see the HTML-Output of the XML-File, when I have the XSL-File too, but don't use any XML-Editor (XMLSpy) and FOP? I do not want use any additional tools - only the database tools.
    What I need for this?
    Do I need the XSLT-File too?
    ============================
    My test.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="test.xsl"?>
    <ROW num="1">
         <TABLE_NAME>ABR_ART_ABR_DAU_MATRIX</TABLE_NAME>
         <TABLESPACE_NAME>PS2000_STAMM</TABLESPACE_NAME>
         <PCT_FREE>10</PCT_FREE>
         <INI_TRANS>1</INI_TRANS>
         <MAX_TRANS>255</MAX_TRANS>
         <INITIAL_EXTENT>516096</INITIAL_EXTENT>
         <NEXT_EXTENT>65536</NEXT_EXTENT>
         <MIN_EXTENTS>1</MIN_EXTENTS>
         <MAX_EXTENTS>2147483645</MAX_EXTENTS>
         <PCT_INCREASE>0</PCT_INCREASE>
         <LOGGING>YES</LOGGING>
         <BACKED_UP>N</BACKED_UP>
         <NUM_ROWS>33</NUM_ROWS>
         <BLOCKS>20</BLOCKS>
         <EMPTY_BLOCKS>0</EMPTY_BLOCKS>
         <AVG_SPACE>0</AVG_SPACE>
         <CHAIN_CNT>0</CHAIN_CNT>
         <AVG_ROW_LEN>100</AVG_ROW_LEN>
         <AVG_SPACE_FREELIST_BLOCKS>0</AVG_SPACE_FREELIST_BLOCKS>
         <NUM_FREELIST_BLOCKS>0</NUM_FREELIST_BLOCKS>
         <DEGREE> 1</DEGREE>
         <INSTANCES> 1</INSTANCES>
         <CACHE> N</CACHE>
         <TABLE_LOCK>ENABLED</TABLE_LOCK>
         <SAMPLE_SIZE>33</SAMPLE_SIZE>
         <LAST_ANALYZED>1/8/2004 11:45:1</LAST_ANALYZED>
         <PARTITIONED>NO</PARTITIONED>
         <TEMPORARY>N</TEMPORARY>
         <SECONDARY>N</SECONDARY>
         <NESTED>NO</NESTED>
         <BUFFER_POOL>DEFAULT</BUFFER_POOL>
         <ROW_MOVEMENT>DISABLED</ROW_MOVEMENT>
         <GLOBAL_STATS>YES</GLOBAL_STATS>
         <USER_STATS>NO</USER_STATS>
         <SKIP_CORRUPT>DISABLED</SKIP_CORRUPT>
         <MONITORING>NO</MONITORING>
         <DEPENDENCIES>DISABLED</DEPENDENCIES>
         <COMPRESSION>DISABLED</COMPRESSION>
    </ROW>
    ============================
    ============================
    My test.xsl-file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:output method="html"/>
    <xsl:template match="/">
    <html>
    <head>
    <title>Test XSL ALL_TABLES</title>
    </head>
    <body>
    <xsl:for-each select="ROW">
    <h2>Tabelle: <xsl:value-of select="TABLE_NAME"/></h2>
         <hr/>
         <table border="1" cellpadding="0">
                             <tr>
                             <td><xsl:value-of select="TABLESPACE_NAME"/></td>
                             <td><xsl:value-of select="PCT_FREE"/></td>
                             </tr>
                        </table>
              </xsl:for-each>          
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    ============================
    I am waiting for your answers, when possible with examples please.
    Regards
    Leonid Pavlov

    XSLT to convert the XML document to Html:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>
    <xsl:template match="/">
    <html>
    <head>
    <title>Test XSL ALL_TABLES</title>
    </head>
    <body>
    <table border="1" cellspacing="0">
    <tr>
    <th>TABLE NAME</th>
    <th>TABLESPACE NAME</th>
    <th>PCT FREE</th>
    </tr>
    <xsl:for-each select="ROW">
    <tr>
    <td><xsl:value-of select="TABLE_NAME"/></td>
    <td><xsl:value-of select="TABLESPACE_NAME"/></td>
    <td><xsl:value-of select="PCT_FREE"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

Maybe you are looking for