How can Powerbuilder parse an XML string using msxml 4.0 parser?

vikram_roy
vikram_roy used Ask the Experts™
on
Hello,
My Powerbuider application will receive an XML string from another application. This string will contain variety of information which i need to use in my application.But first i need to parse the XML string.
My Question is - How can Powerbuilder parse the XML string using MSXML 4.0 parser ??

(I have some notes below for msxml 4.0 at the following link but i need to implement the same in Powerbuilder:-

  MSXML 4.0 SDK Documentation:

 http://msdn.microsoft.com/library/default.asp? url=/library/en-us/xmlsdk/htm/sdk_intro_6g53.asp?frame=true )

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hello,

Basically it is just like using any other OLE object. If you have experience using XMLDOM this shouldn't be too bad. If you are learning MSXML, it will be much more challenging.

// Declare an OLE object as a reference to the parser
oleobject  lole_xml_document
 
// Identify the file to parse
string ls_filename = 'C:\MY.XML'
 
// Create the OLE Object
lole_xml_document = CREATE oleobject

// Connect to the parser
// NOTE : This example uses older parser from IE5.
// Use the class name 'MSXML2.DOMDocument.3.0'
// for the MSXML 3. You will have less function
// ality with this XMLDOM version, but safer as
// most machines have it.
lole_xml_document.ConnectToNewObject("Microsoft.XMLDOM")

// Load the file into memory (this will parse it)
lole_xml_document.load(ls_filename)
 
// ********************************************
// NOW YOU CAN TRAVERSE / MANIPULATE YOUR XML
// via ANY MSXML METHODS HERE!!
// See MSXML documentation for methods, etc.
//********************************************
 

// Disconnect from the XML parser
lole_xml_document.disconnectobject()
 
// Clean up
DESTROY lole_xml_document
Sorry I didn't notice you mentioned MSXML 4.0.

You will need to change the class name in the connecttonewobject method to point to version 4. I don't know the exact class name for that, but can find out if you need.

Best,
Rich Bianco

Author

Commented:
HI RichBianco,

2 points:-

a) The above example parses an XML document file. But i need to parse an XML string. How to do that ?

b) After parsing i need to take the components of the XML string into powerbuilder variables and use them. How to do that ?

Regards
Vikram
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Commented:
I develop opensource XML parser for PowerBuilder 6.5.
you can get it here.
http://www.mycgiserver.com/~unoksoftgroup/xml/

Author

Commented:
Hello buasuwan,
I downloaded your souce code in the user object unoksoft_xmlparser. But can you tell me as to how to use this i.e. which user object functions to use and where to give the xml string as input. Please let me know.

Regards
Vikram

Commented:
please download DEMO, it contains application object and 3 demo.
same above link.

Author

Commented:
Hello Buasuwan,
I got the demo and code...i am interested in the XML to Datawindow thing. Can i parse the contents of the XML and transfer into the datawindow without knowing the contents/fields in the XML ?? That is my requirement basically. I am not sure of the contents/fields in the XML but irrespective of the contents/fields in the XML i want it transferred to datawindow. Please let me know.

Regards
Vikram

Commented:
Hello Vikram,

>> and transfer into the datawindow without knowing
>> the contents/fields in the XML ??
   that's sound like a runtime Dynamic columns when transfer XML to datawindow? right?
   yes, you could do that.

first of all,
   please see DEMO:2.

second,
step 1: LoadXML(string XML_content)
now you will know all the name of these fields in TagName.
step 2: add your function createDatawindowFromXML(...)
now you need to create dynamic datawindow and return object.
step 3: call Export(object_that_you_create, ...)

If you want me to code this for you, please send some XML samples. I will add new function to my standard object for you.

Yuthasak Buasuwan.
uNokSoft Group.
http://www.mycgiserver.com/~unoksoftgroup/

Author

Commented:

Hello Buasuwan,
You got my requirement right.

I could not understand your solution well probably bcos i have less PB experience. Thus would request you to code and set up a demo for me regarding this dynamic field creation in datawindow as per the field in the XML string. Here is an example of an XML string that you can use :-

<command><command_type>1</command_type><APPNAME>QL</APPNAME><CALLER>SIEBEL</CALLER><MODNAME>Reservation</MODNAME><SCREENNAME>NewFinanceFurniture</SCREENNAME><VALUE>1234567890</VALUE></command>


