Need help in XML Parsing

Hello experts,
I have to validate a xml against schema.I have used some java code & xerces jar ro solve this problem.It's working fine.But it's showing only first error & it's coming out.I want to list all the errors.Please help me by guiding how to achieve it.Right now the code I am using is easy enough , I just need to provide the schema file & xml file.But if I have to find out all the errors , do I need to parse it line by line?Please help.Thanx tonn in advance.

Ya . this is possible if you have heard about XSLT transformation .
       File xmlFile = new File("XmlFileToTransform");
            File xsltFile = new File("U R SCHEMA");
     XMLReader reader = XMLReaderFactory.createXMLReader();
     reader.setEntityResolver(new NullResolver());
     FileOutputStream fos = new FileOutputStream(out);
                    Writer out = new BufferedWriter(new OutputStreamWriter(fos,
                              "UTF8"));
                    SAXSource xmlSource = new SAXSource(reader, new InputSource(
                              xmlFile.toURI().getRawPath()));
                    Source xsltSource = new StreamSource(xsltFile);
                    Result result = new StreamResult(out);
                    // create an instance of TransformerFactory
                    TransformerFactory transFact = TransformerFactory.newInstance();
                    Transformer trans = transFact.newTransformer(xsltSource);
                    trans.transform(xmlSource, result); // this will transform xml according to u r xslt file
                    out.close();see if this is helpful for u !

