CDATA section in a tag of an XML file

Hi SDNers:
I have an issue with using the method CREATE_CDATA_SECTION of Interface IF_IXML_DOCUMENT.
I have created an XML file from ABAP using methods in IF_IXML_DOCUMENT etc.
The XML file is perfectly alright. But now there's a need to add CDATA section.
I need the CDATA section as follows in XML file...
<CustomField>
    <![CDATA[
          First Line of Text
          Second line of Text
          Third Line of Text
      ]]>
</CustomField>
but don't know how to program this. Can anybody help/advice me on this?
Looking forward to your optimum response(s).
Best Regards

Hi SDNers:
I have an issue with using the method CREATE_CDATA_SECTION of Interface IF_IXML_DOCUMENT.
I have created an XML file from ABAP using methods in IF_IXML_DOCUMENT etc.
The XML file is perfectly alright. But now there's a need to add CDATA section.
I need the CDATA section as follows in XML file...
<CustomField>
    <![CDATA[
          First Line of Text
          Second line of Text
          Third Line of Text
      ]]>
</CustomField>
but don't know how to program this. Can anybody help/advice me on this?
Looking forward to your optimum response(s).
Best Regards

Similar Messages

  • How to quick import Tags from a xml file?

    Good morning/afternoon/night everyone.
       I have this client that want me to import something like 1000 tags from a xml file in CQ5.5. I know I can do it programatically and in dev.day.com I have already found some instructions, but, there is some easier way to do this? Or, if the only way is developing a bundle to run in a workflow (and then the client can import tags from xml files anytime he want to), do you guys have some advice or guidelines?
    Thanks!

    I would expect it should be possible using vault. If you export an existing namespace from cq using vault (checkout/update) you can see what format it should be in. Then you should convert your xml to match that format (perhaps using XSLT) and use vault in the other direction (commit).
    We are using vault all the time behind the scenes using a vault plugin for maven. This way we can export content from one developer's cq instance, put it in SVN and have another developer import it in his cq instance, all using maven (and vault). This is especially usefull for general content structures and for tags.

  • Can the "mode" tag in vhost.xml file be edited using getconfig() and setconfig()?

    can the "mode" tag in vhost.xml file be edited using getconfig() and setconfig()?

    You can create client and have following code in it: (But before that Admin Server is running on the machine which you want make edge server programatically)
    var admin_nc = new NetConnection();
    sendCommand.enabled = false;   // where sendCommand is button on stage with "sendCommand" as instance name
    admin_nc.onStatus = function(info) {
    if (info.code == "NetConnection.Connect.Success")
    sendCommand.enabled = true;
    sendBtn.addEventListener("click", callAdminAPI);
    function callAdminAPI() {
    admin_nc.call("setConfig2",new Result1(),"Proxy/Mode","remote","Adaptor:_defaultRoot_/VHost:_defaultVHost_");
    function Result1() {
          this.onResult = function(info) {
    if (info.code == "NetConnection.Call.Success" ) {
    admin_nc.call("startServer",new Result2(),"restart"); // you can might as well use restartVHost
    function Result2(){
    this.onResult = function(info) {
    if (info.code == "NetConnection.Call.Success" ) {
    trace("Server started successfully);
    admin_nc.connect("rtmp://<your Edge Server IP>:1111/admin","admin","admin");  //here admin/admin is userid/password of Admin of server

  • Getting an error while changing a tag in an XML file

    Hi,
    When I am trying to replace the existing XML tag with other one I am getting the following exception:
    org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.
    at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
    at org.apache.xerces.dom.ParentNode.replaceChild(Unknown Source)
    at org.apache.xerces.dom.CoreDocumentImpl.replaceChild(Unknown Source)
    at com.Replace_Tag.replaceNode(Replace_Tag.java:97)
    at com.Replace_Tag.processRequest(Replace_Tag.java:39)
    at com.Replace_Tag.doGet(Replace_Tag.java:56)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    The following is the code I am using :
    public void replaceNode() throws Exception{
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse("file:/C:/Documents and Settings/srikanth.d.KNOAHSOFT/Desktop/Linechart.jrxml");
            Element root = doc.getDocumentElement();
            Element newElement = doc.createElement("stackedBarchart");
            NodeList oldList = root.getElementsByTagName("lineChart");
            int length = oldList.getLength();
            System.out.println("length::"+length);
            for(int i=0;i<length;i++)
                Node oldNode = oldList.item(i);
                NodeList nl = doc.getChildNodes();
    newElement.getTagName().toString());                   
    (i).getNodeName().toString());
                doc.replaceChild((Node)newElement, oldNode);           
    Can anybody help me in this regard...
    Thanks and Regards
    DNV Srikanth

    i am posting the xml file also :
    <?xml version="1.0" encoding="UTF-8"  ?>
    <!-- Created with iReport - A designer for JasperReports -->
    <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport
               name="Line chart"
               columnCount="1"
               printOrder="Vertical"
               orientation="Portrait"
               pageWidth="396"
               pageHeight="842"
               columnWidth="396"
               columnSpacing="0"
               leftMargin="0"
               rightMargin="0"
               topMargin="0"
               bottomMargin="0"
               whenNoDataType="NoPages"
               isTitleNewPage="false"
               isSummaryNewPage="false">
         <property name="ireport.scriptlethandling" value="2" />
         <property name="ireport.encoding" value="UTF-8" />
         <import value="java.util.*" />
         <import value="net.sf.jasperreports.engine.*" />
         <import value="net.sf.jasperreports.engine.data.*" />
         <queryString><![CDATA[select * from evalsubcomparison where qacount1 between 70.0 and 75.0]]></queryString>
         <field name="EmpId" class="java.lang.Double"/>
         <field name="Empname" class="java.lang.String"/>
         <field name="BaseEmpId" class="java.lang.Double"/>
         <field name="QACount1" class="java.lang.Double"/>
         <field name="WeekId1" class="java.lang.String"/>
         <field name="QACount2" class="java.lang.Double"/>
         <field name="WeekId" class="java.lang.String"/>
         <field name="QACount3" class="java.lang.Double"/>
         <field name="WeekId3" class="java.lang.String"/>
         <field name="QACount4" class="java.lang.Double"/>
         <field name="WeekId4" class="java.lang.String"/>
         <field name="level" class="java.lang.Double"/>
              <background>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </background>
              <title>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </title>
              <pageHeader>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </pageHeader>
              <columnHeader>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </columnHeader>
              <detail>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </detail>
              <columnFooter>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </columnFooter>
              <pageFooter>
                   <band height="0"  isSplitAllowed="true" >
                   </band>
              </pageFooter>
              <summary>
                   <band height="301"  isSplitAllowed="true" >
                        <lineChart>
                             <chart  hyperlinkTarget="Self" >
                             <reportElement
                                  mode="Opaque"
                                  x="0"
                                  y="0"
                                  width="390"
                                  height="300"
                                  backcolor="#FFFFFF"
                                  key="element-1"/>
                             <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                                  <chartLegend textColor="#000000" backgroundColor="#FFFFFF" >
                             <font fontName="Times New Roman" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/>
                             </chartLegend>
                             </chart>
                             <categoryDataset>
                                  <dataset >
                                  </dataset>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId1}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount1}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount2}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId3}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount3}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                                  <categorySeries>
                                       <seriesExpression><![CDATA["WE "+$F{WeekId4}]]></seriesExpression>
                                       <categoryExpression><![CDATA[$F{Empname}]]></categoryExpression>
                                       <valueExpression><![CDATA[$F{QACount4}]]></valueExpression>
                        <itemHyperlink >
                        </itemHyperlink>
                                  </categorySeries>
                             </categoryDataset>
                             <linePlot >
                                  <plot backcolor="#FFFFFF" />
                                  <categoryAxisFormat>
                                       <axisFormat >
                                       </axisFormat>
                                  </categoryAxisFormat>
                             <valueAxisLabelExpression><![CDATA["No. of Evaluations"]]></valueAxisLabelExpression>
                                  <valueAxisFormat>
                                       <axisFormat >
                                            <labelFont>
                             <font fontName="Serif" pdfFontName="Helvetica" size="14" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/>
                                            </labelFont>
                                            <tickLabelFont>
                                            </tickLabelFont>
                                       </axisFormat>
                                  </valueAxisFormat>
                             </linePlot>
                        </lineChart>
                   </band>
              </summary>
    </jasperReport>can anybody pls help me in this regard......

  • Selecting the first 4000 characters from a tag in an xml file

    Oracle Enterprise Edition 11.1.0.7 64 bit (Jan 2012 CPU applied)
    Windows 2003 64 bit
    We have an XML file with the following sample format.
    <?xml version="1.0"?>
    <HR>
    <EMP>
    <FNAME>JOHN</FNAME>
    <LNAME>DOE</LNAME>
    <COMMENT>Comment with less than 4000 characters</COMMENT>
    </EMP>
    <EMP>
    <FNAME>JANE</FNAME>
    <LNAME>DOE</LNAME>
    <COMMENT>Comment with more than 4000 characters</COMMENT>
    </EMP>
    </HR>
    The query below
    (full disclosure: which I took from odie_63's response in Creating External Table using Xml Dataset - how to include null values? and added the CURSOR_SHARING_EXACT hint on the top)
    works when the contents of the <Comment> tag are smaller than 4000 characters. If it is more than 4000 I get
    ORA-01706: user function result value was too large
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'COMMENT'
    I found another query where someone was doing a substring (I think to get only the first 4000 characters from the tag) here.
    http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14638197 (See OP's post)
    TERMINATION_DATE VARCHAR(32) path 'TerminateDate/substring(text(), 1, 32)',
    So I updated my query to be
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'COMMENT/substring(text(),1,4000)'
    The query runs without an error when the <comment> tag has 4000 or less characters but still errors out with it is more than 4000.
    I found an alternative method to do the SUBSTRING here in Herald ten Dam's reponse in Re: A view over XML that is not 1:1
    code varchar2(30) path 'substring(code,1,3)',
    so I tried this:
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'substring(COMMENT,1,4000)'
    but that doesn't work either.
    How can I extract the first 4000 characters of the <COMMENT> tag so that the query doesn't fail.
    We are not using any other XMLDB features at this time. This is the first we've started looking into using Oracle built in XML features, so we might not have setup something that other's might know to specifically setup to start using the XML features in Oracle 11.1
    Thanks in advance,
    Wally

    walls99 wrote:
    This is regardless of the COMMENTS tag being 4000 characters or more and the same with the ideas from Odie.
    WallyNo idea if it is an issue with your version. I don't have your version to test but following works for me. Does this simple test work?
    SQL> select * from v$version ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> set define off
    SQL> select dbms_xmlgen.convert(xmlserialize(content xmltype('<brand>Ben &amp; Jerry</brand>') as clob), 1) from dual ;
    DBMS_XMLGEN.CONVERT(XMLSERIALIZE(CONTENTXMLTYPE('<BRAND>BEN&AMP;JERRY</BRAND>')A
    <brand>Ben & Jerry</brand>

  • 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.

  • How to parse all the data of the particular tag in the xml file

    Hi All,
    I have a xml file, which have tags like, code,rev_num,type...volunteer.I want to parse the xml and save the all data(code,rev_num...) of the tag <type>unknown </type>in a text file. I tried to use a Match node vi but I not geting the output i need.attach is my attempt , can anyone suggest me or help me out.(Sorry Cant attach the xml hence i saved it as an text file.)
    Thanks,
    Ankit G
    Solved!
    Go to Solution.
    Attachments:
    teeth.txt ‏385 KB
    Xml parse.vi ‏22 KB

    TailOfGon wrote:
    Do you want to extract all the data with type='unknown'?
    Then try the XPath like this: 
    resource[type='unknown']/code
    Hi,
    Yes I want to extract all the data of the type = "unknown", I tried Xpath resource[type='unknown']/code but it didnt work , I still getting all other data of different type .
    Thanks,
    Ankit G

  • How to put color combination like red/blue tag in the XML file

    Hi experts,
    i have developed one program to capture some DATA in one internal table.it contains 2 fields called addition flag and dedletion flag.then i have wriiten the following code for converting  the XML file for the above internal table data.i am passing this internal table in the following FM ''SDIXML_DATA_TO_DOM'.But as per our requirement,they need the REd color tag for addition flag and blue Color tag for the deletion flag in the Above XML File for the respective addition data item and deletion data item.how to do???
    Any suggestion can be Appreciated.its very urgent
    Thanx in advance.
    Regards,
    HPP.
    The code is wriiten for converting internal table to XML file.
    DATA: l_dom TYPE REF TO if_ixml_element,
      m_document TYPE REF TO if_ixml_document,
      g_ixml TYPE REF TO if_ixml,
      w_string TYPE xstring,
      w_size TYPE i,
      w_result TYPE i,
      w_line TYPE string,
      it_xml TYPE dcxmllines,
      s_xml LIKE LINE OF it_xml,
      w_rc LIKE sy-subrc.
      DATA: xml TYPE dcxmllines.
      DATA: rc TYPE sy-subrc,
      BEGIN OF xml_tab OCCURS 0,
      d LIKE LINE OF xml,
      END OF xml_tab.
    *XML conversion -internal table to XML Format.
      CLASS cl_ixml DEFINITION LOAD.
      g_ixml = cl_ixml=>create( ).
      CHECK NOT g_ixml IS INITIAL.
      m_document = g_ixml->create_document( ).
      CHECK NOT m_document IS INITIAL.
      WRITE: / 'Converting DATA TO DOM 1:'.
      CALL FUNCTION 'SDIXML_DATA_TO_DOM'
        EXPORTING
          name         = 'it_prop'
          dataobject   = it_prop[]
        IMPORTING
          data_as_dom  = l_dom
        CHANGING
          document     = m_document
        EXCEPTIONS
          illegal_name = 1
          OTHERS       = 2.
      IF sy-subrc = 0.
        WRITE 'Ok'.
      ELSE.
        WRITE: 'Err =',
        sy-subrc.
      ENDIF.
      CHECK NOT l_dom IS INITIAL.
      w_rc = m_document->append_child( new_child = l_dom ).
      IF w_rc IS INITIAL.
        WRITE 'Ok'.
      ELSE.
        WRITE: 'Err =',
        w_rc.
      ENDIF.
      CALL FUNCTION 'SDIXML_DOM_TO_XML'
        EXPORTING
          document      = m_document
        IMPORTING
          xml_as_string = w_string
          size          = w_size
        TABLES
          xml_as_table  = it_xml
        EXCEPTIONS
          no_document   = 1
          OTHERS        = 2.
      IF sy-subrc = 0.
        WRITE 'Ok'.
      ELSE.
        WRITE: 'Err =',
        sy-subrc.
      ENDIF.
      LOOP AT it_xml INTO xml_tab-d.
        APPEND xml_tab.
      ENDLOOP.
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          bin_filesize = w_size
          filename     = 'C:\prop.XML'
          filetype     = 'BIN'
        TABLES
          data_tab     = xml_tab
        EXCEPTIONS
          OTHERS       = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    TailOfGon wrote:
    Do you want to extract all the data with type='unknown'?
    Then try the XPath like this: 
    resource[type='unknown']/code
    Hi,
    Yes I want to extract all the data of the type = "unknown", I tried Xpath resource[type='unknown']/code but it didnt work , I still getting all other data of different type .
    Thanks,
    Ankit G

  • Delete xml messagetype tag and xml versioning tag in target xml file

    Hi experts.
    i want to delete the xml version, starting (<MT_ZMPSSERRMSGMST_SEND>*and ending </MT_ZMPSSERRMSGMST_SEND> tags in below message.
    here i am bold the tags which i want to delete. please help me how to delete this.
    <?xml version="1.0"; encoding="UTF-8"?>
    <MT_ZMPSSERRMSGMST_SEND>
       <MESSAGE>
          <TABLENAME/>
          <ACTION/>
          <RECORD>
             <ERRORID/>
             <ERRCLASSID/>
             <SHORTDESC/>
             <DESCRIPTION/>
             <RESOLVE/>
          </RECORD>
       </MESSAGE>
    </MT_ZMPSSERRMSGMST_SEND>

    Hi Srinivas,
    You can delete the required content of the XML by editing the XML.
    Develop a custom adapter module and use the below code to edit the xml and deleting the highlighted content
    // to read the input XML
    strData = xmlData.getText();
    // get the length of <?xml version="1.0"; encoding="UTF-8"?> <MT_ZMPSSERRMSGMST_SEND>
    int strheaderlength = (strData.substring(0,strData.indexOf("<Message>")).length());
    // read the data from <MESSAGE>  to </MESSAGE>
    String payload=strData.substring(strheaderlength,strData.startIndexOf("</MT_ZMPSSERRMSGMST_SEND>"))
    // set the new payload to xmlData
    xmlData.setText(payload);
    appreciate if useful

  • How do I delete some text in a tag in the XML file?

    I need help with removing some text inside the tags so I can use it as a XMLfile
    string example
    Code
    <Event xmlns="http://SwitchKing.Common/Entities/RESTSimplified/2010/07" >
    <Description i:nil="true"/>
    So these are the tags inside the file that is stopping my work. 
    I cant seem to find a way to remove the xmlns.... or the i:nil...
    The i:nil gives of a error when trying to read the file and the xmlns stops the search for other tags in the file.
    So when I have loaded the data I need to delete some text in the tags.
    Help!

    If you want to delete photo stream photos, just deleted them from your device and they will be deleted from iCloud and your other devices.  Be sure you don't want them as you cannot get them back once you delete them.

  • CDATA in xml file

    Hi everybody
    Can anyone tell me the best way to transform parts of my xml file as CDATA ?
    For some part of my xml file i need the '&lt' '&gt' instead of < and > .
    Thanks for your help

    Hi michal
    I tried using [[!CDATA in different formats as you suggested but none is producing the desired result. Can you identify which format you have exactly used and let me know please?
    This is my xml file
    <ns0:QueryString_Initial_MT xmlns:ns0="urn:ABG.com/EDI/PurchaseOrders">
       <pin/>
       <user_id/>
       <pwd/>
       <orders_lines>
          <isbn>sfdg</isbn>
          <record_dues>fgfh</record_dues>
          <part_supply>fdg</part_supply>
          <order_quantity>fdds</order_quantity>
          <order_line_reference>ffg</order_line_reference>
          <special_instructions>f</special_instructions>
          <affiliate_id>dfg</affiliate_id>
          <promotional_code>df</promotional_code>
       </orders_lines>
       <orders_ref>f</orders_ref>
    </ns0:QueryString_Initial_MT>
    I want the <orders_line> tag and its sub tags to be presented as a string.
    Even an XSLT for it be a great help.
    thanks a lot

  • How to parse xml file to read the tags

    Hi All,
    I am having a requirement to read the tags from the xml file(xml parsing).
    The main issue is *xml file is stored in the table with xml type column* (not placed directly in the server) and we have to read the tags from that xml file.
    Please help me to achieve it.
    Regards,
    Akshata
    Edited by: Akshata on Mar 21, 2013 3:44 AM

    Hi,
    Akshata wrote:
    The main issue is xml file is stored in the table clob/blob type column (not placed directly in the server) and we have to read the tags from that xml file.How is that an issue? On the contrary, it's better when the data already resides in the database, though it should be in an XMLType column to leverage the full capacity of the Oracle parser.
    What's the datatype of the column exactly? CLOB or BLOB?
    Either way you'll have to convert in to XMLType datatype using the XMLType constructor.
    Did you go through the countless examples on this forum? Examples with XMLTable should be helpful.
    Post some sample data and database version if you need additional guidance.
    Thanks.

  • How to make the tags in XML file case insensitive

    Hi,
    I have a ReadXML class which reads an xml file. This class also has a method which receives a string-child from another class and uses this string-chile to match it with the child tag in the xml file, and returns the child tag's value.
    Now, my problem is this, the child tag in xml may be in a case different from the case of the string-child received from another class.
    How do I modify it, so the program does not return a null pointer exception because the strings did not match for want of uppercase or lowercase letters.
    Thanks
    Sangeetha

    I'm not sure what you are getting at. Is a string child the contents of a node treated as text?
    If you are trying to match a child node regardless of case I doubt this is possible as the XML standard says an XML document is case sensitive so if your parser ignored case it would not be XML complient.
    Hope this helps.

  • Creating the DTD tag in an XML Documento

    I am using the Xalan XLST Transformer to generate XML documents.
    I want to include a DTD tag in each XML file and in my programs I create it using the following code:
    DocumentType dt = documento.getImplementation().createDocumentType(nombreDTD, nombreDTD, nombreArchivo);
    documento.appendChild(dt);
    ..The variable documento is the root element of the document, nombreDTD is the name identifying the root element tag, nombreArchivo is the name of the DTD file I want to reference.
    However when the XML output is generated, the DTD tag is always missing.
    Do anybody have any idea what might be causing this?
    Thanks,
    Color

    XSLT has its own method of putting the DTD information in the XML it creates. Include an xsl:output element in your XSL transformation like this:
    <xsl:output doctype-public="..." doctype-system="..." />

  • How to edit an XML file?

    Guys, I have a podcast in iTunes, I want to start to promote it. In order to do this, I think I will have to put tags in the XML file for different sites and I would like to know how to edit this. Does anyone have any good places for me to check out how to do this?
    Thanks!

    Vinnie, thanks for getting back to me on this, I am pulling my hair out!
    What FAQ are you speaking of? The one in iTunes or someplace on this board?
    By claim, what I mean is this. Lets say I try to add my podcast to Podcast Alley's directory. If I copy and paste my RSS feed in there, it says that it needs me to add their "tag" or whatever in my RSS so they know it is my podcast. They need me to add this line in the XML file I think to "claim" my podcast so it will show up in their directory. This seems to be a common thing with other sites as they give me some XML code to add to my RSS also.
    Make sense at all?

Maybe you are looking for

  • Dynamic Source directory path

    Hi Experts I am doing file to Idoc scenario. For the source file, the files can reside in different folders. Is it possible to handle the different folders in single communication channels or we need to create multiple communication channels for the

  • Diablo II Cinematics

    Hey. I've played Diablo II for a while on my iBook G4, I got an Intel iMac and installed it on there. I put my save file on the iMac but no cinematics came with it. I put the movies folder from the iBook on the iMac and still nothing. Is there a way

  • Can't hear loop playback

    Hi. I'm just starting out on Garageband and can't seem to hear loops in the loop browser. Any suggestions would be much appreciated. Thanks.

  • Dynamic Memory in the production environment

    Hi, We configure all production VMs with static memory  on Hyper-v 2012 we need to make sure there is no negative impact on VM performance if we use Dynamic memory , as we read for 2 years not recommend to use dynamic memory in the production. I pref

  • Business Scenario and Business Process in IR

    Business Scenario vs Business Process in IR??? Pls give the example for BPEL???