Thanks for your help.

Regards
Vikram

Commented:
now version is 2.0.0a
- add function createDatawindow()
- add DEMO4: Dynamic Datawindow from XML content
please download both 2 files and test DEMO4.

http://www.mycgiserver.com/~unoksoftgroup/xml/

Author

Commented:

Hello buasuwan,
I tested the thing and was quite ok. BUT when i give the following XML string then the output is not correct:-

<School>
 <Student>
  <Rollno>1</Rollno>
  <Fname>Nikole</Fname>
  <Lname>Kidmann</Lname>
  <Standard>BE</Standard>
  <Divison>EE</Divison>
  <FirstTermMarks>200</FirstTermMarks>
  <SecondTermMarks>250</SecondTermMarks>
  <Grade>A</Grade>
 </Student>
</School>


It gives only 'student' as output.The remaining things under student do not come. When i remove the student from the string then it is ok. But that is not how it should be. The output should come irrespective of the structure of the XML string as long as the string is valid.

PLease advice.

Regards
Vikram

Commented:
sorry, Is that your final XML structure?

i have 2 choices,
one is here.


string     ls_xml_content
ls_xml_content = mle_input.text

unoksoft_XMLParser     XMLSchool

XMLSchool = create unoksoft_XMLParser
if XMLSchool.LoadXML(ls_xml_content) then
          long i
          i = 0
          unoksoft_XMLParser     XMLStudent
          XMLStudent = XMLSchool.getElement("")          
          do while isvalid(XMLStudent)
               i ++
               if i = 1 then XMLStudent.createDataWindow(dw_master)
               XMLStudent.Export(dw_master, "", false)
               XMLStudent = XMLSchool.getNextElement()
          loop
//     end if
end if
destroy XMLSchool




two, i will add more feature to function createDatawindow().
Commented:
Hello Vikram,
  i've done the second choice.
  please download new version 2.0.1, both files and test again.

  http://www.mycgiserver.com/~unoksoftgroup/xml/ 

Thanks,
Yuthasak Buasuwan.
uNokSoft Group.
http://www.mycgiserver.com/~unoksoftgroup/

Author

Commented:
Hello Buasuwan,
I guess it works for simple XML strings. But what about long and complex ones. Actually i am not sure about the structure of my XML string. But irrespective of the structure it should parse into the datawindow appropriately. Below is an example of a complex XML string which i copied from ur build.xml itself. How will u have something like this parsed into a datawindow ? :-