Similar Messages

  • I need help! XML Parsing

    This is my xml code file.
    <?xml version="1.0" encoding="iso-8859-1"?>
    <contato_lista xmlns="includes:net_schema.xml">
         <contato ID="001">
              <nome>Andr�teste</nome>
              <ip>192.168.25.242</ip>
         </contato>
         <contato ID="002">
              <nome>Gustavo</nome>
              <ip>192.168.25.72</ip>
         </contato>
    </contato_lista>
    I am trying to get the text from the tags <nome> and <ip> from the 2 tags <contato>. And this is the method I am using. I am trying to get the text in the tags <nome> in the array contatos_lista[], everytime I run the program I get empty. Please I need help. I am desperade.
    Thanks in advace.
    public String[] importaContatos() {
    String contatos_lista[] = new String[ 12 ];
    contatos_lista[0] = "N�o h� contatos";
    Node nodeContato;
    NodeList contatoChild;
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    try {
    File contatos = new File("D:/userdir/mycodes/NetMessage/contatos.xml");
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse( contatos );
    }catch (SAXParseException spe) {
    }catch (ParserConfigurationException e){
    }catch(SAXException e){
    }catch (IOException e){
    Node nodeElement = document.getDocumentElement();
    Node nodeChild = nodeElement.getParentNode();
    Node nodeContatoLista = nodeChild;
    NodeList contatoListaChild = nodeContatoLista.getChildNodes();
    //JOptionPane.showMessageDialog(null , contatos_lista[0]);
    for (int i = 0; i <= contatoListaChild.getLength(); i++){
    nodeContato = nodeContatoLista.getFirstChild();
    nodeContato = nodeChild.getNextSibling();
    contatoChild = nodeContato.getChildNodes();
    int count = 0;
    for (int y = 0; y < contatoChild.getLength(); y++){
    contatos_lista[count] = contatoChild.item(y).getNodeValue();
    count++;
    return contatos_lista;
    }

    This is my xml code file.
    <?xml version="1.0" encoding="iso-8859-1"?>
    <contato_lista xmlns="includes:net_schema.xml">
         <contato ID="001">
              <nome>Andr�teste</nome>
              <ip>192.168.25.242</ip>
         </contato>
         <contato ID="002">
              <nome>Gustavo</nome>
              <ip>192.168.25.72</ip>
         </contato>
    </contato_lista>
    I am trying to get the text from the tags <nome> and
    <ip> from the 2 tags <contato>. And this is the method
    I am using. I am trying to get the text in the tags
    <nome> in the array contatos_lista[], everytime I run
    the program I get empty. Please I need help. I am
    desperade.
    Thanks in advace.
    public String[] importaContatos() {
    String contatos_lista[] = new String[ 12 ];
    contatos_lista[0] = "N�o h� contatos";
    Node nodeContato;
    NodeList contatoChild;
    DocumentBuilderFactory factory =
    ctory = DocumentBuilderFactory.newInstance();
    try {
    File contatos = new
    tatos = new
    File("D:/userdir/mycodes/NetMessage/contatos.xml");
    DocumentBuilder builder =
    r builder = factory.newDocumentBuilder();
    document = builder.parse( contatos );
    }catch (SAXParseException spe) {
    }catch (ParserConfigurationException e){
    }catch(SAXException e){
    }catch (IOException e){
    Node nodeElement =
    ement = document.getDocumentElement();
    Node nodeChild = nodeElement.getParentNode();
    Node nodeContatoLista = nodeChild;
    NodeList contatoListaChild =
    Child = nodeContatoLista.getChildNodes();
    //JOptionPane.showMessageDialog(null ,
    (null , contatos_lista[0]);
    for (int i = 0; i <=
    0; i <= contatoListaChild.getLength(); i++){
    nodeContato =
    deContato = nodeContatoLista.getFirstChild();
    nodeContato = nodeChild.getNextSibling();
    contatoChild =
    tatoChild = nodeContato.getChildNodes();
    int count = 0;
    for (int y = 0; y <
    y = 0; y < contatoChild.getLength(); y++){
    contatos_lista[count] =
    atos_lista[count] =
    contatoChild.item(y).getNodeValue();
    count++;
    return contatos_lista;
    }This line appears to be wrong to me
    Node nodeChild = nodeElement.getParentNode();
    Why are you doing that?
    Anyway it would be easier just to do
    ement = document.getDocumentElement();
    NodeList contatoListaChild = ement.getElementsByTagName("contato");
    for (int i = 0; i <= contatoListaChild.getLength(); i++){
      Element contato = contatoListaChild.item(i);

  • Need help on xml parsing... no body replied at xml forum...plz help

    it 's 10g
    set serveroutput on
    set line 2000
    drop table emp;
    CREATE TABLE EMP (
      EMPNO     NUMBER(10),
      ENAME     VARCHAR2(10),
      JOB       VARCHAR2(9),
      MGR       NUMBER(4),
      HIREDATE  DATE,
      SAL       NUMBER(7, 2),
      COMM      NUMBER(7, 2),
      DEPTNO   NUMBER(2));
    DECLARE
      l_bfile   BFILE;
      l_clob    CLOB;
      l_parser  dbms_xmlparser.Parser;
      l_doc     dbms_xmldom.DOMDocument;
      l_nl      dbms_xmldom.DOMNodeList;
      l_n       dbms_xmldom.DOMNode;
      l_temp    VARCHAR2(1000);
      TYPE tab_type IS TABLE OF emp%ROWTYPE;
      t_tab  tab_type := tab_type();
    BEGIN
      l_bfile := BFileName('ADMIN1_DIR', 'emp.xml');
      dbms_lob.createtemporary(l_clob, cache=>FALSE);
      dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
      dbms_lob.loadFromFile(dest_lob => l_clob,
                            src_lob  => l_bfile,
                            amount   => dbms_lob.getLength(l_bfile));
      dbms_lob.close(l_bfile);
      -- make sure implicit date conversions are performed correctly
      dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
      -- Create a parser.
      l_parser := dbms_xmlparser.newParser;
      -- Parse the document and create a new DOM document.
      dbms_xmlparser.parseClob(l_parser, l_clob);
      l_doc := dbms_xmlparser.getDocument(l_parser);
      -- Free resources associated with the CLOB and Parser now they are no longer needed.
      dbms_lob.freetemporary(l_clob);
      dbms_xmlparser.freeParser(l_parser);
      -- Get a list of all the EMP nodes in the document using the XPATH syntax.
      --l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/EMPLOYEES/EMP');
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/ipdrIPDR');
      -- Loop through the list and create a new record in a tble collection
      -- for each EMP record.
      FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
        l_n := dbms_xmldom.item(l_nl, cur_emp);
        t_tab.extend;
        -- Use XPATH syntax to assign values to he elements of the collection.
    --    dbms_xslprocessor.valueOf(l_n,'recordId/text()',t_tab(t_tab.last).empno);
        dbms_xslprocessor.valueOf(l_n,'recordId/text()',t_tab(t_tab.last).ename);
        dbms_xslprocessor.valueOf(l_n,'JOB/text()',t_tab(t_tab.last).job);
        dbms_xslprocessor.valueOf(l_n,'MGR/text()',t_tab(t_tab.last).mgr);
        dbms_xslprocessor.valueOf(l_n,'HIREDATE/text()',t_tab(t_tab.last).hiredate);
        dbms_xslprocessor.valueOf(l_n,'SAL/text()',t_tab(t_tab.last).sal);
        dbms_xslprocessor.valueOf(l_n,'COMM/text()',t_tab(t_tab.last).comm);
        dbms_xslprocessor.valueOf(l_n,'DEPTNO/text()',t_tab(t_tab.last).deptno);
      END LOOP;
      -- Insert data into the real EMP table from the table collection.
      -- Form better performance multiple collections should be used to allow
      -- bulk binding using the FORALL construct but this would make the code
      -- too long-winded for this example.
      FOR cur_emp IN t_tab.first .. t_tab.last LOOP
        INSERT INTO emp
         ename
        VALUES
         t_tab(cur_emp).ename
      END LOOP;
      COMMIT;
      -- Free any resources associated with the document now it
      -- is no longer needed.
      dbms_xmldom.freeDocument(l_doc);
    EXCEPTION
      WHEN OTHERS THEN
        dbms_output.put_line('errrrrrrrr--->'||sqlerrm);
       dbms_lob.freetemporary(l_clob);
        dbms_xmlparser.freeParser(l_parser);
        dbms_xmldom.freeDocument(l_doc);
    END;
    /select * from emp;
    this file works fine
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <ipdrIPDR>
    <recordId>923622</recordId>
    </ipdrIPDR>
    but this is not . .. note my special charter in the tokens... i did change in the program too but does not work ...
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <ipdr:IPDR>
    <recordId>923622</recordId>
    </ipdr:IPDR>
    I get error
    errrrrrrrr--->ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00234: namespace prefix "ipdr" is not declared
    Error at line 2
    PL/SQL procedure successfully completed.

    Hi,
    Yes, I have tried the same method. will be ok.
    But I have got another some records on the same column as follows.
    I have tried with another one xmltable with outer join(+), still not getting the actual data (null record from the original(main) table) and extra records from the new xmltable.
    Is it possible to make one or union with xmltable also can we check the node either /Item or /section exists something like that
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <section>
      <sectionmetadata>
        <object_id>317832</object_id>
        <asitype>Section</asitype>
        <instructornotes/>
      </sectionmetadata>
      <selection_ordering>
        <selection seltype="All">
          <selection_number>1</selection_number>
          <or_selection>
            <selection_metadata mdoperator="EQ" mdname="questionid">_155451_1</selection_metadata>
          </or_selection>
        </selection>
        <selection seltype="All">
          <or_selection>
            <selection_param pname="singleLink">true</selection_param>
          </or_selection>
        </selection>
      </selection_ordering>
    </section>Thanks,

  • Need Help with XML Parsing on to DataGrid

    Hi
    I have retrivied  this  Data  into my HttpService Result function .
    <list>
      <User>
        <ename>JAMES</ename>
        <empno>7900</empno>
      </User>
      <User>
        <ename>FORD</ename>
        <empno>7902</empno>
      </User>
      <User>
        <ename>MILLER</ename>
        <empno>7934</empno>
      </User>
    </list>
    [Bindable]
        private var xmldata:XML;
    private function resultHandler(event:ResultEvent):void{
            xmldata=event.result as XML;
    <mx:DataGrid x="50" y="23" width="469" height="265" dataProvider="{xmldata.User}">
      <mx:columns>
       <mx:DataGridColumn headerText="Type" dataField="ename"/>
       <mx:DataGridColumn headerText="Sales" dataField="empno"/>
      </mx:columns>
    </mx:DataGrid>
    But this is not displaying any data into DataGrid .
    Could anybody please help me .
    Thanks .

    after you get data assign the data to the data grid
    datagrid.dataprovider = xml;
    and also do datagrid.invalidateList() after u get the data if the above line does not help
    also see if the data provider is not null if nothing helped.

  • I need help with XML Gallery Fade in out transition. somebody please help me :(

    I need help with XML Gallery Fade in out transition. somebody please help me
    I have my post dont want to duplicate it

    The problem doesn't lie with your feed, although it does contain an error - you have given a non-existent sub-category. You need to stick to the categories and sub-categories listed here:
    http://www.apple.com/itunes/podcasts/specs.html#categories
    Subscribing to your feed from the iTunes Store page work as such, but the episodes throw up an error message. The problem lies with your episode media files: you are trying to stream them. Pasting the URL into a browser produces a download (where it should play the file) of a small file which does not play and in fact is a text file containing (in the case of ep.2) this:
    [Reference]
    Ref1=http://stream.riverratdoc.com/RiverratDoc/episode2.mp3?MSWMExt=.asf
    Ref2=http://70.33.177.247:80/RiverratDoc/episode2.mp3?MSWMExt=.asf
    You must provide a direct link to the actual mp3 file. Streaming won't work. The test is that if you paste the URL of the media file (as given in the feed) into the address bar of a browser it should play the file.

  • Stax reading /writing need help from xml guru plz

    hi, i have been told that stax reading /writing should involve no overhead and that is why i use it and i am now able to write my large data to file, but using my reader i seem to run out of memory, using netbeans profiler i ahve found that char[] seems to be the problem,
    by backtracing i ahve found that javax.xml.parser.SAXParser.parse calls the xerces packages which eventually leads to the char[ ], now my code for my reader is attatched here...
    package utilities;
    import Categorise.Collection;
    import Categorise.Comparison;
    import Categorise.TestCollection;
    import java.io.IOException;
    import javax.xml.parsers.*;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import org.xml.sax.Attributes;
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    import measures.Protocol;
    * @author dthomas
    public class XMLParser extends DefaultHandler
        static Collection collection = new Collection();
        List<Short> cList;
        List<Comparison> comparisonList;
        File trainFileName;
        File testFileName;
        TestCollection tc;
        List<TestCollection> testCollectionList;
        List<File> testFileNameList = new ArrayList<File>();
        List<File> trainFileNameList = new ArrayList<File>();
        boolean allTrainsAdded = false;
        Protocol protocol;
        List<File> trainingDirList;
        File testingDir;
        int counter = 0;
        File[ ] trainingDirs;
        File[ ] trainingFileNames;
        File[ ] testFileNames;
        TestCollection[ ] testCollections;
        Comparison[ ] comparisons;
        Comparison c;
        short[ ] cCounts;
        String order;
        String value;
        File trainDir;
        /** Creates a new instance of XMLParser */
        public XMLParser() {
        public static Collection read( File aFile )
            long startTime = System.currentTimeMillis();
            System.out.println( "Reading XML..." );
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp;
            try {
                sp = spf.newSAXParser();
                sp.parse( aFile, new XMLParser() );
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SAXException ex) {
                ex.printStackTrace();
            } catch (ParserConfigurationException ex) {
                ex.printStackTrace();
            long endTime = System.currentTimeMillis();
            long totalTime = ( endTime - startTime ) / 1000;
            System.out.println( "Done..."  + totalTime + " seconds" );
            return collection;
        public void startElement(String uri,String localName,String qName, Attributes attributes)
            if( qName.equals( "RE" ) )
                testCollectionList = new ArrayList<TestCollection>();
            else if( qName.equals( "p") )
                boolean isConcatenated = new Boolean( attributes.getValue( "c" ) );
                boolean isStatic = new Boolean( attributes.getValue( "s" ) );
                protocol = new Protocol( isConcatenated, isStatic );
            else if( qName.equals( "trdl" ) )
                trainingDirList = new ArrayList<File>();
            else if( qName.equals( "trd" ) )
                trainDir = new File( attributes.getValue( "fn" ) );
                trainingDirList.add( trainDir );
            else if( qName.equals( "td" ) )
                testingDir = new File( attributes.getValue( "fn" ) );
            else if( qName.equals( "TC" ) )
                counter++;
                System.out.println( counter );
                comparisonList = new ArrayList<Comparison>();
                testFileName = new File( attributes.getValue( "tfn" ) );
                testFileNameList.add( testFileName );
                tc = new TestCollection( );
                tc.setTestFileName( testFileName );
            else if ( qName.equals( "r" ) )
             order = attributes.getValue( "o" );
                value = attributes.getValue( "v" );
                cList.add( Short.parseShort( order ), new Short( value ) );
            else if( qName.equals( "c" ) )
                cList = new ArrayList<Short>();
                trainFileName = new File( attributes.getValue( "trfn" ) );
                if( !allTrainsAdded )
                    trainFileNameList.add( trainFileName );
        public void characters(char []ch,int start,int length)
            //String str=new String(ch,start,length);
            //System.out.print(str);
        public void endElement(String uri,String localName,String qName)
            if (qName.equals( "c") )
                allTrainsAdded = true;
                cCounts = new short[ cList.size() ];      
                for( int i = 0; i < cCounts.length; i++ )
                    cCounts[ i ] = cList.get( i );
                c = new Comparison( trainFileName, tc );
                c.setcCounts( cCounts );
                this.comparisonList.add( c );
            else if( qName.equals( "TC" ) )
                comparisons = new Comparison[ comparisonList.size() ];
                comparisonList.toArray( comparisons );           
                tc.setComparisons( comparisons );
                testCollectionList.add( tc );
            else if( qName.equals( "RE" ) )
                testCollections = new TestCollection[ testCollectionList.size() ];
                testCollectionList.toArray( testCollections );
                collection.setTestCollections( testCollections );
                testFileNames = new File[ testFileNameList.size() ];
                testFileNameList.toArray( testFileNames );
                collection.setTestingFiles( testFileNames );
                //String[ ] testCategories = new String[ testCategoryList.size() ];
                //testCategoryList.toArray( testCategories );
                //collection.setTestCategories( testCategories );
                trainingFileNames = new File[ trainFileNameList.size() ];
                trainFileNameList.toArray( trainingFileNames );
                collection.setTrainingFiles( trainingFileNames );
                //String[ ] trainingCategories = new String[ trainCategoryList.size() ];
                //trainCategoryList.toArray( trainingCategories );
                //collection.setTrainingCategories( trainingCategories );
                collection.setProtocol( protocol );
                trainingDirs = new File[ trainingDirList.size() ];
                trainingDirList.toArray( trainingDirs );           
                collection.setTrainingDirs( trainingDirs );
                collection.setTestingDir( testingDir );
         //else
             //System.out.println("End element:   {" + uri + "}" + localName);
    }i thought it may have been a recursive problme, hence having so many instance variables instead of local ones but that hasn't helped.
    all i need at the end of this is a Collection which holds an array of testCollections, which holds an array of cCounts and i was able to hold all of this in memory as all i am loading is what was in memory before it was written.
    can someone plz help
    ps when i use tail in unix to read the end of the xml file it doesnt work correctly as i cannot specify the number of lines to show, it shows all of the file as thought it is not split into lines or contains new line chars or anything, it is stored as one long stream, is this correct??
    here is a snippet of the xml file:
    <TC tfn="
    /homedir/dthomas/Desktop/4News2/output/split3/alt.atheism/53458"><c trfn="/homed
    ir/dthomas/Desktop/4News2/output/split0/alt.atheism/53586"><r o="0" v="0"></r><r
    o="1" v="724"></r><r o="2" v="640"></r><r o="3" v="413"></r><r o="4" v="245"></
    r><r o="5" v="148"></r><r o="6" v="82"></r><r o="7" v="52"></r><r o="8" v="40"><
    /r><r o="9" v="30"></r><r o="10" v="22"></r><r o="11" v="16"></r><r o="12" v="11
    "></r><r o="13" v="8"></r><r o="14" v="5"></r><r o="15" v="2"></r></c><c trfn="/
    homedir/dthomas/Desktop/4News2/output/split0/alt.atheism/53495"><r o="0" v="0"><
    /r><r o="1" v="720"></r><r o="2" v="589"></r><r o="3" v="349"></r><r o="
    please if anyone has any ideas from this code why a char[] would use 50% of the memory taken, and that the average age seems to show that the same one continues to grow..
    thanks in advance
    danny =)

    hi, i am still having lo luck with reading the xml data back into memory, as i have said before, the netbeans profiler is telling me it is a char[] that is using 50% of the memory but i cannot see how a char[] is created, my code doesn't so it must be the xml code...plz help

  • Need help with XML delay   URGENT!!!

    Hi i need help making a flash movie to load everything from
    xml. It has to load text, images and flv, but, it has to load them
    and end them at the time said in the xml. So flash loads and
    unloade the text or image or video at the time specified in the
    XML! PLEASE HELP I NEED THIS DONE TODAY!!!!! VERY IMPORTANT!!!
    Contact me by msn [email protected] or send mail or
    reply here!!

    It was probably a little unclear initially (no offence
    intended ) whether your problem was with getting the data from XML
    or with the sequencing aspect. I assume that its the sequencing
    aspect based on your recent reply.
    So if it was me I would parse the loaded info into Date
    objects for the load and remove times and have this information
    handled by some sort of sequencing code.
    At its simplest, you could compare the xml-derived date/times
    for load/unload with the current system date/time and use a
    setInterval function to initiate the load after the calculated
    difference in milliseconds has passed. Similar for the removeclip
    timing.

  • Need help on XML Publisher Template features

    Hi,
    We have a requirement to develop an Invoice Register report to display the invoices for a period. Details of each Invoice and Amount needs to be displayed in a single line. At the bottom of each page we have to display running total of the Invoices displayed till that page. At the beginning of each page we have to display the total amount of Invoices displayed in the previous page.
    We had developed the report using Reports Builder and registered concurrent program with output type as PDF. We are working in Spanish environment (UTF-8 character set). The report is working properly and producing output as required. But Spanish characters appear as junk character on the report. From Metalink Notes 443778.1 and 338990.1, I understand that PDF output in UTF-8 character set is not supported. We need to use XML Publisher to generate the PDF output.
    We have developed .rtf template. It is generating PDF output and Spanish characters appearing properly. But we are not able to get the running total at the bottom of each page or total of previous page amounts at the beginning of each page. In the output from Reports Builder, we could use various page level options (like reset at page level, etc.) to achieve the requirement. But in the template generated using .rtf, I do not have such options.
    I am not sure if there are advanced features in .rtf template to achieve the requirement. Could anyone please advise me how I can achieve the requirement? It would be great if you could provide me some reference.
    Thanks and Regards,
    Nabendu

    Hi Nabendu.
    BI publisher does have the option of showing a running total in PDF format usign a RTF template. If you look up the advanced rtf samples provided with the BI publisher plugin there is one example to show running totals, with the previous page total at the top.
    you can find this located on your PC where the Word Plugin is installed. C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\samples\RTF templates
    replace C:\ with the drive leeter of the drive where your desktop plugin is installed
    Hope this Helps,
    Domnic

  • Need help with xml video gallery

    Hello everyone
    I recently bought a xml video gallery. I'm loading the movie externally into another movie. When the xml gallery loads, it cancels all sounds.
    I need to figure out where in the actionscription can i reverse the cancellation of sounds. Can anyone help? if possible, I can email, whomever is willing to help, the xml gallery to see if theres another reason the sound is being canceled.
    Also, the sound of the gallery doesn't work til you click the volume scroller.
    Here are two parts of actionscript included in the gallery:
    part one:
    // Import filter classes
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    // Set flash variables
    var xmlFileUrl:String = "playlist.xml";
    var auto_play:String = "true";
    // Set xml file URL
    if (_root.xmlfile) {
        xmlFileUrl = _root.xmlfile;
    var V_SRC;
    var thuArray:Array = new Array();
    var currentVideo:Number = 0;
    var totalItems;
    var numOfItems:Number;
    var itemDistance:Number = 120+5;
    var itemHeight:Number = 80+2;
    var Value:Number = 1;
    var boundry:Number = 1;
    var ratio:Number = 1;
    var diff:Number = 1;
    var collectionWidth:Number = 1;
    var buffer:Number = 135*2;
    this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
    video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
    video_txt.theText.selectable = false;
    video_txt.theText.autoSize = "left";
    //The Format
    myFormat = new TextFormat();
    myFormat.font = _root.font_format;
    myFormat.size = _root.font_size;
    myFormat.color = _root.font_color;
    myFormat.align = "center";
    video_txt.theText.setNewTextFormat(myFormat);
    // Create a new movieclip to load the thumbs
    var thumbLoader:MovieClipLoader = new MovieClipLoader();
    var thumbListener:Object = new Object();
    thumbLoader.addListener(thumbListener);
    thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
        new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
        target_mc._parent.preloader_mc._alpha = 0;
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = xmlLoaded;
    xml.load(xmlFileUrl);
    // Load the xml file into the player
    function xmlLoaded(b:Boolean) {
        if (b) {
            auto_play = this.firstChild.firstChild.attributes.auto_play;
            scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
            totalItems = this.firstChild.firstChild.childNodes;
            numOfItems = totalItems.length;
            for (j=0; j<numOfItems; j++) {
                var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
                i._x = itemDistance*j;
                thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
                i.id = j;
                i.videoTitle = totalItems[j].attributes.title;
                i.videoUrl = totalItems[j].attributes.src;
                // Create an event for thumb rollover
                i.onRollOver = iRoll;
                i.onRollOut = i.onReleaseOutside=iOut;
                i.onRelease = iRelease;
                thuArray[j] = i;
            // default first video
            collectionWidth = player_mc.main_mc.collection_mc._width;
            currentVideo = 0;
            V_SRC = thuArray[0].videoUrl;
            changeVideo();
            //scope._alpha = 100;
            new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
        else
            trace("Error! xml file not loaded");
    // onRollOver Events
    function iRoll() {
        player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
        this.light_mc.play();
    function iRelease() {
        currentVideo = this.id;
        changeVideo();
    function changeVideo() {
        V_SRC = thuArray[currentVideo].videoUrl;
        player_mc.loadVideo();
        currentThumb();
        player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
        video_txt.theText.text = totalItems[currentVideo].attributes.title;
        player_mc.so.getVolume();
        player_mc.playStatus = 1;
        player_mc.checkStatus();
    function nextVideo() {
        if (currentVideo<(numOfItems-1)) {
            currentVideo++;
        } else {
            currentVideo = 0;
        changeVideo();
    function currentThumb() {
        for (i=0; i<thuArray.length; i++) {
            if (i == currentVideo) {
                thuArray[i].enabled = true;
    // Mouse movement on rollover
    this.onMouseMove = function() {
        collectionWidth = player_mc.main_mc.collection_mc._width;
        boundry = player_mc.main_mc.area_mc._width;
        if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
            if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
                ratio = player_mc.main_mc._xmouse/boundry;
                diff = (collectionWidth-boundry)+buffer;
                Value = Math.floor((-ratio)*diff)+(buffer/2);
        updateAfterEvent();
    this.onEnterFrame = function() {
        // Define movement area and speed
        if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
            player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.collection_mc._ x)/scrollSpeed));
            if (player_mc.main_mc.collection_mc._x>0) {
                player_mc.main_mc.collection_mc._x = 0;
            } else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_mc.main_mc. collection_mc._width))) {
                player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._width));
        } else {
            player_mc.main_mc.collection_mc._x = 0;
        updateAfterEvent();
    part two:
    // Define flash variables
    var video_url:String = "";
    var tempx:Number = this._parent._x;
    var tempy:Number = this._parent._y;
    var timeCounter:Number = 0;
    var timeInSeconds:Number = _root.time_counter;
    // Object to listen to onStage Event
    videoObj = vid.videoObj;
    // Setting up the connection
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    // Buffer time
    ns.setBufferTime (10);
    videoObj.attachVideo (ns);
    function loadVideo () {
        video_url = _parent.V_SRC;
        trace(video_url);
        ns.play (video_url);
    function checkStatus()
        if (playStatus == 1)
            controls_mc.playPause.gotoAndStop("pause");
            mc_playAgain._visible = false;
            thumbs_out = false;
            title_out = false;
        else
            controls_mc.playPause.gotoAndStop("play");
            mc_playAgain._visible = true;
        } // end else if
        if (so.getVolume() == 0)
            controls_mc.mute_mc.gotoAndStop("mute");
        else
            controls_mc.mute_mc.gotoAndStop("on");
    }; // End of the function
    mc_playAgain._visible = false;
    // Check Status of video
    ns.onStatus = function (info)
        if (info.code == "NetStream.Buffer.Empty")
            mc_buffer._visible = true;
        else if (info.code == "NetStream.Buffer.Full")
            mc_buffer._visible = false;
        else if (info.code == "NetStream.Play.Stop")
            ns.seek(0);
            if (playStatus == 1)
                ns.pause();
                playStatus = 0;
            else
                trace;
            } // end else if
            mc_playAgain._visible = true;
            mc_buffer._visible = false;
            thumbs_out = true;
            title_out = true;
            checkStatus();
        } // end else if
    // Get info about video
    ns.onMetaData = function(infoObject:Object)
        FLVduration = infoObject["duration"];
        relationshipW = infoObject.height / infoObject.width;
        relationshipH = infoObject.width / infoObject.height;
        if (Stage["displayState"] == "fullScreen")
            largeSize ();
        else
            regularSize ();
        if (_parent.auto_play == "false")
            ns.seek(0);
            if (playStatus == 1)
                ns.pause();
                playStatus = 0;
            mc_buffer._visible = false;
            controls_mc.playPause.gotoAndStop("play");
            mc_playAgain._visible = true;
            thumbs_out = true;
            title_out = true;
            _parent.auto_play = "true";
        }// end else if
    var videoInterval = setInterval(videoStatus, 100);
    var amountLoaded;
    var duration;
    // videoStatus on load Event
    function videoStatus()
        amountLoaded = ns.bytesLoaded / ns.bytesTotal;
        controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
        controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
        controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
    }; // End of the function
    function scrubIt()
        ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
    }; // End of the function
    // video time
    var time_interval:Number = setInterval(checkTime, 500, ns);
    function checkTime(ns:NetStream) {
        //current time
        var ns_seconds:Number = ns.time;
        var minutes:Number = Math.floor(ns_seconds/60);
        var seconds = Math.floor(ns_seconds%60);
        sec = seconds;
        min = minutes;
        if (sec<10) {
            sec = "0"+sec;
        if (min<10) {
            min = "0"+min;
        controls_mc.time_txt.time_1.text = min+":"+sec;
        //total time
        var minutes2:Number = Math.floor(FLVduration/60);
        var seconds2 = Math.floor(FLVduration%60);
        sec2 = seconds2;
        min2 = minutes2;
        if (sec2<10) {
            sec2 = "0"+sec2;
        if (min2<10) {
            min2 = "0"+min2;
        controls_mc.time_txt.time_2.text = min2+":"+sec2;
        if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
            controls_mc.time_txt.time_2.text = "00:00";
    setStage ();
    // Object to listen onStage Event
    var stageL:Object = new Object ();
    // function respnsible for content alignment
    function setStage ()
        if (Stage["displayState"] == "fullScreen") {
            tempx = this._parent._x;
            tempy = this._parent._y;
            this._parent._x = 0;
            this._parent._y = 0;
            vidBg_mc._x = 0;
            vidBg_mc._y = 0;
            mc_title._x = 0;
            mc_title._y = -30;
            slide_me._x = 0;
            slide_me._y = 0;
            vidBg_mc._width = Stage.width;
            vidBg_mc._height = Stage.height;
            mc_title._width = Stage.width;
            mc_title._height = Stage.height / 20;
            slide_me._width = Stage.width;
            slide_me._height = Stage.height / 20;
            vid._x = vid._y = 0;
            largeSize ();
            controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
            controls_mc._y = Math.round (Stage.height - 36);
            mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
            mc_playAgain._y = Math.round (Stage.height - 572);
            thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
            thumbs_mc._y = Math.round (Stage.height - 115);
            main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
            hide_mc.onEnterFrame = function () {
                timeCounter = timeCounter + 1;
                if (timeCounter >= timeInSeconds * 30) {
                    timeCounter = 0;
                    controls_mc._alpha = 0;
            this.onMouseMove = function () {
                timeCounter = 0;
                controls_mc._alpha = 100;
        else
            delete hide_mc.onEnterFrame;
            delete this.onMouseMove;
            controls_mc._alpha = 100;
            this._parent._x = tempx;
            this._parent._y = tempy;
            vidBg_mc._width = 600;
            vidBg_mc._height = 360;
            mc_title._width = 600;
            mc_title._height = 30;
            slide_me._width = 600;
            slide_me._height = 30;
            vidBg_mc._x = vid._x = 0;
            vidBg_mc._y = vid._y = 35;
            mc_title._x = vid._x = 0;
            mc_title._y = vid._x = -30;
            slide_me._x = vid._x = 0;
            slide_me._y = vid._y = 35;
            regularSize ();
            controls_mc._x = 0;
            controls_mc._y = 395;
            mc_playAgain._x = 243;
            mc_playAgain._y = 158;
            thumbs_mc._x = 0;
            thumbs_mc._y = 316;
            main_mc._x = 0;
            main_mc._y = 406;
        mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
        mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
    // to apply when stage (browser window) is resized or modified
    stageL.onResize = function () {
        setStage ();
    // attaching object to the stage
    Stage.addListener (stageL);
    MovieClip.prototype.slide = function(yPos) {
        this._y -= (this._y-yPos)/5;
    // tilte actions
    mc_title.onEnterFrame = function()
        if (Stage["displayState"] == "normal" && title_out == false)
            this.slide(5);
        else if (Stage["displayState"] == "normal" && title_out == true)
            this.slide(35);
        if (Stage["displayState"] == "fullScreen" && title_out == false)
            this._y -= (this._y+106)/5;
        else if (Stage["displayState"] == "fullScreen" && title_out == true)
            this.slide(0);
    // thumbs actions
    main_mc.onEnterFrame = function()
        if (Stage["displayState"] == "normal" && thumbs_out == false)
            this.slide(406);
        else if (Stage["displayState"] == "normal" && thumbs_out == true)
            this.slide(299);
        if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
            this._y = Math.round (Stage.height - 0);
        else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
            this._y = Math.round (Stage.height - 133);
    // Playlist button
    controls_mc.playlist_mc.onRollOver = function ()
        this.gotoAndStop("playlistOver");
    controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
        this.gotoAndStop("playlist");
    // Toggle playlist button
    controls_mc.playlist_mc.onRelease = function ()
        if (thumbs_out == false)
            thumbs_out = true;
            title_out = true;
        else if (thumbs_out == true)
            thumbs_out = false;
            title_out = false;
        } // end if else
    // Define hit area for playPause button
    vid.onPress = controls_mc.playPause.onRelease = function ()
        ns.pause();
        if (playStatus == 1)
            controls_mc.playPause.gotoAndStop("play")
            playStatus = 0;
            checkStatus();
        else if (playStatus == 0)
            controls_mc.playPause.gotoAndStop("pause");
            playStatus = 1;
            checkStatus();
    // playPause button
    controls_mc.playPause.onRollOver = function ()
        if (playStatus == 1)
            this.gotoAndStop("pauseOver");
        else
            this.gotoAndStop("playOver");
        } // end else if
    controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
        if (playStatus == 1)
            this.gotoAndStop("pause");
        else
            this.gotoAndStop("play");
        } // end else if
    // Toggle playPause button
    controls_mc.playPause.onRelease = function ()
        ns.pause();
        if (playStatus == 1)
            this.gotoAndStop("play");
            playStatus = 0;
            checkStatus();
        else if (playStatus == 0)
            this.gotoAndStop("pause");
            playStatus = 1;
            checkStatus();
    controls_mc.skip_mc.onRollOver = function ()
        this.gotoAndStop("skipOver");
    controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
        this.gotoAndStop("skip");
    controls_mc.skip_mc.onRelease = function ()
        _parent.nextVideo()
    // Play Again button
    mc_playAgain.onRollOver = function ()
        this.gotoAndStop("playAgainOver");
    mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
        this.gotoAndStop("playAgain");
    // Toggle Play Again button
    mc_playAgain.onRelease = function ()
        this._visible = false;
        ns.pause();
        playStatus = 1;
        checkStatus();
    // make the seek bar clickable
    controls_mc.mc_progress.mc_buff.onPress = function()
        xpos = controls_mc.mc_progress._xmouse;
        percent = Math.round(xpos/controls_mc.mc_progress._width*100);
        seekTime = percent/100*FLVduration;
        seekTime = Math.round(seekTime*100)/100;
        ns.seek(seekTime);
    // Set volume level
    var s:Sound = new Sound();
    s.setVolume(_root.volume_value);
    controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
    // Volume control
    controls_mc.mc_soundLevel.onPress = function()
        volumeTo = (this._xmouse / this._width)*100;
        this.mc_volume._xscale = volumeTo;
        s.setVolume(volumeTo);
    // Volume
    _parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
    vSound.attachAudio(ns);
    var so = new Sound(vSound);
    so.setVolume(_root.volume_value);
    // Mute button
    controls_mc.mute_mc.onRollOver = function ()
        if (so.getVolume() >= 1)
            this.gotoAndStop("onOver");
        else
            this.gotoAndStop("muteOver");
        } // end else if
    controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
        if (so.getVolume() >= 1)
            this.gotoAndStop("on");
        else
            this.gotoAndStop("mute");
        } // end else if
    // Toggle mute button
    controls_mc.mute_mc.onRelease = function ()
        if (so.getVolume() >= 1)
            controls_mc.mc_soundLevel.mc_volume._xscale = 0;
            so.setVolume(0);
            this.gotoAndStop("muteOver");
        else
            controls_mc.mc_soundLevel.mc_volume._xscale = 70;
            so.setVolume(_root.volume_value);
            this.gotoAndStop("onOver");
        } // end else if
    // Resize video proportionaly
    function regularSize ()
        videoObj._width = 600;
        videoObj._height = videoObj._width * relationshipW;
        if (videoObj._height > 360)
            videoObj._height = 360;
            videoObj._width = videoObj._height * relationshipH;
        videoObj.smoothing = true;
        //var scale:Number;
        videoObj._x = (600 - videoObj._width) / 2;
        videoObj._y = (360 - videoObj._height) / 2;
    function largeSize ()
        videoObj._width = Stage.width;
        videoObj._height = videoObj._width * relationshipW;
        if (videoObj._height > Stage.height)
            videoObj._height = Stage.height;
            videoObj._width = videoObj._height * relationshipH;
        videoObj.smoothing = true;
        //var scale:Number;
        videoObj._x = (Stage.width - videoObj._width) / 2;
        videoObj._y = (Stage.height - videoObj._height) / 2;
    // Fullscreen button
    controls_mc.fullscreen_mc.onRollOver = function ()
        if (Stage["displayState"] == "normal")
            this.gotoAndStop("fullOver");
        else
            this.gotoAndStop("fullCloseOver");
        } // end else if
    controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
        if (Stage["displayState"] == "normal")
            this.gotoAndStop("full");
        else
            this.gotoAndStop("fullClose");
        } // end else if
    // Toggle fullscreen button
    controls_mc.fullscreen_mc.onRelease = function ()
        if (Stage["displayState"] == "normal")
            Stage["displayState"] = "fullscreen";
            _parent.video_txt.theText._visible = false;
        else
            Stage["displayState"] = "normal";
            _parent.video_txt.theText._visible = true;

    if you mean sound works well when the gallery is tested without being loaded into another swf but fails when loaded, change the highlighted line:
    // Import filter classes
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    // Set flash variables
    var xmlFileUrl:String = "playlist.xml";
    var auto_play:String = "true";
    // Set xml file URL
    if (_root.xmlfile) {
        xmlFileUrl = _root.xmlfile;
    var V_SRC;
    var thuArray:Array = new Array();
    var currentVideo:Number = 0;
    var totalItems;
    var numOfItems:Number;
    var itemDistance:Number = 120+5;
    var itemHeight:Number = 80+2;
    var Value:Number = 1;
    var boundry:Number = 1;
    var ratio:Number = 1;
    var diff:Number = 1;
    var collectionWidth:Number = 1;
    var buffer:Number = 135*2;
    this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
    video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
    video_txt.theText.selectable = false;
    video_txt.theText.autoSize = "left";
    //The Format
    myFormat = new TextFormat();
    myFormat.font = _root.font_format;
    myFormat.size = _root.font_size;
    myFormat.color = _root.font_color;
    myFormat.align = "center";
    video_txt.theText.setNewTextFormat(myFormat);
    // Create a new movieclip to load the thumbs
    var thumbLoader:MovieClipLoader = new MovieClipLoader();
    var thumbListener:Object = new Object();
    thumbLoader.addListener(thumbListener);
    thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
        new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
        target_mc._parent.preloader_mc._alpha = 0;
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = xmlLoaded;
    xml.load(xmlFileUrl);
    // Load the xml file into the player
    function xmlLoaded(b:Boolean) {
        if (b) {
            auto_play = this.firstChild.firstChild.attributes.auto_play;
            scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
            totalItems = this.firstChild.firstChild.childNodes;
            numOfItems = totalItems.length;
            for (j=0; j<numOfItems; j++) {
                var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
                i._x = itemDistance*j;
                thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
                i.id = j;
                i.videoTitle = totalItems[j].attributes.title;
                i.videoUrl = totalItems[j].attributes.src;
                // Create an event for thumb rollover
                i.onRollOver = iRoll;
                i.onRollOut = i.onReleaseOutside=iOut;
                i.onRelease = iRelease;
                thuArray[j] = i;
            // default first video
            collectionWidth = player_mc.main_mc.collection_mc._width;
            currentVideo = 0;
            V_SRC = thuArray[0].videoUrl;
            changeVideo();
            //scope._alpha = 100;
            new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
        else
            trace("Error! xml file not loaded");
    // onRollOver Events
    function iRoll() {
        player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
        this.light_mc.play();
    function iRelease() {
        currentVideo = this.id;
        changeVideo();
    function changeVideo() {
        V_SRC = thuArray[currentVideo].videoUrl;
        player_mc.loadVideo();
        currentThumb();
        player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
        video_txt.theText.text = totalItems[currentVideo].attributes.title;
        player_mc.so.getVolume();
        player_mc.playStatus = 1;
        player_mc.checkStatus();
    function nextVideo() {
        if (currentVideo<(numOfItems-1)) {
            currentVideo++;
        } else {
            currentVideo = 0;
        changeVideo();
    function currentThumb() {
        for (i=0; i<thuArray.length; i++) {
            if (i == currentVideo) {
                thuArray[i].enabled = true;
    // Mouse movement on rollover
    this.onMouseMove = function() {
        collectionWidth = player_mc.main_mc.collection_mc._width;
        boundry = player_mc.main_mc.area_mc._width;
        if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
            if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
                ratio = player_mc.main_mc._xmouse/boundry;
                diff = (collectionWidth-boundry)+buffer;
                Value = Math.floor((-ratio)*diff)+(buffer/2);
        updateAfterEvent();
    this.onEnterFrame = function() {
        // Define movement area and speed
        if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
            player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.colle ction_mc._x)/scrollSpeed));
            if (player_mc.main_mc.collection_mc._x>0) {
                player_mc.main_mc.collection_mc._x = 0;
            } else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_m c.main_mc.collection_mc._width))) {
                player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._w idth));
        } else {
            player_mc.main_mc.collection_mc._x = 0;
        updateAfterEvent();
    part two:
    // Define flash variables
    var video_url:String = "";
    var tempx:Number = this._parent._x;
    var tempy:Number = this._parent._y;
    var timeCounter:Number = 0;
    var timeInSeconds:Number = _root.time_counter;
    // Object to listen to onStage Event
    videoObj = vid.videoObj;
    // Setting up the connection
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    // Buffer time
    ns.setBufferTime (10);
    videoObj.attachVideo (ns);
    function loadVideo () {
        video_url = _parent.V_SRC;
        trace(video_url);
        ns.play (video_url);
    function checkStatus()
        if (playStatus == 1)
            controls_mc.playPause.gotoAndStop("pause");
            mc_playAgain._visible = false;
            thumbs_out = false;
            title_out = false;
        else
            controls_mc.playPause.gotoAndStop("play");
            mc_playAgain._visible = true;
        } // end else if
        if (so.getVolume() == 0)
            controls_mc.mute_mc.gotoAndStop("mute");
        else
            controls_mc.mute_mc.gotoAndStop("on");
    }; // End of the function
    mc_playAgain._visible = false;
    // Check Status of video
    ns.onStatus = function (info)
        if (info.code == "NetStream.Buffer.Empty")
            mc_buffer._visible = true;
        else if (info.code == "NetStream.Buffer.Full")
            mc_buffer._visible = false;
        else if (info.code == "NetStream.Play.Stop")
            ns.seek(0);
            if (playStatus == 1)
                ns.pause();
                playStatus = 0;
            else
                trace;
            } // end else if
            mc_playAgain._visible = true;
            mc_buffer._visible = false;
            thumbs_out = true;
            title_out = true;
            checkStatus();
        } // end else if
    // Get info about video
    ns.onMetaData = function(infoObject:Object)
        FLVduration = infoObject["duration"];
        relationshipW = infoObject.height / infoObject.width;
        relationshipH = infoObject.width / infoObject.height;
        if (Stage["displayState"] == "fullScreen")
            largeSize ();
        else
            regularSize ();
        if (_parent.auto_play == "false")
            ns.seek(0);
            if (playStatus == 1)
                ns.pause();
                playStatus = 0;
            mc_buffer._visible = false;
            controls_mc.playPause.gotoAndStop("play");
            mc_playAgain._visible = true;
            thumbs_out = true;
            title_out = true;
            _parent.auto_play = "true";
        }// end else if
    var videoInterval = setInterval(videoStatus, 100);
    var amountLoaded;
    var duration;
    // videoStatus on load Event
    function videoStatus()
        amountLoaded = ns.bytesLoaded / ns.bytesTotal;
        controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
        controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
        controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
    }; // End of the function
    function scrubIt()
        ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
    }; // End of the function
    // video time
    var time_interval:Number = setInterval(checkTime, 500, ns);
    function checkTime(ns:NetStream) {
        //current time
        var ns_seconds:Number = ns.time;
        var minutes:Number = Math.floor(ns_seconds/60);
        var seconds = Math.floor(ns_seconds%60);
        sec = seconds;
        min = minutes;
        if (sec<10) {
            sec = "0"+sec;
        if (min<10) {
            min = "0"+min;
        controls_mc.time_txt.time_1.text = min+":"+sec;
        //total time
        var minutes2:Number = Math.floor(FLVduration/60);
        var seconds2 = Math.floor(FLVduration%60);
        sec2 = seconds2;
        min2 = minutes2;
        if (sec2<10) {
            sec2 = "0"+sec2;
        if (min2<10) {
            min2 = "0"+min2;
        controls_mc.time_txt.time_2.text = min2+":"+sec2;
        if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
            controls_mc.time_txt.time_2.text = "00:00";
    setStage ();
    // Object to listen onStage Event
    var stageL:Object = new Object ();
    // function respnsible for content alignment
    function setStage ()
        if (Stage["displayState"] == "fullScreen") {
            tempx = this._parent._x;
            tempy = this._parent._y;
            this._parent._x = 0;
            this._parent._y = 0;
            vidBg_mc._x = 0;
            vidBg_mc._y = 0;
            mc_title._x = 0;
            mc_title._y = -30;
            slide_me._x = 0;
            slide_me._y = 0;
            vidBg_mc._width = Stage.width;
            vidBg_mc._height = Stage.height;
            mc_title._width = Stage.width;
            mc_title._height = Stage.height / 20;
            slide_me._width = Stage.width;
            slide_me._height = Stage.height / 20;
            vid._x = vid._y = 0;
            largeSize ();
            controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
            controls_mc._y = Math.round (Stage.height - 36);
            mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
            mc_playAgain._y = Math.round (Stage.height - 572);
            thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
            thumbs_mc._y = Math.round (Stage.height - 115);
            main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
            hide_mc.onEnterFrame = function () {
                timeCounter = timeCounter + 1;
                if (timeCounter >= timeInSeconds * 30) {
                    timeCounter = 0;
                    controls_mc._alpha = 0;
            this.onMouseMove = function () {
                timeCounter = 0;
                controls_mc._alpha = 100;
        else
            delete hide_mc.onEnterFrame;
            delete this.onMouseMove;
            controls_mc._alpha = 100;
            this._parent._x = tempx;
            this._parent._y = tempy;
            vidBg_mc._width = 600;
            vidBg_mc._height = 360;
            mc_title._width = 600;
            mc_title._height = 30;
            slide_me._width = 600;
            slide_me._height = 30;
            vidBg_mc._x = vid._x = 0;
            vidBg_mc._y = vid._y = 35;
            mc_title._x = vid._x = 0;
            mc_title._y = vid._x = -30;
            slide_me._x = vid._x = 0;
            slide_me._y = vid._y = 35;
            regularSize ();
            controls_mc._x = 0;
            controls_mc._y = 395;
            mc_playAgain._x = 243;
            mc_playAgain._y = 158;
            thumbs_mc._x = 0;
            thumbs_mc._y = 316;
            main_mc._x = 0;
            main_mc._y = 406;
        mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
        mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
    // to apply when stage (browser window) is resized or modified
    stageL.onResize = function () {
        setStage ();
    // attaching object to the stage
    Stage.addListener (stageL);
    MovieClip.prototype.slide = function(yPos) {
        this._y -= (this._y-yPos)/5;
    // tilte actions
    mc_title.onEnterFrame = function()
        if (Stage["displayState"] == "normal" && title_out == false)
            this.slide(5);
        else if (Stage["displayState"] == "normal" && title_out == true)
            this.slide(35);
        if (Stage["displayState"] == "fullScreen" && title_out == false)
            this._y -= (this._y+106)/5;
        else if (Stage["displayState"] == "fullScreen" && title_out == true)
            this.slide(0);
    // thumbs actions
    main_mc.onEnterFrame = function()
        if (Stage["displayState"] == "normal" && thumbs_out == false)
            this.slide(406);
        else if (Stage["displayState"] == "normal" && thumbs_out == true)
            this.slide(299);
        if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
            this._y = Math.round (Stage.height - 0);
        else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
            this._y = Math.round (Stage.height - 133);
    // Playlist button
    controls_mc.playlist_mc.onRollOver = function ()
        this.gotoAndStop("playlistOver");
    controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
        this.gotoAndStop("playlist");
    // Toggle playlist button
    controls_mc.playlist_mc.onRelease = function ()
        if (thumbs_out == false)
            thumbs_out = true;
            title_out = true;
        else if (thumbs_out == true)
            thumbs_out = false;
            title_out = false;
        } // end if else
    // Define hit area for playPause button
    vid.onPress = controls_mc.playPause.onRelease = function ()
        ns.pause();
        if (playStatus == 1)
            controls_mc.playPause.gotoAndStop("play")
            playStatus = 0;
            checkStatus();
        else if (playStatus == 0)
            controls_mc.playPause.gotoAndStop("pause");
            playStatus = 1;
            checkStatus();
    // playPause button
    controls_mc.playPause.onRollOver = function ()
        if (playStatus == 1)
            this.gotoAndStop("pauseOver");
        else
            this.gotoAndStop("playOver");
        } // end else if
    controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
        if (playStatus == 1)
            this.gotoAndStop("pause");
        else
            this.gotoAndStop("play");
        } // end else if
    // Toggle playPause button
    controls_mc.playPause.onRelease = function ()
        ns.pause();
        if (playStatus == 1)
            this.gotoAndStop("play");
            playStatus = 0;
            checkStatus();
        else if (playStatus == 0)
            this.gotoAndStop("pause");
            playStatus = 1;
            checkStatus();
    controls_mc.skip_mc.onRollOver = function ()
        this.gotoAndStop("skipOver");
    controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
        this.gotoAndStop("skip");
    controls_mc.skip_mc.onRelease = function ()
        _parent.nextVideo()
    // Play Again button
    mc_playAgain.onRollOver = function ()
        this.gotoAndStop("playAgainOver");
    mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
        this.gotoAndStop("playAgain");
    // Toggle Play Again button
    mc_playAgain.onRelease = function ()
        this._visible = false;
        ns.pause();
        playStatus = 1;
        checkStatus();
    // make the seek bar clickable
    controls_mc.mc_progress.mc_buff.onPress = function()
        xpos = controls_mc.mc_progress._xmouse;
        percent = Math.round(xpos/controls_mc.mc_progress._width*100);
        seekTime = percent/100*FLVduration;
        seekTime = Math.round(seekTime*100)/100;
        ns.seek(seekTime);
    // Set volume level
    var s:Sound = new Sound(this);
    s.setVolume(_root.volume_value);
    controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
    // Volume control
    controls_mc.mc_soundLevel.onPress = function()
        volumeTo = (this._xmouse / this._width)*100;
        this.mc_volume._xscale = volumeTo;
        s.setVolume(volumeTo);
    // Volume
    _parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
    vSound.attachAudio(ns);
    var so = new Sound(vSound);
    so.setVolume(_root.volume_value);
    // Mute button
    controls_mc.mute_mc.onRollOver = function ()
        if (so.getVolume() >= 1)
            this.gotoAndStop("onOver");
        else
            this.gotoAndStop("muteOver");
        } // end else if
    controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
        if (so.getVolume() >= 1)
            this.gotoAndStop("on");
        else
            this.gotoAndStop("mute");
        } // end else if
    // Toggle mute button
    controls_mc.mute_mc.onRelease = function ()
        if (so.getVolume() >= 1)
            controls_mc.mc_soundLevel.mc_volume._xscale = 0;
            so.setVolume(0);
            this.gotoAndStop("muteOver");
        else
            controls_mc.mc_soundLevel.mc_volume._xscale = 70;
            so.setVolume(_root.volume_value);
            this.gotoAndStop("onOver");
        } // end else if
    // Resize video proportionaly
    function regularSize ()
        videoObj._width = 600;
        videoObj._height = videoObj._width * relationshipW;
        if (videoObj._height > 360)
            videoObj._height = 360;
            videoObj._width = videoObj._height * relationshipH;
        videoObj.smoothing = true;
        //var scale:Number;
        videoObj._x = (600 - videoObj._width) / 2;
        videoObj._y = (360 - videoObj._height) / 2;
    function largeSize ()
        videoObj._width = Stage.width;
        videoObj._height = videoObj._width * relationshipW;
        if (videoObj._height > Stage.height)
            videoObj._height = Stage.height;
            videoObj._width = videoObj._height * relationshipH;
        videoObj.smoothing = true;
        //var scale:Number;
        videoObj._x = (Stage.width - videoObj._width) / 2;
        videoObj._y = (Stage.height - videoObj._height) / 2;
    // Fullscreen button
    controls_mc.fullscreen_mc.onRollOver = function ()
        if (Stage["displayState"] == "normal")
            this.gotoAndStop("fullOver");
        else
            this.gotoAndStop("fullCloseOver");
        } // end else if
    controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
        if (Stage["displayState"] == "normal")
            this.gotoAndStop("full");
        else
            this.gotoAndStop("fullClose");
        } // end else if
    // Toggle fullscreen button
    controls_mc.fullscreen_mc.onRelease = function ()
        if (Stage["displayState"] == "normal")
            Stage["displayState"] = "fullscreen";
            _parent.video_txt.theText._visible = false;
        else
            Stage["displayState"] = "normal";
            _parent.video_txt.theText._visible = true;

  • Need help with XML transformation

    I am not sure this is the right place for this. But i will try it here. I am very troubled with my XSLT. Trying to transform a text Coupon which has the following html for it. So,
    _1. INPUT is:_
    <html>
    <head>
    </head>
    <body>
    <p>
    This coupon is for a good guy whose first name is :
    </p>
    <p>
    </p>
    <p align="center">
    Sadd
    </p>
    <p align="center">
    </p>
    <p align="right">
    <b>also</b> whose <var>full_name</var> is Sadd Hossain
    </p>
    <p align="left">
    </p>
    <p align="left">
    He is a <font size="3">software </font><font size="4">engineer for</font><font size="5">
    S&H</font>
    </p>
    </body>
    </html>
    *2. output needed  is:*
    <?xml version="1.0" encoding="UTF-8"?>
    <POSMESSAGE>
    <TextMSG >
    This coupon is for a good guy whose first name is :
    </TextMSG>
    <TextMSG >
    </TextMSG>
    <TextMSG align="center">
    <emph>SADD</emph>
    </TextMSG>
    <TextMSG >
    </TextMSG>
    <TextMSG align="right" >
    also whose full_name is Sadd Hossain
    </TextMSG>
    <TextMSG>
    </TextMSG>
    <TextMSG align="left" >
    He is a software engineer
    for S&H
    </TextMSG>
    </POSMESSAGE>
    *3. XSLT for this*
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:template match="body">
    <POSMESSAGE>
    <xsl:for-each select="p">
    <TextMSG>
    <!--xsl:if test="not[@align='']"-->
    <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
    <!--/xsl:if-->
    <xsl:attribute name="font"><xsl:value-of select="@size"/></xsl:attribute>
    <xsl:value-of select="."/>
    </TextMSG>
    <xsl:for-each select="b">
    <emph>
    <xsl:value-of select="."/>
    </emph>
    </xsl:for-each>
    </xsl:for-each>
    </POSMESSAGE>
    </xsl:template>
    </xsl:stylesheet>
    *4: the above xslt generating this output*
    <?xml version="1.0" encoding="UTF-8"?>
    <POSMESSAGE><TextMSG align="" font="">
    This coupon is for a good guy whose first name is :
    </TextMSG><TextMSG align="" font="">
    </TextMSG><TextMSG align="center" font="">
    SADD
    </TextMSG><TextMSG align="center" font="">
    </TextMSG><TextMSG align="right" font="">
    also whose full_name is Sadd Hossain
    </TextMSG><TextMSG align="left" font="">
    </TextMSG><TextMSG align="left" font="">
    He is a software engineer
    for S&H
    </
    *5: Need help with this. what should my xslt look like to get the desired output???????????????*
    any help or direction will be very much appreciated. Thank you_

    I have below suggestions:
    1. Please use code option given in message editor toolbar for posting any formatted content like XML, Java code snippet etc.
    2. replace & in your source XML with _& a m p ;_ (Without spaces, I have put spaces to make it visible here).
    3. I have modified your XSLT according output XML you have given. I am not sure what you want to do with some elements like <b>, <font>, <var> etc. change below XSLT as you require for these elements.
    Modified XSLT:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
            <xsl:output method="xml"/>
         <xsl:template match="body">
              <POSMESSAGE>
                   <xsl:for-each select="p">
                        <TextMSG>
                             <xsl:if test=". != ''">
                                  <xsl:for-each select="@align">
                                       <xsl:attribute name="align">
                                            <xsl:value-of select="."></xsl:value-of>
                                       </xsl:attribute>
                                  </xsl:for-each>
                                  <xsl:value-of select="."/>
                             </xsl:if>
                        </TextMSG>
                   </xsl:for-each>
              </POSMESSAGE>
         </xsl:template>
    </xsl:stylesheet>
    OUTPUT:
    <?xml version="1.0"?>
    <POSMESSAGE>
         <TextMSG>This coupon is for a good guy whose first name is :</TextMSG>
         <TextMSG/>
         <TextMSG align="center">Sadd</TextMSG>
         <TextMSG/>
         <TextMSG align="right">alsowhose full_name is Sadd Hossain</TextMSG>
         <TextMSG/>
         <TextMSG align="left">He is a softwareengineer forS&H</TextMSG>
    </POSMESSAGE>

  • Help in XML parse

    Can anyone help in parsing a XML formatted like this by using pl/sql:
    <user><id>myId</id><test><type>XYType</type>hereisthevalue</test></user>
    thanks.

    It really depends on what you want to do with it but here is one option:
    This block will parse out the user id and test type. I am typing this without access to a database to try it or an xml editor. I think you have an error in your xml. I removed "hereisthevalue" as it is in the wrong place. It needs to be wrapped in an additional tag.
    declare
    v_xml xmltype ;
    begin
    v_xml := xmltype('<user><id>myId</id><test><type>XYType</type></test></user>');
    dbms_output.put_line('User ID=' || v_xml.extract('/user/id/text()).getStringVal());
    dbms_output.put_line('Test Type=' || v_xml.extract('/user/test/type/text()).getStringVal());
    end;
    Hope that helps,
    LewisC

  • Need help processing XML files

    I'm fairly new to Java and have never worked with XML. I need to process several XML files and display them in a matrix for comparison and I'm not sure if I need to understand SAX, DOM or some other API. I'm not creating the files, I'm just parsing them to put into a table so they can be displayed for comparison. I could be processing up to several hundreds of files, so performance would also be an issue.
    I'm just looking for options and possible areas I can begin to look for help. Can anyone tell me which APIs would help me acheive my goal?
    Any help would be greatly appreciated.
    Thanks

    Thanks for the response Kev. I guess a better diescription of the problem would be to say that I want to display the attributes and values of the differnet files in a matrix.
    For example...
    Here are 2 sample xml files with the same tags and attributes.
    XML FILE A
    <tag1 name="Fred", country="ca">
    <tag2 group-name="Group 1">
    <tag3 color ="blue">
    </tag3>
    </tag2>
    </tag1>
    XML FILE B
    <tag1 name="Sue", country="us">
    <tag2 group-name="Group 2">
    <tag3 color="red">
    </tag3>
    </tag2>
    </tag1>
    I would like to have them displayed as follows...
    XML FILE A XML FILE B
    tag1 name           Fred Sue
    tag1 country           ca us
    tag2 group-name          Group 1 Group 2
    tag3 Color          Blue     Red
    HTML tags didn't work, so the matrix is bunched together, but I think you get the idea. My question is, which would be better to use SAX or DOM. I could be running this on as many as 50 or 60 files, so the matrix could get very large and performance could be an issue as multiple users could be doing this comparison at the same time.

  • HELP ::: DOM XML Parser

    Hi,
    I am trying to parse this xml.
    <Node>MS
    <Condition>BooleaaaaanOperator
    <Operation>AND</Operation>
    <Condition>NumberList
    <Comment>Only destinations are allowed to be sent.</Comment>
    <Type>0</Type>
    <Number>083538</Number>
    </Condition>
    <Condition22>BooooooooooooleanOperator
    <Operation1>NOT</Operation1>
    <Condition55>BooleeeeeeeeeeanOperator
    <Operation2>AND</Operation2>
    <Condition33>ExtensionNr
    <Comment>When Extension Number 2 is not set to 1 it indicates the content type of the message.</Comment>
    <Number>2</Number>
    <Value>1</Value>
    </Condition33>
    <Condition44>ExtensionNr
    <Numm>101010101010101</Numm>
    <Value>0-1002</Value>
    </Condition44>
    </Condition55>
    </Condition22>
    </Condition>
    <Node>Fee
    I can get the Numm string using the parser by this line
    elementSub5.getFirstChild().getNextSibling().getNodeName())
    BUT:: I cannot get the value of that node to print out, or set it to a variable.
    I really need the 101010101010101 but cannot get them. I have tried everything.

    If you could post more code I could possibly help you out. Just post some code of where the problem is and I will look at it. I believe there is a getNodeValue() method and there may be a getTextContent() method or something... actually I think I ran into this problem before... you can pull the value out of the toString() method by using a substring.
    I used something like this and it worked fine...
    String data = node.toString();
    data = data.substring(data.indexOf(":")+1, data.length()-1);
    In your case perhaps you can try something like this...
    String elementData = elementSub5.getFirstChild().getNextSibling().toString();
    elementData = elementData.substring(elementData.indexOf(":")+1, elementData.length()-1);
    That substring method may not be 100% accurate... you best bet is to just put the node to a string and by debugging the program look at what the string value is. You can then adjust the substring to grab the correct data from the XML.
    You would think there is a better way to do this... but I could not find it and this way worked for me...

  • Need help in xml bursting email bodt contents based on condition

    Dear All,
    I have a requirement as below.
    I am developing a xml publisher report with bursting functionality, i need to set a email body based on some condition, so please help me out how i can set the email body dynamically in xml bursting file.
    Note:The email body may be huge. for ex:
    Dear ${LINE_MANAGER_POSITION},<br/><br/>
       The probationary period for ${FULL_NAME} holding Worker Number ${EMPLOYEE_NUMBER} will end on ${PROBATION_END_DATE}. Please be sure to assess the employee carefully and fill out the attached Probationary Period Report, sign it, and send it to your HR Business Partner ${HR_BP_EMP_NAME} before ${PROB_END_DATE_BEFORE}.  <br/><br/>
       Please note: <br/>
        <ul> <li> The maximum probationary period allowed by UAE labor law is six months starting from the Hire Date. Probation extensions beyond six months are not permitted.</li> </ul>
        <ul> <li> During the probationary period, the Employee has the right to end ${GENDER} employment contract with five working days notice period.</li> </ul>
        <ul> <li> According to UAE labor law, the Employee is considered a permanent Employee with limited or unlimited contract if ${A_HE_SHE} is not notified that ${A_HE_SHE} is not suitable for the position ${A_HE_SHE} is assigned to. Dubai Petroleum Establishment Human Resources Division will consider the probationary period to be successful if you do not complete and sign the Probationary Period Evaluation form for ${FULL_NAME} before ${PROB_END_DATE_BEFORE}.</li> </ul>
        <ul> <li> If the Employee passes the probationary period successfully and is subsequently deemed unsuitable for the assigned Position then the HR disciplinary process prevails.</li> </ul>
       For more information on the Employee probationary period process and assessment approaches, please <a href="_http://dullap01/livelink/livelink.exe/open/29695955"> click here </a> or contact your Human Resources Business Partner ${HR_BP_EMP_NAME} at <a>${HR_BP_EMAIL}</a><br/><br/><br/>
       Yours sincerely, <br/>
       Human Resources Division </font>
    Thnaks
    Deb

    logo's should be pulling are the logo's directly embedded in format template?
    Suggest you download and use the [Bursting Designer|http://bipublisher.blogspot.com/2009/09/bi-publisher-bursting-designer.html] and review the log file for errors. You will need to change your templates to point locally on your pc.
    Ike Wiggins
    http://bipublisher.blogspot.com

  • Need help in xml

    i want to know how to parse an xml doc using javax.xml.parsers
    i have written a simple ide for java with lots of options and the software would look better if i include xml support.
    u can find the code below.
    /* Thank you for your interest in viewing the source of Jcom */
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.jar.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.undo.*;
    import javax.swing.text.*;
    // The main Class.
    public class Jcom extends JFrame
    JTextArea t=new JTextArea();
    JTextField output;
    Font f=new Font("SansSerif",Font.PLAIN,13);
    int count=0,char_count=0,class_count=0,char_changed=0,recent_compile=0,tabinsert=0;
    String curfile,Dir="./",text,file="Untitled",Key_word="",ext="java";
    String menucomm[]={"New","Open","Save","Save as","Exit","Cut","Copy","Paste","Select All","Comment","Compile","Run","About","Shortcut List","Undo","Redo","Bookmark"};
    File o_file;
    OutputStream f1;
    MessageWindow mw=new MessageWindow("Console Window.");
    protected UndoManager undo = new UndoManager();
    static Jcom jc;
    StatusBar status;
    JProgressBar progress;
    displayProgress dp=new displayProgress("Loading in Progress.");
    JComboBox jb;
    // Constructor
    public Jcom(String title) throws Exception
    super(title);
    setVisible(true);
    //setIconImage(new ImageIcon("./images/icon.gif"));
    t.setMargin(new Insets(20,30,20,20));
    setSize(700,500);
    String vers = System.getProperty("java.version");
    if(vers.compareTo("1.1.2")>0)
    t.setDragEnabled(true); // Works only in version 1.4
    t.setAutoscrolls(true);
    t.setFont(f);
    t.setLineWrap(true);
    t.setWrapStyleWord(true);
    t.setTabSize(6);
    Dimension dim=getToolkit().getScreenSize();
    setLocation(dim.width/2-getWidth()/2,dim.height/2-getHeight()/2);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new Winlis());
    undo.discardAllEdits();
    //main() method
    public static void main(String arg[]) throws Exception
    jc=new Jcom("JCom - The Java IDE.");
    jc.addmenu();
    jc.addtools();
    // Ask for exit
    public void askexit()
    int ch=2;
    if(char_changed==1)
    ch=JOptionPane.showOptionDialog(null,"Save Changes you made to "+file+" ?","Confirm",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,null,null);
    if(ch==0)
    save_doc();
    System.exit(0);
    public boolean save_doc()
    try
         if(file.equals("Untitled") || file==null)
              save_doc_as();
         else
         String text=t.getText();
         byte buf[]=text.getBytes();
         o_file=new File(Dir,file);
         OutputStream f1=new FileOutputStream(o_file);
         f1.write(buf);
         f1.close();
         char_changed=0;
         setTitle(file+" - JCompile");
    //setIcon(new ImageIcon("./images/icon.gif");
         catch(Exception i)
         return false;
    output.setText(file+" Total lines : "+t.getLineCount());
    return true;
    public boolean save_doc_as()
         try
         FileDialog fd=new FileDialog(this,"Save this document as",FileDialog.SAVE);
         fd.setVisible(true);
         file=fd.getFile();
         if(file==null)
         file="Untitled";
         return false;
         Dir=fd.getDirectory();
         text=t.getText();
         byte buf[]=text.getBytes();
         o_file=new File(Dir,file);
         f1=new FileOutputStream(o_file);
         f1.write(buf);
         f1.close();
         setTitle(file+" - JCompile");
         char_changed=0;
         setTitle(file+" - JCompile");
    //setIcon(new ImageIcon("./images/icon.gif");
         catch(Exception e)
         return false;
    output.setText(file+" Total lines : "+t.getLineCount());
    return true;
    public boolean compileit()
         try
         if(file.equals("Untitled"))
         if(save_doc()==false)
         return false;
         if(file==null)
         return false;
         if(char_changed==1)
         if(save_doc()==false)
         return false;
         output.setText("Compiling "+file+" ...");
         mw.jt.setText("Compiling "+file+" ..."+"\n");
         String comm="Javac.exe "+Dir+file;
         Process ps=Runtime.getRuntime().exec(comm);
         Runtime.getRuntime().gc();     
         InputStream textfile=ps.getErrorStream();
         DataInputStream dai=new DataInputStream(textfile);
         String S=dai.readLine();
         int errorcount=0;
         while(S != null)
         errorcount++;
         mw.jt.append(S+"\n");
         S=dai.readLine();
         if(errorcount==0)
              output.setText("Compilation Successful. Alt+v to Run the code.");
         else
         output.setText("Some Errors/Warnings occured during the compilation.");
         mw.setVisible(true);
         mw.setTitle("Compilation Results.");
         return false;
         }// end of try
         catch(IOException ie)
         JOptionPane.showMessageDialog(null, "Some I/O Error has occured. Please save your file and continue.", "I/O Error.",JOptionPane. ERROR_MESSAGE);
         return false;
         catch(Exception e)
         JOptionPane.showMessageDialog(null, "Exception has occured. Please save your file and continue.", "Exception.",JOptionPane. ERROR_MESSAGE);           
         return false;
         return true;
    public void run_program()
         try
         if(file==null)
         return;
         if(!mw.isVisible())
         mw.setVisible(true);
         if(char_changed==1)
         if(save_doc()==false)
         return;
         if(compileit()==false)
         return;
         mw.jt.setText("\nExecuting "+file+" ..."+"\n");
         int pos_dot=file.indexOf('.');
         char class_name[]=file.toCharArray();
         String class_name_string=new String(class_name,0,pos_dot);
         String comm="java "+class_name_string;
         Runtime ru=Runtime.getRuntime();
         Process ps=ru.exec(comm);
         InputStream textfile=ps.getErrorStream();
         Runtime.getRuntime().gc();     
         DataInputStream dai=new DataInputStream(textfile);
         String S=dai.readLine();
         if(S!=null)
         mw.jt.append("\nFollowing Runtime Error has occured.\n");
         int errorcount=0;
         while(S != null)
         errorcount++;
         mw.jt.append(S+"\n");
         S=dai.readLine();
         DataInputStream din=new DataInputStream(ps.getInputStream());
         S=din.readLine();
         errorcount=0;
         while(S != null)
         errorcount++;
         mw.jt.append(S+"\n");
         S=din.readLine();
         mw.jt.append("Execution of "+file+" has terminated."+"\n");
         output.setText("Execution completed.");
         mw.setTitle("Execution Results.");
         catch(IOException ie)
         JOptionPane.showMessageDialog(null, "Exception has occured. Please save your work and continue. ", "I/O Error",JOptionPane. ERROR_MESSAGE);           
         return;
         catch(Exception e)
         JOptionPane.showMessageDialog(null, "Exception has occured. Please save your work and continue. ", "I/O Error",JOptionPane. ERROR_MESSAGE);           
         return;
    public void addtools()
    //Adding toolbar
    JToolBar toolbar=new JToolBar();
    String[] iconfiles={"./images/new.gif","./images/open.gif","./images/save.gif","./images/cut.gif","./images/copy.gif","./images/paste.gif","./images/compile.gif","./images/run.gif"};
    jb = new JComboBox();
    jb.addActionListener(new bookListen());
    String[] butcomm={"New","Open","Save","Cut","Copy","Paste","Compile","Run"};
    ImageIcon[] icons=new ImageIcon[iconfiles.length];
    JButton[] buttons = new JButton[iconfiles.length];
    for(int i=0;i<iconfiles.length;i++)
         icons=new ImageIcon(iconfiles[i]);
         buttons[i]=new JButton(icons[i]);
         buttons[i].addActionListener(new actListen());
         buttons[i].setActionCommand(butcomm[i]);
         buttons[i].setToolTipText(butcomm[i]);
         toolbar.add(buttons[i]);
         if(i+1%3==0)
         toolbar.addSeparator();
         getContentPane().add("North",toolbar);
    status=new StatusBar();
    getContentPane().add("South",status);
    // this adds fonts support to the toolbar
    /*JComboBox jc = new JComboBox();
         String[] fonts = getToolkit().getFontList();
         for (int i = 0; i < fonts.length; i++)
         jc.addItem(fonts[i]);
         toolbar.add(jc);*/
    output=new JTextField(30);
    output.setEditable(false);
    status.add(output);
    status.add(new JLabel("Bookmarks "));
    jb.setMaximumRowCount(8);
    status.add(jb); //Add bookmark list
    validate();
    }/* End of addtools*/
    public void addmenu()
    //Adding menu Bar
    JMenuBar mb= new JMenuBar();
    setJMenuBar(mb);
    JMenuItem new1,open,save,save_as,cut,copy,paste,sel_all,und,red,find,replace,exit,about,compile,check,runit,shortcut_list,bookmark;
    // Adding contents for menu bar
    JMenu file=new JMenu("File");
    JMenu edit=new JMenu("Edit");
    JMenu search=new JMenu("Search");
    JMenu tools=new JMenu("Tools");
    JMenu make=new JMenu("Make");
    JMenu help=new JMenu("Help");
    new1=new JMenuItem("New");
    new1.setToolTipText("Create a new file.");
    new1.setIcon(new ImageIcon("./images/new.gif"));
    new1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK ));
    file.add(new1);
    new1.addActionListener(new actListen());
    open=new JMenuItem("Open");
    open.setToolTipText("Open an existing file.");
    open.setIcon(new ImageIcon("./images/open.gif"));
    open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK ));
    file.add(open);
    open.addActionListener(new actListen());
    save=new JMenuItem("Save");
    save.setToolTipText("Save changes.");
    save.setIcon(new ImageIcon("./images/save.gif"));
    save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK ));
    file.add(save);
    save.addActionListener(new actListen());
    save_as=new JMenuItem("Save as");
    save_as.setToolTipText("Save changes as.");
    file.add(save_as);
    save_as.addActionListener(new actListen());
    exit=new JMenuItem("Exit");
    exit.setToolTipText("Exit.");
    exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK ));
    file.add(exit);
    exit.addActionListener(new actListen());
    exit.setIcon(new ImageIcon("./images/exit.gif"));
    mb.add(file);
    cut=new JMenuItem("Cut");
    cut.setToolTipText("Cut selection.");
    cut.setIcon(new ImageIcon("./images/cut.gif"));
    cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK ));
    edit.add(cut);
    cut.addActionListener(new actListen());
    copy=new JMenuItem("Copy");
    copy.setToolTipText("Copy selection.");
    copy.setIcon(new ImageIcon("./images/copy.gif"));
    copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK ));
    edit.add(copy);
    copy.addActionListener(new actListen());
    paste=new JMenuItem("Paste");
    paste.setToolTipText("Paste from clipboard.");
    paste.setIcon(new ImageIcon("./images/paste.gif"));
    paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK ));
    edit.add(paste);
    paste.addActionListener(new actListen());
    sel_all=new JMenuItem("Select All");
    sel_all.setToolTipText("Select all.");
    sel_all.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK ));
    edit.add(sel_all);
    sel_all.addActionListener(new actListen());
    und=new JMenuItem("Undo");
    und.setToolTipText("Undo.");
    und.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK ));
    edit.add(und);
    und.addActionListener(new actListen());
    red=new JMenuItem("Redo");
    red.setToolTipText("Redo.");
    red.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK ));
    edit.add(red);
    red.addActionListener(new actListen());
    mb.add(edit);
    find=new JMenuItem("Find");
    search.add(find);
    find.setIcon(new ImageIcon("./images/find.gif"));
    find.addActionListener(new actListen());
    replace=new JMenuItem("Replace");
    search.add(replace);
    replace.setIcon(new ImageIcon("./images/replace.gif"));
    replace.addActionListener(new actListen());
    mb.add(search);
    JMenuItem tar_file=new JMenuItem("Create Archive");
    tools.add(tar_file);
    tar_file.addActionListener(new actListen());
    JMenuItem docu=new JMenuItem("Create Documentation");
    tools.add(docu);
    docu.addActionListener(new actListen());
    JMenuItem comment=new JMenuItem("Comment");
    comment.setToolTipText("Comment Selection.");
    tools.add(comment);
    comment.addActionListener(new actListen());
    bookmark=new JMenuItem("Bookmark");
    tools.add(bookmark);
    bookmark.addActionListener(new actListen());
    mb.add(tools);
    compile=new JMenuItem("Compile");
    compile.setToolTipText("Compile.");
    compile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.ALT_MASK ));
    make.add(compile);
    compile.setIcon(new ImageIcon("./images/compile.gif"));
    compile.addActionListener(new actListen());
    runit=new JMenuItem("Run");
    runit.setToolTipText("Run.");
    runit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.ALT_MASK ));
    make.add(runit);
    runit.setIcon(new ImageIcon("./images/run.gif"));
    runit.addActionListener(new actListen());
    mb.add(make);
    shortcut_list=new JMenuItem("Shortcut List");
    help.add(shortcut_list);
    shortcut_list.addActionListener(new actListen());
    about=new JMenuItem("About");
    help.add(about);
    about.addActionListener(new actListen());
    mb.add(help);
    //Register with document listener.
    t.getDocument().addDocumentListener(new docListen());
    // Register with Undo Listener
    t.getDocument().addUndoableEditListener(new UndoHandler());
    //Register with Keyboard listener
    t.addKeyListener(new keyListen());
    JScrollPane scrollpane=new JScrollPane(t);
    Container cont=getContentPane();
    cont.add(scrollpane);
    validate();
    }/* End of addmenu */
    /* Frame for displaying console outputs */
    public class MessageWindow extends JFrame
    JTextArea jt;
    public MessageWindow(String title)
    super(title);
    setSize(400,400);
    //setIcon(new ImageIcon("./images/icon.gif"));
    jt =new JTextArea();
    jt.setEditable(false);
    JScrollPane scroll=new JScrollPane(jt);
    getContentPane().add(scroll);
    jt.addKeyListener(new keyListen());
    jt.addMouseListener(new mouseListen());
    validate();
    }//End of console display class
    /* Frame for displaying progress bar during an operation */
    public class displayProgress extends JFrame
    JLabel jl;
    public displayProgress(String title)
    super(title);
    setSize(300,100);
    setResizable(false);
    removeNotify();
    Dimension dim=getToolkit().getScreenSize();
    setLocation(dim.width/2-getWidth()/2,dim.height/2-getHeight()/2);
    getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER,8,30));
    jl=new JLabel("Lines Loaded : ");
    progress = new JProgressBar();
    progress.setMinimum(0);
    progress.setMaximum(45);
    getContentPane().add(jl);
    getContentPane().add(progress);
    validate();
    }//End of progress display.
    public void addNew() // To add a new Book Mark
    String selectedText=t.getSelectedText();
    if(selectedText!=null)
    jb.addItem(selectedText);
    jb.showPopup();
    output.setText("Bookmark added.");
    public void remove() // To remove a Bookmark
    jb.removeAllItems();
    /* Book Mark Handler*/
    class bookListen implements ActionListener
    public void actionPerformed(ActionEvent ae)
    String search=(String)jb.getSelectedItem();
    if(search!=null)
    findString(search);
    }//End of class
    // Undo Handler
    class UndoHandler implements UndoableEditListener
         public void undoableEditHappened(UndoableEditEvent e)
              undo.addEdit(e.getEdit());
    }// undo handler
    public class keyListen extends KeyAdapter
    KeyStroke ks;
    public void keyPressed(KeyEvent ke)
    try
    ks=KeyStroke.getKeyStrokeForEvent(ke);
    String s1=KeyEvent.getKeyModifiersText(ks.getModifiers()); //s1 has modifiers like Ctrl+Alt
    String s2=KeyEvent.getKeyText(ks.getKeyCode()); //s2 has key like 'a'
    if(s2.equals("Up") || s2.equals("Down") || s2.equals("Left") || s2.equals("Right"))
    int chcount=t.getCaretPosition();
    int linecount=t.getLineOfOffset(chcount)+1;
    output.setText("Character count : "+chcount+" Line Number : "+linecount);
    boolean flag=true;
    String search;
         if(s1.equals("Ctrl+Shift")) // Required
              output.setText("Looking for Macro ...");          
              if(s2.equals("S"))
              t.insert("\tSystem.out.println(\"\");",t.getCaretPosition());
              output.setText("Macro : Insert System.out.println() method.");          
              else if(s2.equals("C")) // Create a default constructor
              if(file.equals("Untitled"))
              flag=save_doc_as();
              if(flag)
              int pos_dot=file.indexOf('.');
              char class_name[]=file.toCharArray();
              String class_name_string=new String(class_name,0,pos_dot);
              t.insert("public "+class_name_string+"()\n\t{\n\n\t}",t.getCaretPosition());
              output.setText("Macro : Insert Default Constructor.");          
              else if(s2.equals("M"))
              t.insert("\tpublic static void main(String arg[])\n\t{\n\n\t}",t.getCaretPosition());
              output.setText("Macro : Insert Main method.");          
              else if(s2.equals("T"))
              t.insert("try\n{\n\n}\n\ncatch(Exception e)\n{\n\te.printStackTrace();\n}",t.getCaretPosition());
              output.setText("Macro : Insert try-catch block.");                              }
         }// Macro check end ctrl+alt
         // Additional check using only alt.
         else if(s1.equals("Alt"))
              if(s2.equals("F"))
              search=mw.jt.getSelectedText();
              if(search!=null)
              findString(search);
         } // Alt check
    }//try
    catch(Exception e)
         output.setText("Cannot find the Error Region.");
    }// Function end
    }/* End of Keylisten */
    public void findString(String search)
    try
    boolean found=false;
              String lineToFind=search;
              if(lineToFind==null)
              return;
              for(int i=0;i<t.getLineCount();i++)
              int offset=t.getLineStartOffset(i);
              String lineInArea=t.getText(offset,lineToFind.length());
              output.setText("Currently Looking ... "+lineInArea);
              if(lineInArea.equals(lineToFind))
              t.requestFocus();
              t.select(offset,offset+lineToFind.length());
              output.setText("Required Line Detected.");
              found=true;
              break;
              }//for loop
              if(found==false)
              output.setText("Cannot find Required Line.");
              found=false;
    catch(BadLocationException be)
         output.setText("Cannot find the Error Region.");
    }// end of find error.
    //Window Listener
    public class Winlis extends WindowAdapter
    public void windowClosing(WindowEvent we)
    askexit();
    //Document Listener
    public class docListen implements DocumentListener
    public void changedUpdate(DocumentEvent de)
    try
    char_changed=1;
    setTitle(file+" <changed> - JCompile");
    //setIcon(new ImageIcon("./images/save.gif");
    int chcount=t.getCaretPosition();
    int linecount=t.getLineOfOffset(chcount)+1;
    output.setText("Character count : "+chcount+" Line Number : "+linecount);
    catch(BadLocationException be)
    output.setText("Character count : "+t.getCaretPosition());
    public void insertUpdate(DocumentEvent de)
    try
    char_changed=1;
    setTitle(file+" <changed> - JCompile");
    //setIcon(new ImageIcon("./images/save.gif");
    int chcount=t.getCaretPosition();
    int linecount=t.getLineOfOffset(chcount)+1;
    output.setText("Character count : "+chcount+" Line Number : "+linecount);
    catch(BadLocationException be)
    output.setText("Character count : "+t.getCaretPosition());
    public void removeUpdate(DocumentEvent de)
    try
    char_changed=1;
    setTitle(file+" <changed> - JCompile");
    //setIcon(new ImageIcon("./images/save.gif");
    int chcount=t.getCaretPosition();
    int linecount=t.getLineOfOffset(chcount)+1;
    output.setText("Character count : "+chcount+" Line Number : "+linecount);
    catch(BadLocationException be)
    output.setText("Character count : "+t.getCaretPosition());
    }//Document Listener
    // Action Listener
    public class actListen implements ActionListener
    //Action listener
    public void actionPerformed(ActionEvent ae)
    String str=(String)ae.getActionCommand();
    int command_number=0;
    for(int i=0;i<20;i++)
    if(str.equals(menucomm[i]))
    command_number=i;
    break;
    switch(command_number)
         case 0:
         if(char_changed==1)
         int ch=JOptionPane.showOptionDialog(null,"Save Changes you made to "+file+" ?","Confirm",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,null,null);
         if(ch==0)
         save_doc();     
         t.setText("");
         char_changed=0;
         setTitle("Untitled");
         file="Untitled";
         remove();
         undo.discardAllEdits();
         break;
         case 1:
         //open_doc();
         int ch=2;
         if(char_changed==1)
         ch=JOptionPane.showOptionDialog(null,"Save Changes you made to "+file+" ?","Confirm",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,null,null);
              if(ch==0)
              save_doc_as();
         t.setText("");
         FileDialog fd=new FileDialog(jc,"Open a file",FileDialog.LOAD);
         fd.setVisible(true);
         file=fd.getFile();
         // Support for class files also
         int pos_dot=file.indexOf('.');
         ext=file.substring(pos_dot+1,file.length());
         if(ext.equalsIgnoreCase("class")) // it is a class file
         try
         Runtime r=Runtime.getRuntime();
         String comm="jad.exe -s .java "+file;
         r.exec(comm);
         file=file.substring(0,pos_dot)+".java";
         catch(Exception e)
         output.setText("Some error has occured in Decompiling the class file.");
         Dir=fd.getDirectory();
         if(file!=null)
         Thread ofile=new openFile();
         ofile.start();
         dp.setVisible(false);
         remove();
         break;
         case 2:
         // Save
         save_doc();
         break;
         case 3:
         save_doc_as();
         break;     
         case 4:
         // Exit
         askexit();
         break;
         case 5:
         t.cut();
         break;
         case 6:
         t.copy();
         break;
         case 7:
         t.paste();
         break;
         case 8:
         t.selectAll();
         break;
         case 9: //comment
         String otext=t.getSelectedText();
         if(otext!=null)
         String ntext="/*\n"+otext+"\n*/";
         t.replaceSelection(ntext);
         break;
         case 10:
         if(char_changed==1)
         save_doc();
         output.setText("Compiling "+file+" ...");
         compileit();
         break;
         case 11:
         if(char_changed==1)
         compileit();
         if(file.equals("Untitled"))
         save_doc_as();
         compileit();
         else
         output.setText("Executing "+file+" ...");
         run_program();
         break;
         case 12: //about
         JOptionPane.showMessageDialog(null, "Jcom - IDE for Java beta 1.0.\nVisit www.geocities.com/prabhus14 for updates.", "About",JOptionPane. INFORMATION_MESSAGE);           
         break;
         case 13: //Short Cut List
         mw.setVisible(true);
    mw.setTitle("Shortcut keys List.");
         mw.jt.setText("Shortcut Keys for Jcom.\nRight now only some of them are implemented.\nIn later versions users can customise these keys(called \"macros\" in Jcom) and can also add new ones!");
         mw.jt.append("\nMacros begin with Ctrl+Shift or Alt alone.\n\n");
         mw.jt.append("Ctrl+Shift+S\tTo insert System.out.println() method.\n");
         mw.jt.append("Ctrl+Shift+C\tTo create the default constructor for your class.\n");
         mw.jt.append("Ctrl+Shift+M\tTo insert main() method.\n");
         mw.jt.append("Ctrl+Shift+T\tTo insert try-catch block.\n");
         mw.jt.append("\nThe following macro is quite different and will differentiate Jcom from any other IDE.\n");
         mw.jt.append("\nAfter compiling if you get any errors then the console window will automatically appear with the messages.\n");     
         mw.jt.append("1. Select the line in the Error Message.(using mouse of course)\n");
         mw.jt.append("2. Press Alt+F or Right Click.\n");
         mw.jt.append("3. You will see the Error Region selected in your code.\n");
         mw.jt.append("Remember you must select right from the beginning of the line.\nRead Readme.html for more guidance.\n");     
         break;
         case 14:
         if(undo.canUndo())
              undo.undo();
              output.setText(undo.getUndoPresentationName());
         break;
         case 15:
         if(undo.canRedo())
              undo.redo();
              output.setText(undo.getRedoPresentationName());
         break;
         case 16: //Bookmark
         addNew();
         break;
    }/*End of action listener*/
    }//Action Listener
    // Mouse Listener
    class mouseListen extends MouseAdapter
    String search;
    public void mouseClicked(MouseEvent me)
    String vers = System.getProperty("java.version");
    if(vers.compareTo("1.1.2")>0)
    if(me.getButton()==3)
         search=mw.jt.getSelectedText();
         if(search!=null)
         findString(search);
    }//mouse listener
    // A thread for opening file.
    protected class openFile extends Thread
    openFile()
    setPriority(7);
    public void run()
    try
         int count=0;
         File fil1=new File(Dir,file);
         dp.setVisible(true);
         int factor=(int)fil1.length()/45;
         int i=1;
         FileInputStream textfile=new FileInputStream(fil1);
         DataInputStream dai=new DataInputStream(textfile);
         String S=dai.readLine();
         count+=S.length();
         dp.jl.setText("Lines Loaded : "+i++);
         if(ext.equals("class"))
         t.setText("/* Jcom - IDE for Java.\nVisit www.geocities.com/prabhus14 for updates.\n*/\n");
         while(S != null)
         if(ext.equals("class"))
         if(i>5)
         t.append(S+"\n");
         else
         t.append(S+"\n");
         S=dai.readLine();
         count+=S.length();
         progress.setValue((int)count/factor);
         dp.jl.setText("Lines Loaded : "+i++);
         }//while
         progress.setValue(45);
         dp.setVisible(false);
         setTitle(file+" - JCompile");
         catch(Exception ie)
         dp.setVisible(false);
    output.setText(file+" Total lines : "+t.getLineCount());
    return;
    }//End of run
    }//End of thread     
    // A class simulating Status Bar
    class StatusBar extends JComponent
    public StatusBar()
         super();
         setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    public void paint(Graphics g)
    super.paint(g);
    }//End of class StatusBar
    }/*End of class Jcom*/

    Hmm well my first reply didn't seem to make it.
    I would recommend Castor if you are talking about supporting XML to save your Java Objects. Castor is a great XML-Java data binding tool that I personally love. You can just write a map between the XML and java elements and it can marshal and unmarshal for you. JAXB (Java API fo XML Binding) can do the same thing but you have to build the classes from a schema you can't just supply a map for it (so you might have to rework your classes). If you mean that you want to edit XML directly in the IDE then you might want to look at the DOM (Document Object Model), its memory intensive though.

Maybe you are looking for

  • How to get character entered in JPasswordField

    Hi, I am using a JPassword field and i need to get the password entered(i mean the characters entered) getText() is depricated so i used getPassword(), but it gave me some other things (%@$#) for what i entered (abcd). 1) How can i get the exact char

  • Apache Tomcat vs IBM Websphere

    Hi, In our current deployment, I am using Apache Tomcat as the Java Application Server that comes bundled with Hyperion Planning 9.3.1 suite of applications. The documentation also suggests Oracle Application Server, IBM Websphere and BEA WebLogic. C

  • Solaris 10 x86/x64 on NVidia ION

    Hello guys, is it possible to install Solaris 10 x86/x64 on the NVidia ION-Platform? Are there any successful installations? For me it is important to know about the Point-of-view ION/330. This board I think is for a little home server a great perfor

  • How to create updateble View Objects

    Hi All, I need Help on this issue. I am using jdev 10g. Is there any Option to create Updateble VO or i need write any coding Thanks NR

  • Help with the look of a link

    hi friends. i dont like the way when you make text a link how iweb puts a line under the text....is there a way i can enable text to be a link without that line underneath it?