<project default="main" basedir=".">

  <!--
    Give user a chance to override without editing this file
    (and without typing -D each time he compiles it)
  -->
  <property file=".ant.properties"/>
  <property file="${user.home}/.ant.properties"/>

  <property name="name" value="james"/>
  <property name="Name" value="James"/>
  <property name="version" value="1.2.2-dev"/>
  <property name="year" value="1999-2001"/>

  <!-- There should be no need to override default compiler but need to change
    javac task to run without this -->
  <property name="build.compiler" value="classic"/>

  <!--
    these are here only for those who use jikes compiler. For other
    developers this part makes no difference.
  -->
  <property name="build.compiler.emacs" value="on"/>
  <property name="build.compiler.warnings" value="true"/>
  <property name="build.compiler.pedantic" value="true"/>
  <property name="build.compiler.depend" value="true"/>
  <property name="build.compiler.fulldepend" value="true"/>

  <property name="debug" value="on"/>
  <property name="optimize" value="on"/>
  <property name="deprecation" value="on"/>


  <!--
       ===================================================================
       Set the properties for intermediate directory
       ===================================================================
  -->
  <property name="build.dir" value="build"/>
  <property name="build.lib" value="${build.dir}/lib"/>
  <property name="build.src" value="${build.dir}/src"/>
  <property name="build.classes" value="${build.dir}/classes"/>
  <property name="build.javadocs" value="${build.dir}/javadocs"/>
  <property name="build.docs" value="${build.dir}/docs"/>
  <property name="build.xdocs" value="${build.dir}/xdocs"/>
  <property name="build.mailetdocs" value="${build.dir}/mailetdocs"/>
  <property name="build.conf" value="${build.dir}/conf"/>

  <!--
       ===================================================================
       Set the properties for source directories
       ===================================================================
  -->

  <property name="src.dir" value="src"/>
  <property name="java.dir" value="${src.dir}/java"/>
  <property name="conf.dir" value="${src.dir}/conf"/>
  <property name="scripts.dir" value="${src.dir}/script"/>
  <property name="sql.dir" value="${src.dir}/sql"/>
  <property name="proposal.base" value="proposals"/>
  <property name="proposal.dir" value="${proposal.base}/v1.3"/>
  <property name="java.proposal.dir" value="${proposal.dir}/java"/>
  <property name="conf.proposal.dir" value="${proposal.dir}/conf"/>
  <property name="lib.dir" value="lib"/>
  <property name="tools.dir" value="tools"/>
  <property name="xdocs.dir" value="${src.dir}/xdocs"/>
  <property name="docs.src" value="${xdocs.dir}"/>
  <property name="docs.dir" value="docs"/>
  <property name="www.dir" value="www"/>
  <property name="javadocs.dir" value="${docs.dir}/api"/>
  <property name="mailetdocs.dir" value="${docs.dir}/mailet"/>
  <property name="rfcs.dir" value="${docs.dir}/rfclist"/>
  <property name="dist.name" value="${name}-${version}"/>

  <property name="constants.file" value="org/apache/james/Constants.java"/>
  <property name="conf.file" value="james.conf.xml"/>
  <property name="server.file" value="james.server.xml"/>

  <property name="site.dir" value="../xml-site/sources/james"/>
  <property name="site.docs" value="../xml-site/targets/james"/>



  <!--
       ===================================================================
       Set the classpath
       ===================================================================
  -->
  <property name="xerces.jar" value="${lib.dir}/xerces.jar"/>
  <property name="framework.jar" value="${lib.dir}/avalon-framework.jar"/>
  <property name="excalibur.jar" value="${lib.dir}/avalon-excalibur.jar"/>
  <property name="scratchpad.jar" value="${lib.dir}/avalon-scratchpad.jar"/>
  <property name="logkit.jar" value="${lib.dir}/logkit.jar"/>
  <property name="cornerstone.bar" value="${lib.dir}/cornerstone.bar"/>
  <property name="phoenix.client.jar" value="${lib.dir}/phoenix-client.jar"/>
  <!--
    <property name="activation.jar" value="${lib.dir}/activation.jar"/>
  -->
  <path id="project.class.path">
    <pathelement location="${xerces.jar}"/>
    <pathelement location="${framework.jar}"/>
    <pathelement location="${excalibur.jar}"/>
    <pathelement location="${scratchpad.jar}"/>
    <pathelement location="${logkit.jar}"/>
    <pathelement location="${phoenix.client.jar}"/>
    <pathelement location="${cornerstone.bar}"/>
    <pathelement path="${java.class.path}" />
    <fileset dir="${lib.dir}">
      <include name="*.jar" />
      <exclude name="xerces.jar"/>
      <exclude name="framework.jar"/>
      <exclude name="excalibur.jar"/>
      <exclude name="scratchpad.jar"/>
      <exclude name="logkit.jar"/>
      <exclude name="phoenix.client.jar"/>
    </fileset>
    <pathelement path="${build.classes}" />
  </path>

  <!--
       ===================================================================
                                  Main target
       ===================================================================
  -->
  <target name="main" depends="dist-lite" />

  <!-- =================================================================== -->
  <!-- Help on usage                                                       -->
  <!-- =================================================================== -->
  <target name="usage">
    <echo message=""/>
    <echo message=""/>
    <echo message="JAMES Build file"/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=" available targets are:"/>
    <echo message=""/>
    <echo message="   block-archive  --> generates the James.bar file (default)"/>
    <echo message="   auxiliary-jars --> generates the mailet.jar"/>
    <echo message="   compile        --> compiles the source code"/>
    <echo message="   dist-lite      --> generates the JAMES distribution, unpacked"/>
    <echo message="   dist           --> generates the JAMES distribution, packed"/>
    <echo message="   clean          --> cleans up the directory"/>
    <echo message="   docs           --> created the documentaion for James"/>
    <echo message="   javadoc        --> creates the Javadoc"/>
    <echo message="   javadocmailet  --> creates the Javadoc for the mailet API"/>
    <echo message=""/>
    <echo message=" See the comments inside the build.xml file for more details."/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=""/>
  </target>

  <target name="help" depends="usage"/>

  <!--
       ===================================================================
       Set up dist properties
       ===================================================================
  -->
  <target name="setup-properties" >

    <tstamp/>

    <property name="dist.dir" value="dist"/>
    <property name="dist.bin" value="${dist.dir}/bin"/>
    <property name="dist.apps" value="${dist.dir}/apps"/>
    <property name="dist.lib" value="${dist.dir}/lib"/>
    <property name="dist.docs" value="${dist.dir}/docs"/>
    <property name="dist.javadocs" value="${dist.dir}/docs/api"/>

    <property name="src.dist.dir" value="dist-src"/>
    <property name="src.dist.src" value="${src.dist.dir}/src"/>
    <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
    <property name="src.dist.javadocs" value="${src.dist.dir}/docs/api"/>
    <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
    <property name="src.dist.tools" value="${src.dist.dir}/tools"/>
    <property name="src.dist.proposals" value="${src.dist.dir}/proposals"/>
  </target>


  <!-- =================================================================== -->
  <!-- Prepares the build directory                                        -->
  <!-- =================================================================== -->
  <target name="prepare" depends="setup-properties">

    <mkdir dir="${build.src}"/>
    <copy todir="${build.src}">
      <fileset dir="${java.dir}">
        <exclude name="**/*.properties"/>
        <exclude name="**/*.xinfo"/>
      </fileset>
    </copy>
    <copy todir="${build.conf}">
      <fileset dir="${conf.dir}">
      </fileset>
    </copy>

    <available classname="org.apache.velocity.anakia.AnakiaTask"
        property="AnakiaTask.present"/>

    <replace file="${build.src}/${constants.file}" token="@@VERSION@@" value="${version}"/>
    <replace file="${build.src}/${constants.file}" token="@@NAME@@" value="${Name}"/>
    <replace file="${build.src}/${constants.file}" token="@@DATE@@" value="${TODAY}"/>

  </target>

  <target name="prepare-proposal" depends="prepare" if="with.proposal">
    <echo>Building with proposal </echo>
    <copy todir="${build.src}" overwrite="on">
      <fileset dir="${java.proposal.dir}">
        <exclude name="**/*.properties"/>
        <exclude name="**/*.xinfo"/>
      </fileset>
    </copy>
    <copy todir="${build.conf}" overwrite="on">
      <fileset dir="${conf.proposal.dir}">
      </fileset>
    </copy>
  </target>

  <target name="prepare-error" depends="prepare" unless="AnakiaTask.present">
    <echo>
        AnakiaTask is not present! Please check to make sure that
        velocity.jar is in your classpath.
    </echo>
  </target>


  <!-- =================================================================== -->
  <!-- Compiles the source directory                                       -->
  <!-- =================================================================== -->
  <target name="compile" depends="prepare-proposal">
  <!--  <mkdir dir="${build.dir}"/> -->
    <available property="jndi.present" classname="javax.naming.InitialContext" />

    <mkdir dir="${build.classes}"/>
 
    <javac srcdir="${build.src}"
           destdir="${build.classes}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="${deprecation}">
      <classpath refid="project.class.path" />
      <src path="${build.src}" />
      <exclude name="${constants.file}" />
      <exclude name="org/apache/james/userrepository/UsersLDAPRepository.java"
               unless="jndi.present" />
    </javac>

    <copy todir="${build.classes}">
      <fileset dir="${java.dir}">
        <include name="**/*.properties"/>
        <include name="**/*.xinfo"/>
      </fileset>
    </copy>

  </target>

  <!-- =================================================================== -->
  <!-- Creates the JAMES.bar archive                                       -->
  <!-- =================================================================== -->
  <target name="block-archive" depends="compile">

    <mkdir dir="${build.lib}"/>

    <jar jarfile="${build.lib}/${name}.bar"
         basedir="${build.classes}"
         manifest="${src.dir}/Manifest.mf">
       <include name="org/**"/>
    </jar>

  </target>

  <!-- =================================================================== -->
  <!-- Creates the mailet.jar                                              -->
  <!-- =================================================================== -->
  <target name="auxiliary-jars" depends="compile">
    <jar jarfile="${build.lib}/mailet.jar" basedir="${build.classes}"
         manifest="${src.dir}/Manifest.mf" includes="org/apache/mailet/**"/>
  </target>


  <!--
       ===================================================================
                           Creates the .sar file
       ===================================================================
  -->
  <target name="sar" depends="block-archive,auxiliary-jars">

    <jar jarfile="${build.lib}/${name}.sar">

      <zipfileset dir="${lib.dir}/" prefix="blocks/">
        <include name="*.bar"/>
      </zipfileset>

      <zipfileset dir="${build.lib}/" prefix="blocks/">
        <include name="*.bar"/>
      </zipfileset>

      <zipfileset dir="${build.lib}" prefix="lib">
        <include name="*.jar"/>
      </zipfileset>

      <zipfileset dir="${lib.dir}/" prefix="lib">
        <include name="dnsjava.jar"/>
        <include name="town.jar"/>
        <include name="activation.jar"/>
        <include name="mail_1_2.jar"/>
        <include name="jakarta-oro-2.0.1.jar"/>
      </zipfileset>

      <zipfileset dir="${build.conf}" fullpath="conf/config.xml">
        <include name="james-config.xml"/>
      </zipfileset>

      <zipfileset dir="${build.conf}" fullpath="conf/assembly.xml">
        <include name="james-assembly.xml"/>
      </zipfileset>

      <zipfileset dir="${build.conf}" fullpath="conf/server.xml">
        <include name="james-server.xml"/>
      </zipfileset>

    </jar>

  </target>

  <!-- =================================================================== -->
  <!-- Creates the unpacked binary distribution                            -->
  <!-- =================================================================== -->

  <target name="dist-lite" depends="sar">
    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${dist.dir}/bin"/>

    <delete dir="${dist.dir}/apps/${name}"/>
    <copy file="${build.lib}/${name}.sar" todir="${dist.dir}/apps"/>

    <copy todir="${dist.dir}/bin">
      <fileset dir="lib">
        <include name="phoenix-engine.jar"/>
        <include name="phoenix-loader.jar"/>
      </fileset>
    </copy>

    <copy todir="${dist.dir}/lib">
      <fileset dir="lib">
        <include name="phoenix-client.jar"/>
        <include name="avalon-framework.jar"/>
        <include name="avalon-excalibur.jar"/>
        <include name="avalon-scratchpad.jar"/>
        <include name="avalon-jmx.jar"/>
        <include name="jmxri.jar"/>
        <include name="jmxtools.jar"/>
        <include name="logkit.jar"/>
        <include name="xerces.jar"/>
      </fileset>
    </copy>

    <copy file="${scripts.dir}/run.bat" tofile="${dist.dir}/bin/run.bat"/>
    <copy file="${scripts.dir}/run.sh" tofile="${dist.dir}/bin/run.sh"/>
    <copy file="${conf.dir}/avalonTestKeys" tofile="${dist.dir}/conf/avalonTestKeys"/>
    <chmod dir="${dist.dir}" perm="go-rwx" />
    <chmod file="${dist.dir}/bin/run.sh" perm="u+x"/>
    <fixcrlf srcdir="${dist.dir}" cr="add" includes="**/*.bat" />
    <fixcrlf srcdir="${dist.dir}" cr="remove" includes="**/*.sh" />

    <copy todir="${dist.dir}/conf">
      <fileset dir="${conf.dir}">
        <include name="inet*"/>
        <include name="maildatabase*"/>
      </fileset>
    </copy>

    <copy file="README" tofile="${dist.dir}/README"/>
    <replace file="${dist.dir}/README" token="@@version@@" value="${version}"/>
    <copy file="LICENSE.txt" tofile="${dist.dir}/LICENSE"/>
    <copy file="build.xml" tofile="${dist.dir}/build.xml"/>
  </target>


  <!-- =================================================================== -->
  <!-- Cleans everything                                                   -->
  <!-- =================================================================== -->
  <target name="clean" depends="setup-properties">
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}"/>
    <delete file="${name}-${version}-${DSTAMP}.zip"/>
    <delete file="${name}-${version}-${DSTAMP}.tar"/>
    <delete file="${name}-${version}-${DSTAMP}.tar.gz"/>
  </target>

  <!-- Cleans absolutely everything up -->
  <target name="real-clean" depends="clean">
    <delete dir="${docs.dir}" />
    <delete dir="${src.dist.dir}" />
    <delete file="${name}-${version}-${DSTAMP}-src.zip"/>
    <delete file="${name}-${version}-${DSTAMP}-src.tar"/>
    <delete file="${name}-${version}-${DSTAMP}-src.tar.gz"/>
  </target>


  <!-- =================================================================== -->
  <!-- Documentation                                                       -->
  <!-- =================================================================== -->
  <!-- Docs are generated from xml sources in src/xdocs, javadocs from     -->
  <!-- source files in src/java.                                           -->
  <!-- Docs for most recent release are on the website and in www dir.     -->
  <!-- Docs for cvs state are generated on demand and can, optionally,     -->
  <!-- be placed in docs dir.                                              -->
  <!-- =================================================================== -->



  <!-- =================================================================== -->
  <!-- Generates the javadoc                                               -->
  <!-- =================================================================== -->
  <target name="javadocs">

    <delete dir="${build.javadocs}"/>
    <mkdir dir="${build.javadocs}"/>

    <javadoc packagenames="org.apache.*"
             sourcepath="${java.dir}"
             destdir="${build.javadocs}">
      <classpath refid="project.class.path" />
      <doclet name="com.sun.tools.doclets.standard.Standard">
       <param name="-author"/>
       <param name="-version"/>
       <param name="-use"/>
       <param name="-doctitle" value="${Name}"/>
       <param name="-windowtitle" value="${Name} API"/>
       <param name="-bottom"
              value="&quot;Copyright &#169; 2001 Apache Jakarta Project. All Rights Reserved.&quot;"/>
      </doclet>
    </javadoc>

  </target>

  <!-- =================================================================== -->
  <!-- Generates the javadoc for just the mailet API                       -->
  <!-- =================================================================== -->
  <target name="javadocmailet">

    <delete dir="${build.mailetdocs}"/>
    <mkdir dir="${build.mailetdocs}"/>

    <javadoc sourcepath="${java.dir}"
        destdir="${build.mailetdocs}"
        packagenames="org.apache.mailet.*">
      <classpath refid="project.class.path" />
      <doclet name="com.sun.tools.doclets.standard.Standard">
       <param name="-author"/>
       <param name="-version"/>
       <param name="-use"/>
       <param name="-doctitle" value="Mailet"/>
       <param name="-windowtitle" value="$Mailet API"/>
       <param name="-bottom"
              value="&quot;Copyright &#169; 2001 Apache Jakarta Project. All Rights Reserved.&quot;"/>
      </doclet>
    </javadoc>
  </target>

  <!-- =================================================================== -->
  <!-- Generates the documentation for James                               -->
  <!-- =================================================================== -->
  <target name="xdocs" depends="prepare-error" if="AnakiaTask.present">
    <taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask"/>
    <anakia basedir="${docs.src}" destdir="${build.docs}/"
         extension=".html" style="./site.vsl"
         projectFile="stylesheets/project.xml"
         excludes="**/stylesheets/** empty.xml"
         includes="**/*.xml"
         lastModifiedCheck="true"
         templatePath="../jakarta-site2/xdocs/stylesheets">
    </anakia>

    <copy todir="${build.docs}/images" filtering="no">
        <fileset dir="${docs.src}/images">
            <include name="**/*.gif"/>
            <include name="**/*.jpeg"/>
            <include name="**/*.jpg"/>
        </fileset>
    </copy>
  </target>


  <target name="docs" depends="javadocs,xdocs"/>

  <!--
       ===================================================================
       Create the Local site documentation
       ===================================================================
  -->
  <target name="local-xdocs" depends="xdocs">

    <delete>
      <fileset dir="${docs.dir}">
        <exclude name="api/**"/>
      </fileset>
    </delete>
    <mkdir dir="${docs.dir}"/>

    <copy todir="${docs.dir}">
      <fileset dir="${build.docs}" />
    </copy>

  </target>

  <!--
       ===================================================================
       Create the Local API documentation
       ===================================================================
  -->
  <target name="local-javadocs" depends="javadocs">

    <delete dir="${javadocs.dir}"/>
    <mkdir dir="${javadocs.dir}"/>

    <copy todir="${javadocs.dir}">
      <fileset dir="${build.javadocs}" />
    </copy>

  </target>

  <!--
       ===================================================================
       Create the Local documentation
       ===================================================================
  -->
  <target name="local-docs" depends="local-javadocs,local-xdocs,javadocmailet">

   <copy todir="${mailetdocs.dir}">
      <fileset dir="${build.mailetdocs}" />
    </copy>

  </target>


  <!--
       ===================================================================
       Update the www directory
       ===================================================================
  -->
  <target name="site-docs" depends="local-xdocs">

    <!-- delete old documents but keep CVS directories, rfclist and mailet
         api -->
    <delete>
      <fileset dir="${www.dir}">
        <exclude name="CVS/**"/>
        <exclude name="rfclist/**"/>
        <exclude name="mailet/**"/>
      </fileset>
    </delete>

    <!-- copy new generated docs, but not mailet api or rfclist -->
    <!-- exclude CVS dir until docs dir removed from CVS -->
    <mkdir dir="${www.dir}"/>
    <copy todir="${www.dir}">
      <fileset dir="${docs.dir}">
        <exclude name="api/**"/>
        <exclude name="rfclist/**"/>
        <exclude name="CVS/**"/>
        <exclude name="mailet/**"/>
      </fileset>
    </copy>

  </target>


  <!--
       ===================================================================
                            Create the binary distribution
       ===================================================================
  -->

  <target name="dist" depends="dist-lite, docs">

    <mkdir dir="${dist.docs}"/>
    <mkdir dir="${dist.javadocs}"/>

    <copy todir="${dist.docs}">
      <fileset dir="${build.docs}"/>
    </copy>

    <copy todir="${dist.javadocs}">
      <fileset dir="${build.javadocs}"/>
    </copy>

    <zip zipfile="${name}-${version}-${DSTAMP}.zip" basedir="${dist.dir}" includes="**"/>
    <tar tarfile="${name}-${version}-${DSTAMP}.tar" basedir="${dist.dir}" includes="**"/>
    <gzip zipfile="${name}-${version}-${DSTAMP}.tar.gz" src="${name}-${version}-${DSTAMP}.tar"/>
  </target>


  <!--
       ===================================================================
                            Create the source distribution
       ===================================================================
  -->
  <target name="src-dist" depends="javadocs,xdocs,setup-properties">

    <mkdir dir="${src.dist.dir}" />
    <mkdir dir="${src.dist.docs}"/>
    <mkdir dir="${src.dist.javadocs}"/>

    <copy todir="${src.dist.tools}">
      <fileset dir="${tools.dir}"/>
    </copy>

    <copy todir="${src.dist.lib}">
      <fileset dir="${lib.dir}"/>
    </copy>

    <copy todir="${src.dist.src}">
      <fileset dir="${src.dir}"/>
    </copy>

    <copy todir="${src.dist.proposals}">
      <fileset dir="${proposal.base}"/>
    </copy>

    <copy todir="${src.dist.docs}">
      <fileset dir="${build.docs}"/>
    </copy>

    <copy todir="${src.dist.javadocs}">
      <fileset dir="${build.javadocs}"/>
    </copy>

    <copy todir="${src.dist.dir}">
      <fileset dir=".">
        <include name="build.bat"/>
        <include name="build.sh"/>
        <include name="build.xml"/>
        <include name="README"/>
        <include name="LICENSE.txt"/>
      </fileset>
    </copy>

    <fixcrlf srcdir="${src.dist.dir}" includes="build.sh" cr="remove"/>
    <fixcrlf srcdir="${src.dist.dir}" includes="build.bat" cr="add"/>

    <chmod perm="+x">
      <fileset dir="${src.dist.dir}">
        <include name="build.sh" />
      </fileset>
    </chmod>

    <fixcrlf srcdir="${src.dist.src}/java" includes="**/*.java" cr="remove"/>

    <chmod dir="${src.dist.dir}" perm="go-rwx" />

    <zip zipfile="${name}-${version}-${DSTAMP}-src.zip" basedir="${src.dist.dir}" includes="**"/>
    <tar tarfile="${name}-${version}-${DSTAMP}-src.tar" basedir="${src.dist.dir}" includes="**"/>
    <gzip zipfile="${name}-${version}-${DSTAMP}-src.tar.gz" src="${name}-${version}-${DSTAMP}.tar"/>

  </target>


  <!--
       ===================================================================
                 Completely build all dists
       ===================================================================
  -->
  <target name="distributions" depends="dist, src-dist">

  </target>

</project>

 

Regrds
Vikram

Commented:
Hello Vikram,

>I guess it works for simple XML strings.
  function Export(...) is for 2 types of XML content.
1. one record.
<command>
     <command_type key="update">1</command_type>
     <APPNAME attributename="dddd" test="ddd">QL</APPNAME>
</command>

2. multiple record.
<commands>
    <command>
     <command_type>1</command_type>
     <APPNAME>QL</APPNAME>
     <CALLER>SIEBEL</CALLER>
     <MODNAME>Reservation</MODNAME>
     <SCREENNAME>NewFinanceFurniture</SCREENNAME>
     <VALUE>1234567890</VALUE>
    </command>
    <command>
     <command_type>2</command_type>
     <APPNAME>2 - QL</APPNAME>
     <CALLER>2 - SIEBEL</CALLER>
     <MODNAME>2 - Reservation</MODNAME>
     <SCREENNAME>2 - NewFinanceFurniture</SCREENNAME>
     <VALUE>000000000</VALUE>
    </command>
</commands>

>But what about long and complex ones.
  Large XML content will take a long time to parse, sure.
If you need more complex content, you need to customize XMLparser source code to meet your needs.
  I can help you about this, if you request for special propose function to fit your works.

>structure of my XML string. But irrespective of the
>structure it should parse into the datawindow
>appropriately. Below is an example of a complex XML
>string which i copied from ur build.xml itself.
 that XML is about loading Configuration File to an application, it's not data for datawindow.

>How will u have something like this parsed into a datawindow ? :-
  first of all, you should have to understand that XML structure and code to Export() some child-element for save your data to datawindow.


 

Author

Commented:
Hello Buasuwan,
I think the XML can be parsed into a tree view irrespective of the XML structure.Can't something similar be done to parse the XML into a datawindow without having to understand its structure and code ?

Regards
Vikram

Commented:
ok,
from last XML sample, build.xml.
1. could you tell me how many records it has? or is that a single?
2. how many columns will be put to a datawindow?
3. please show me some sample output of datawindow
if you save to datawindow from build.xml
 i have no idea how this datawindow looks like.

Treeview and datawindow are differences type of use.


Author

Commented:
Hello Buasuwan,

That is what i want to know from you. Is it possible to parse the XML into a dynamic datawindow without knowing the structure of the XML ?

Regards
Vikram

Commented:
> Is it possible to parse the XML into a dynamic datawindow

  the answer is yes. you saw the demo that generate Treeview from any XML contents. as the same, you can do this to dynamic datawindow. (but, Export() doesnot support it now, you need to extend this function to work as function: generateTreeView() )

normally,
from:
  XML contents --loadXML()----> XML Objects

now: you can do anything to export XML Objects, like generate to TreeviewControl, datawindow, ... more.

one last thing, if you don't know the structure of XML.
And successfully export it to a datawindow. how can you get data without knowing anything, such as column name or else?



Author

Commented:

Hello Buasuwan,
Can you give me your contact email id for future use if i face any problems with the XML parsing into datawindow? Presently things are working fine.

Regards
Vikram

Commented:
Hello Vikram,
  I develop opensource XMLparser for anyone who use PB.
I will continue to add more features and support it. don't worry about it.
  you can reach me at unoksoftgroup@se-ed.net anytime.

Best regards,
Yuthasak Buasuwan.







Author

Commented:
Hello Buasuwan,
Thank you for all your help these days. I learned quite a lot. I am sure now i will be able to accomplish my objective now with all the inputs i have got from you. You get full 150 points. My best wishes for you.

Warm Regards
Vikram

Commented:
Hello Vikram,
   Please let me know if you need any help.

Thanks,
Yuthasak Buasuwan

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial