SAX Parser Global Variable problem

Can someone tell me what i am doing wrong.
i have a javabean called querybean that i store cdata from an xml file. i also have a map that i want to store this querybean in.
when i debug this, i can see the map being populated in my end element event call, but when i return the map, there is nothing in it.
I'm not really sure why this is. is the calling of the parser events run on a differnt thread or something.
here is my code
public class XmlParsing extends DefaultHandler implements LexicalHandler{
     String reportId = null;
     boolean cdataSection = false;
     StringBuffer cdataString = new StringBuffer();
     Map queryMap = new HashMap();
     QueryBean queryBean = new QueryBean();
     public static final String LEXICAL_SAX_PROPERTY =
     "http://xml.org/sax/properties/lexical-handler";
     public Map XmlPassThrough(File file)
          DefaultHandler handler = new XmlParsing();
          SAXParserFactory factory = SAXParserFactory.newInstance();
          try
          SAXParser saxParser = factory.newSAXParser();
          saxParser.setProperty("http://xml.org/sax/properties/lexical-handler",handler);
          saxParser.parse(file,handler);
          catch(Exception e)
               e.printStackTrace();
          return this.queryMap;
     //////////Setters and Getters////////////////////////////
     public String getReportId() {
          return reportId;
     public void setReportId(String reportId) {
          this.reportId = reportId;
     public boolean isCdataSection() {
          return cdataSection;
     public void setCdataSection(boolean cdataSection) {
          this.cdataSection = cdataSection;
     public StringBuffer getCdataString() {
          return cdataString;
     public void setCdataString(StringBuffer cdataString) {
          this.cdataString = cdataString;
     public Map getQueryMap() {
          return queryMap;
     public void setQueryMap(Map queryMap) {
          this.queryMap = queryMap;
     /* Handler Methods*/
     public void startDocument() throws SAXException{
          System.out.println("Start of Document");
     public void endDocument() throws SAXException{
          System.out.println("End of Document");
     public void startElement(String namespaceURI,
                                   String lName,
                                   String qName,
                                   Attributes attrs)
     throws SAXException
          String eName = lName;
          if("".equals(eName)) eName = qName;
          if(qName.equals("sql"))
                         queryBean.setReportID(attrs.getValue("report_id"));
                         queryBean.setReportType(attrs.getValue("report_type"));
                         if(attrs.getValue("report_start_date").equals("true"))
                         queryBean.setReport_start_date(true);
                         else
                              queryBean.setReport_start_date(false);
     public void endElement(String namespaceURI,
String sName, // simple name
String qName // qualified name
throws SAXException
          if(qName.equals("select"))
               queryBean.setSelect(this.getCdataString());
          else if(qName.equals("from"))
               queryBean.setFrom(this.getCdataString());
          else if(qName.equals("where"))
               queryBean.setWhere(this.getCdataString());
          else if(qName.equals("group"))
               queryBean.setGroup(this.getCdataString());
          else if(qName.equals("order"))
               queryBean.setOrder(this.getCdataString());
          else if(qName.equals("sql"))
               this.queryMap.put(queryBean.getReportID(),queryBean);
               this.setQueryMap(queryMap);
          this.cdataString.setLength(0);
     public void characters(char buf[], int offset, int len)
throws SAXException
          if(this.isCdataSection())
               String str = new String(buf,offset,len);
               this.cdataString.append(str);
     /* LexicalHandler Methods*/
     public void endCDATA() throws SAXException {
          // TODO Auto-generated method stub
          System.out.println(this.cdataString.toString());
          System.out.println("end of CDATASECTION");
          this.setCdataSection(false);
     public void endDTD() throws SAXException {
          // TODO Auto-generated method stub
     public void startCDATA() throws SAXException {
          // TODO Auto-generated method stub
          System.out.println("Start of CDATASECTION");
          this.setCdataSection(true);
     public void comment(char[] ch, int start, int length) throws SAXException {
          // TODO Auto-generated method stub
     public void endEntity(String name) throws SAXException {
          // TODO Auto-generated method stub
     public void startEntity(String name) throws SAXException {
          // TODO Auto-generated method stub
     public void startDTD(String name, String publicId, String systemId) throws SAXException {
          // TODO Auto-generated method stub
     }

Well, despite all your copious use of "this" you actually have two instances of your class. You create one, then in its XmlPassThrough method you create a second one to be the handler for the first one. The second one is where you accumulate all your data, and then you return the empty data from the first one.
So remove this line:DefaultHandler handler = new XmlParsing();and replace all references to the "handler" variable by "this". That way your XmlParsing object acts as its own handler and accumulates data in its own fields.

Similar Messages

  • Replacing 20 fixstatements by Global Variable - Problem 255 bytes length

    Hello,
    we have an issue in businessrules with setting the fix statement on 1 dimension:
    we currently use Fix (@RELATIVE("CBU_ALL",0) ) - on level 0 are approx. 3000 members - on medium level are 20 CBUs Seat and 20 CBUs Door
    we have approx. 20-30 similar businessrules - which either calculate on seat or door CBUs
    the requirement is to either calculate with a rule the 20 CBUs for Seats or the 20 CBUs for Doors
    as we currently do not fix properly on either Seat or Door CBUs, we calculate approx. 1500 empty members (empty, if fix in another dimension done correctly) - tests showed, that this doubles the time which would be needed.
    I know we could easily set 20 fixes in each business rule:
    @RELATIVE("CBU_BMW_Seat",0)
    ....20 more....
    @RELATIVE("CBU_Ford_Seat",0)
    (the fix above would then exclude the 1500 members, which are below:
    @RELATIVE("CBU_BMW_Doors",0)
    ....20 more....
    @RELATIVE("CBU_Ford_Doors",0)
    unfortunately, the number of CBUs/Customers is frequently renamed or some are added, so I can not afford to built these 20 fixstatements into 20 different businessrules and maintain them all the time.
    I thought of using UDAs or Attribute Values -
    but it seems not to be possible in a fixstatment to combine a relative or Children fixstatement with UDAs, which are set on the upper member ?
    I assume it works, if I classify all 3000 level 0 members with UDA or attribute SEATS or DOORS - but that's inefficient
    @RELATIVE("CBU_BMW_Seat",0) AND @UDA(CBU,"SEATS")
    @CHILDREN("CBU_BMW_Seat") AND @UDA(CBU,"SEATS")
    @Descendants("CBU_BMW_Seat") AND @UDA(CBU,"SEATS")
    @UDA(CBU,"SEATS")
    generally, it seems not to be allowed to combine Children or descendant fixes with any other relations or conditions ?
    @CHILDREN(@Match(CBU," Seat") ) (attempt to search for all children of all CBUs with Seat in its name)
    So the idea is to define 2 global variables:
    1 for Seats and 1 for Doors:
    [SEAT] includes then then: @children("CBU_BMW_Seat") ... 20 more @children("CBU_Ford_Seat")
    advantage would be, we can maintain the list of CBUs in 1 place
    my problem is: length of global variable is limited to 255 bytes - I need 800 to 900 digits to define the 20 CBUs
    having 8 global variables instead of 40 CBUs referenced in Fixstatements is not really an advantage
    even if I would rename the CBUs to just S1,S2,S3,S4 D1,D2,D3 (S for Seat, D for Door) (and use aliases in Planning and Reporting with full name to have the right meaning for the users), it does not fit into 1 variable: @children("S1"), @Children("S2"), ..... is simply too long (still 400 digits)
    also other attempts to make the statement shorter, failed:
    @children(@list("CBU_BMW_Seat","CBU_Ford_Seat",.....)) is not allowed
    is there any other idea of using global variables, makros, sequences ?
    is there a workaround to extend global variable limit ? we have release 9.3.1 - is this solved in future releases ?
    are there any other commands, which I can combine in clever way in fixstatements with
    @relative
    @children
    @descendants
    with things like @match @list ?
    (Generation and Level are no approrate criteria for Separating Seat and Doors, as the hierarchy is the same)
    please understand, that as we use this application for 5 years with a lot of historic data and it's a planning application with a lot of webforms and financial reports, and all the CBU members are stored members with calculated totals and access rights and setup data on upper members,
    I can not simply re-group the whole cbu structure and separate Seats and Doors just for calculation performance
    CBU dimension details is like this:
    Generation:
    1 CBU_ALL
    2 CBU_BMW
    3 CBU_BMW_Seat
    4 Product A
    4 Product B
    ..... hundreds more
    3 CBU_BMW_Door
    4 Product C
    4 Product D
    .... hundreds more
    2 CBU_Ford
    3 CBU_Ford_Seat
    4 Product E
    4 Product F
    .... hundreds more
    3 CBU_Ford_Doors
    4 Product G
    4 Product H
    .... hundreds more
    20 more CBUs with below 20 CBUs Seat and 20 CBUs Door

    How hard would it be to insert 2 children under CBU_All? Name them CBU_Seats and CBU_Doors, then group all the Seats and Doors under them.
    Then your calc could be @Relative(CBU_Doors, 0).
    I know it's not always easy or feasible to effect change to a hierarchy, but I just had the thought.
    Robert

  • Global variable problem

    hi all
    if i use this SELECT 'C' || mycodes.NEXTVAL INTO :ins2.code FROM DUAL; on pre-insert trigger so the global variable is not working for this field :ins2.code..
    but if i use on key-commit then working but i want to use on pre-insert
    here is my key-commit trigger codes
    begin
    SELECT 'C' || mycodes.NEXTVAL INTO :ins2.code FROM DUAL;
    if
    :ins2.name is not null
    then
    :global.name := :ins2.name;
    :global.code := :ins2.code;
    commit_form;
    end if;
    end;
    plz help me out thanks in advance
    sarah
    Edited by: SarahSarahSarah on Sep 7, 2009 6:41 AM

    Hi Sarah!
    The pre-insert trigger fires just when you call the commit_form build-in.
    So :ins2.code and :ins2.name are still null when you try to assign the values to the globals.
    Put the code inside the pre-insert trigger direct after the sequence-select.
    if
      :ins2.name is not null
    then
      :global.name := :ins2.name;
      :global.code := :ins2.code;
    end if;
    end;and the key-commit trigger:
    if
      :ins2.name is not null
    then
    commit_form;
    end if;
    end;or assign the values to the globals after the call to the commit_form build-in:
    if
      :ins2.name is not null
    then
      commit_form;
      :global.name := :ins2.name;
      :global.code := :ins2.code;
    end if;
    end;Regards
    Edited by: Magoo on 07.09.2009 13:47

  • SAX parsing and loops problem

    Hi!
    I currently have an XML file which looks like this:
    <jel>
    <admin creation="Fri Nov 09 17:14:55 GMT 2007" xsdversion="1.0.0" version="1.0.0"/>
    &#8722;
         <jelclass superclass="Object" visibility="public" package="" superclassfulltype="java.lang.Object" fulltype="Player" type="Player">
    &#8722;
         <implements>
    <interface fulltype="java.awt.event.ActionListener" type="ActionListener"/>
    <interface fulltype="java.awt.event.KeyListener" type="KeyListener"/>
    </implements>
    &#8722;
         <methods>
    &#8722;
         <constructor visibility="public" name="Player">
    &#8722;
         <params>
    <param name="newProtocol" fulltype="NewProtocol" type="NewProtocol"/>
    <param name="x" fulltype="int" type="int"/>
    <param name="y" fulltype="int" type="int"/>
    </params>
    </constructor>
    &#8722;
         <method visibility="public" name="actionPerformed" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.ActionEvent" type="ActionEvent"/>
    </params>
    </method>
    &#8722;
         <method visibility="public" name="keyPressed" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.KeyEvent" type="KeyEvent"/>
    </params>
    </method>
    &#8722;
         <method visibility="public" name="keyReleased" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.KeyEvent" type="KeyEvent"/>
    </params>
    </method>
    &#8722;
         <method visibility="public" name="keyTyped" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="e" fulltype="java.awt.event.KeyEvent" type="KeyEvent"/>
    </params>
    </method>
    <method visibility="public" name="getX" fulltype="int" type="int"/>
    &#8722;
         <method visibility="public" name="setX" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="x" fulltype="int" type="int"/>
    </params>
    </method>
    <method visibility="public" name="getY" fulltype="int" type="int"/>
    &#8722;
         <method visibility="public" name="setY" fulltype="void" type="void">
    &#8722;
         <params>
    <param name="y" fulltype="int" type="int"/>
    </params>
    </method>
    </methods>
    </jelclass>And I have SAX parsing code that looks like this:
    public class SaxParser{
          private HashSet <String>packageSet = new HashSet<String>();
          private ArrayList <String> classList = new ArrayList<String>();
          private ArrayList <String> packageList = new ArrayList<String>();
          private ArrayList <String> methodList = new ArrayList<String>();
          private Object[] packageNames;
          private HashMap <String, ArrayList> h = new HashMap <String, ArrayList>();
          public SaxParser()throws Exception{
              String fname = "eclipse/jel.xml";
             DefaultHandler handler = new DefaultHandler()
                 private int numberOfClasses = 0;
             public void startElement(String namespaceURI,String localName, String qname, Attributes attrs)
                  if(qname.equals("jelclass")) {
                       numberOfClasses ++;
                  for(int i = 0; i< attrs.getLength();i++){
                        if(attrs.getQName(i).equals("type")){
                             classList.add(attrs.getValue(i));
                             if(attrs.getQName(i).equals("package")){
                                  packageList.add(attrs.getValue(i));
                                  packageSet.add(attrs.getValue(i));
                  for(int i = 0; i< attrs.getLength();i++){
                       for(int j = 0; j < classList.size(); j++){
              if(attrs.getQName(i).equals("type") && attrs.getValue(i).equals(classList.get(j))){
                  if(qname.equals("method")){
                        if(attrs.getQName(i).equals("name")){
                                    h.put(classList.get(i), methodList.add(attrs.getValue(i));
                   packageNames = new String[packageSet.size()];
                  packageNames = packageSet.toArray();
             public void endElement(String namespaceURI,String localName, String qname){}};
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            saxParser.parse(new File(fname), handler);
         public int getPackageNumber(){
              return packageSet.size();
         public Object[] getPackageNames(){
              return packageNames;
         public ArrayList getPackageList(){
              return packageList;
         public ArrayList getClassList(){
              return classList;
         public ArrayList getMethodList(){
              return methodList;
          public static void main(String[] args)throws Exception{
               new SaxParser();
    }I am currently pulling out the package names, pulling out the classnames and then mapping these in a separate class - this works because the class and package names are declared in the same line, so if a package name appears in the package list 7 times, i know this package has 7 classes, and therefore i count the first 7 classes out of an array of all the classes and know that these are the right 7 for that package. However, the methods are a bit different:
    What I would like to do is to: for every class make a hashmap which maps the class name onto an arraylist of the methods, but i think i'm getting confused with my for loops. Or even just keep a tally of how many methods each class has, then I can work it out as i did with the packages -> classes.
    Does anyone know where im going wrong, or have any ideas at all?
    Thank you for your time,
    beccy
    :)

    I don't know if stacks are specifically mentioned in any SAX documentation.
    Basically, SAX sends you a stream of XML elements (open and close tags, characters, etc.), but it doesn't know anything about the underlying XML structure. You have to add that part (usually -- sometimes when writing a SAX application, you don't really care about the XML structure). XML structure is a tree.
    If you've ever written a recursive function that spans a tree, you'll have an idea what to do. You can use a stack to keep track of where you are in the tree. For example, if you open tag A, then you're "in" the A element for subsequent content in that document; if you then open tag B, you're in the B element; but when you close the B tag, you need the stack to tell you that now you're back in the A element.
    You may not need stacks, but it's likely. Find a good tutorial about SAX that mentions stacks and you'll be fine.
    Edited by: paulcw on Nov 14, 2007 4:09 PM

  • SAX Parser XML Validation Problems

    Hi,
    I’m having problems getting an xml document to validate within Weblogic 8.1. I am trying to parse a document that references both a dtd and xsd. Both the schema and dtd reference need to be substituted so they use local paths. I specify the schema the parser should use and have created an entityResolver to change the dtd reference.
    When this runs as a standalone app from eclipse the file parses and validates without a problem. When deployed to the app server the process seems to be unable read the contents of the dtd. Its not that it cannot find the file (no FileNotFoundException is thrown but this can be created if I delete the dtd) rather it seems to find no declared elements.
    Initial thought was that the code didn’t have access to read the dtd from its location on disk, to check I moved the dtd to within the deployed war and reference as a resource. The problem still persists.
    Code Snippet:
    boolean isValid = false;
    try {
         // Create and configure factory
    SAXParserFactory factory = SAXParserFactoryImpl.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    // To be notified of validation errors in the XML document,
    // add a custom error handler to the document builder
    PIMSFeedFileValidationHandler handler
    = new PIMSFeedFileValidationHandler();
         // Create and Configure Parser
    SAXParser parser = factory.newSAXParser();
    parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
    parser.setProperty(NAMESPACE_PROPERTY_KEY, getSchemaFilePath());
         // Set reader with entityResolver for dtd
    XMLReader xmlReader = parser.getXMLReader();
    xmlReader.setEntityResolver(new SAXEntityResolver(this.dtdPath));
    // convert file to URL, as it is a remote file
    URL url = super.getFile().toURL();
    // Open an input stream and parse
    InputStream is = url.openStream();
    xmlReader.setErrorHandler(handler);
    xmlReader.parse(new InputSource(is));
    is.close();
    // get the result of parsing the document by checking the
    // errorhandler's isValid property
    isValid = handler.isValid();
    if (!isValid) {
    LOGGER.warn(handler.getMessage());
    LOGGER.debug("XML file is valid XML? " + isValid);
    } catch (ParserConfigurationException e) {
    LOGGER.error("Error parsing file", e);
    } catch (SAXException e) {
    LOGGER.error("Error parsing file", e);
    } catch (IOException e) {
    throw new FeedException(e);
    return isValid;
    See stack trace below for a little more info.
    2005-01-28 10:24:09,217 [DEBUG] [file] - Attempting validation of file 'cw501205.wa1.xml' with schema at 'C:/pims-feeds/hansard/schema/hansard-v1-9.xsd'
    2005-01-28 10:24:09,217 [DEBUG] [file] - Entity Resolver is using DTD path file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/
    VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
    2005-01-28 10:24:09,227 [DEBUG] [file] - Creating InputSource at: file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
    2005-01-28 10:24:09,718 [WARN ] [file] - org.xml.sax.SAXParseException: Element type "Hansard" must be declared.
    org.xml.sax.SAXParseException: Element type "Session" must be declared.
    org.xml.sax.SAXParseException: Element type "DailyRecord" must be declared.
    org.xml.sax.SAXParseException: Element type "Volume" must be declared.
    org.xml.sax.SAXParseException: Element type "Written" must be declared.
    org.xml.sax.SAXParseException: Element type "WrittenHeading" must be declared.
    org.xml.sax.SAXParseException: Element type "Introduction" must be declared.
    … continues for all the elements in the doc
    2005-01-28 10:24:10,519 [DEBUG] [file] - XML file is valid XML? false
    2005-01-28 10:24:10,519 [WARN ] [file] - Daily Part file 'cw501205.wa1.xml' was not valid XML and was not processed.
    Has anybody seen this behavior before with weblogic and if so how have you resolved the issue.
    Thanks in Advance
    Adam

    Hi David,
    I have checked the ejb-jar.xml file and there is no duplicate values in it and the other things is that the same application is been deployed on OAS 10G and websphere and its working fine. In the forum someone has replied to a similar problem that there is bug in Weblogic 10.3 and its CR no 376292. I am not sure about it, does anyone any information about it.
    Thanks and Regards
    Deepak Dani

  • What format to input $currentdate(datetime) Global Variable in Data Services Management Console?

    What is the correct input format for the datetime Global Variable in Data Services Management Console? 
    I've tried several formats and keep getting a syntax error. 
    The DSMC is Version: 14.0.3.451
    I'm a new user and learning as I go.  
    Thanks for your help. 

    Hi,
    if you get syntax error as below,
      Syntax error at line <1>: <>: near <.04> found <a float> expecting <+, ||, DIVIDE, MOD, *, SUBVARIABLE, a decimal>.
      1 error(s), 0 warning(s).
      Check and fix the syntax and retry the operation.
      Error parsing global variable values from the command line: <$sedate=2014.12.04 12:00:00;>.
    Check the syntax and try again.
    solution is simple
    Place the global variable value in single quotes '2014.12.04 12:00:00'

  • Problem in parsing an XML using SAX parser

    Hai All,
    I have got a problem in parsing an XML using SAX parser.
    I have an XML (sample below) which need to be parsed
    <line-items>
    <item num="1">
         <part-number>PN1234</part-number>
         <quantity uom="ea">10</quantity>
         <lpn>LPN1060</lpn>
         <reference num="1">Line ref 1</reference>
         <reference num="2">Line ref 2</reference>
         <reference num="3">Line ref 3</reference>
    </item>
    <item num="2">
         <part-number>PN1527</part-number>
         <quantity uom="lbs">5</quantity>
         <lpn>LPN2152</lpn>
         <reference num="1">Line ref 1</reference>
         <reference num="2">Line ref 2</reference>
         <reference num="3">Line ref 3</reference>
    </item>
    <item num="n">
    </item>
    </line-items>
    There can be any number of items( 1 to n). I need to parse these
    item values using SAX parser and invoke a stored procedure for
    each item with its
    values(partnumber,qty,lpn,refnum1,refnum2,refnum3).
    Suppose if there are 100 items, i need to invoke the stored
    procedure sp1() 100 times for each item.
    I need to invoke the stored procedure in endDocument() method of
    SAX event handler and not in endelement() method.
    What is the best way to store those values and invoke the stored
    procedure in enddocument() method.
    Any help would br greatly appreciated.
    Thanks in advance
    Pooja.

    VO or ValueObject is a trendy new name for Beans.
    So just create an item class with variables for each of the sub elements.
    <item>
    <part-number>PN1234</part-number>
    <quantity uom="ea">10</quantity>
    <lpn>LPN1060</lpn>
    <reference num="1">Line ref 1</reference>
    <reference num="2">Line ref 2</reference>
    <reference num="3">Line ref 3</reference>
    </item>
    public class ItemVO
    String partNumber;
    int quantity;
    String quantityType;
    String lpn;
    List references = new ArrayList();
    * @return Returns the lpn.
    public String getLpn()
    return this.lpn;
    * @param lpn The lpn to set.
    public void setLpn(String lpn)
    this.lpn = lpn;
    * @return Returns the partNumber.
    public String getPartNumber()
    return this.partNumber;
    * @param partNumber The partNumber to set.
    public void setPartNumber(String partNumber)
    this.partNumber = partNumber;
    * @return Returns the quantity.
    public int getQuantity()
    return this.quantity;
    * @param quantity The quantity to set.
    public void setQuantity(int quantity)
    this.quantity = quantity;
    * @return Returns the quantityType.
    public String getQuantityType()
    return this.quantityType;
    * @param quantityType The quantityType to set.
    public void setQuantityType(String quantityType)
    this.quantityType = quantityType;
    * @return Returns the references.
    public List getReferences()
    return this.references;
    * @param references The references to set.
    public void setReferences(List references)
    this.references = references;

  • Problem with .DLL and global variables

    Hi,
    I need some helps to figure out my problem.
    I wrote a .dll file to open and run a GUI. When I run it at the first time, it is ok. When I call it again, there is an error "Pointer to free memory passed to library. It will be ok if I completely exit the program that calls the .dll before re-call it. I think there is some problems with global variables when I call another thread. How can I free global variables between threads. Is there any solution for this problem?
    Thanks

    Vinh Pham:
    Are you doing anything intentionally that frees your globals?
    CVI ships with an example program that demonstrates calling a DLL to create a user interface: guidll.cws.
    I made two simple modifications to guidll.cws.
    1. In guidll.c, I made hpanel global by moving its declaration from RunDLLUI() to right below the #include statements.
    2. In useguidll.c, I duplicated the lines calling RunDLLUI () and MessagePopup() to call the DLL gui twice.
    I built the project and ran it.  I had no problems with free'ed globals.
    Take a look at the guidll example.
    Can you either post your code or a modification to guidll that demonstrates the problem you're having?

  • Problems in syncronyzing two threads into Test Stand using a Global Variable (TestStand 4.1.1)

    I have one thread that is doing TCPIP Aquisition into a Global variable defined in Teststand. And I have another thread that it supose to read it. All are in the same sequence and execution. The problem is that the aquisition thread got a lot of bytes, while the processing thread is reading always only a few. Do you know what the problem could be?
    I will attach also some pictures just to be maybe more clear...
    Attachments:
    Implementation_pictures.zip ‏368 KB

    I wasn't looking at your Sequence, I was looking at Receive_HDL_Block.JPG. What is that VI doing (the one with number 3 on the icon and Size_in_bytes as an input) ?
    Where in teststand are you doing any checking?
    I don't really understand your sequence.
    You have a sequence (running in a new thread) (why), following by another called Receiver Handler (also running in a new thread) then two more sequences which seem to do some with transmitting something (also running as new threads). You are only waiting on one of these threads (the Receiver Handler). There does seem to be any loops in TestStand, you dont seem to be bothered about the other threads that you have running. What happens when this test sequence finally does stop, what is stopping the Threads that you have running.
    Your pictures dont really seem to fit in with your Test Sequence, such as where does Test_005.vi fit into everything
    The whole thing is a bit of a nightmare.
    Maybe your best bet would be to scrap the lot and start again. Only this time have a better understanding of what you what to achieve, what would be best to put into Teststand and what to put into labview. Whether you really need all those new threads running.
    Sorry to be so blunt.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Sax parser problem

    hi,
    i am assuming the problem is with sax parser but i cant be sure. I am parsing a xml file (about 1.4MB) with some data in it. the parser i have created reads the xml file correctly for the most part but when at some point the
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function stops working correctly....i.e it doesnt fully read read the data between the "<start>" and "</start>" element. say it reads about 100 id's correctly---for 101 ID it does this. This is just an example. Since, the problem might be with how :
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function is reading the data i was wondering if anybody else had encountered this problem or please let me know if i need to change something in the code: here's a part of the code :
    Bascially i have created three classes to enter data into three mysql tables and as i parse the data i fill up the columns by matching the column header with the tagName.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;
    import java.io.*;
    import java.util.ArrayList;
    import java.lang.Object;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class Echo03 extends DefaultHandler
    StringBuffer textBuffer;
    int issuedValue, prodValue;
    OrdHeader header = new OrdHeader();
    OrdDetail detail = new OrdDetail();
    Member memInfo = new Member();
    //new addition to store the dynamic value of the products
    TestOrdheader prod = new TestOrdheader();
    int counter;
    String tag, newTag;
    SetValue setVal = new SetValue();
    String test;
    public static void main(String argv[])
    if (argv.length != 1) {
    System.err.println("Usage: cmd filename");
    System.exit(1);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new Echo03();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Set up output stream
    out = new OutputStreamWriter(System.out, "UTF8");
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse( new File(argv[0]), handler);
    } catch (Throwable t) {
    t.printStackTrace();
    System.exit(0);
    static private Writer out;
    private String indentString = " "; // Amount to indent
    private int indentLevel = 0;
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    nl();
    nl();
    emit("START DOCUMENT");
    nl();
    emit("<?xml version='1.0' encoding='UTF-8'?>");
    header.assign();
    public void endDocument()
    throws SAXException
    nl(); emit("END DOCUMENT");
    try {
    nl();
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI,
    String lName, // local name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
    indentLevel++;
    nl(); //emit("ELEMENT: ");
    String eName = lName; // element name
    if ("".equals(eName)) eName = qName; // namespaceAware = false
    if (qName.equals("Billing")){
    issuedValue = 1;
    }else if (qName.equals("Shipping")){
    issuedValue = 2;
    }else if (qName.equals("ShippingTotal")){
    issuedValue = 3;
    //check to see if "Product" is the name of the element thats coming next
    if (qName.equals("Product")){
    if (issuedValue != 3){
    prodValue = 1;
    prod.addCounter();
    }else{
    prodValue = 0;
    tag = eName;
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength(); i++) {
    String aName = attrs.getLocalName(i); // Attr name
    if ("".equals(aName)) aName = attrs.getQName(i);
    nl();
    emit(" ATTR: ");
    emit(aName);
    emit("\t\"");
    emit(attrs.getValue(i));
    emit("\"");
    if (attrs.getLength() > 0) nl();
    public void endElement(String namespaceURI,
    String sName, // simple name
    String qName // qualified name
    throws SAXException
    nl();
    String eName = sName; // element name
    if ("".equals(eName)){
    eName = qName; // not namespaceAware
    if ("Order".equals(eName)){          
    //enter into database
         databaseEnter();
    textBuffer = null;
    indentLevel--;
    public void characters(char buf[], int offset, int len)
    throws SAXException
    nl();
    try {
    String s = new String(buf, offset, len);
    if (!s.trim().equals("")){
    settag(tag, s);
    s = null;
    }catch (NullPointerException E){
    System.out.println("Null pointer Exception:"+E);
    //===========================================================
    // Utility Methods ...
    //===========================================================
    // Wrap I/O exceptions in SAX exceptions, to
    // suit handler signature requirements
    private void emit(String s)
    throws SAXException
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    // Start a new line
    // and indent the next line appropriately
    private void nl()
    throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    out.write(lineEnd);
    for (int i=0; i < indentLevel; i++) out.write(indentString);
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    ===================================================================
    ///User defined methods
    ===================================================================
    private String strsplit(String splitstr){
    String delimiter = new String("=");
    String[] value = splitstr.split(delimiter);
    value[1] = value[1].replace(':', ' ');
    return value[1];
    public void settag(String tag, String s){         
    String pp_transid = null, pp_respmsg = null,pp_authid = null, pp_avs = null, pp_avszip = null;
    if ((tag.equals("OrderDate")) || (tag.equals("OrderProcessingInfo"))){
    if (tag.equals("OrderDate")){
    StringTokenizer st = new StringTokenizer(s);
    String orddate = st.nextToken();
    String ordtime = st.nextToken();
    header.put("ordDate", orddate);
    header.put("ordTime", ordtime);
    }else if (tag.equals("OrderProcessingInfo")){
    StringTokenizer st1 = new StringTokenizer(s);
    int tokenCount = 1;
    while (tokenCount <= st1.countTokens()){
    switch(tokenCount){
    case 1:
    String extra = st1.nextToken();
    break;
    case 2:
    String Opp_transid = st1.nextToken();
    pp_transid = strsplit(Opp_transid);
    break;
    case 3:
    String Opp_respmsg = st1.nextToken();
    pp_respmsg = strsplit(Opp_respmsg);
    break;
    case 4:
    String Opp_authid = st1.nextToken();
    pp_authid = strsplit(Opp_authid);
    break;
    case 5:
    String Opp_avs = st1.nextToken();
    pp_avs = strsplit(Opp_avs);
    break;
    case 6:
    String Opp_avszip = st1.nextToken();
    pp_avszip = strsplit(Opp_avszip);
    break;
    tokenCount++;
    header.put("pp_transid", pp_transid);
    header.put("pp_respmsg", pp_respmsg);
    header.put("pp_authid", pp_authid);
    header.put("pp_avs", pp_avs);
    header.put("pp_avszip", pp_avszip);
    }else{
    newTag = new String(setVal.set_name(tag, issuedValue));
    header.put(newTag, s);
    //detail.put(newTag, s);
    prod.put(newTag, s);
    memInfo.put(newTag,s);
    //Check to see-- if we should add this product to the database or not
    boolean check = prod.checkValid(newTag, prodValue);
    if (check){
    prod.addValues(s);
    setVal.clearMod();
    ==================================================================
    Here's the error that i get:
    java.util.NoSuchElementException
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
    at Echo03.main(Echo03.java:47)

    I haven't gone through your code but I also had a similar error....and the exception in my was because of an "&" instead of the entity reference & in one of the element values. I use a non-validating parser but if you use a validating one then this might not be the reason for your exception.

  • Problem in using SAX parser.

    Hai All,
    I have got a problem in using SAX parser.
    My XML looks like this:
    <authorizer>
    <first-name>HP</first-name>
    <last-name>Services</last-name>
    <phone>800-22-1984</phone>
    </authorizer>
    <destination>
    <first-name>John</first-name>
    <last-name>Doe</last-name>
    <company>John Doe Enterprises, Inc.</company>
    <department>Manufacturing</department>
    <phone>800-555-1234</phone>
    <address>
    <street-one>1654 Peachtree Str</street-one>
    <street-two>Suite Y</street-two>
    <city>Atlanta</city>
    <province>GA</province>
    <country>US</country>
    <postal-code>30326</postal-code>
    </address>
    </destination>
    my part of SAX parser code is:
    public void startElement (String name, AttributeList attrs)
    throws SAXException
    accumulator.setLength(0);
    public void characters (char buf [], int offset, int len)
    throws SAXException
    accumulator.append(buf, offset, len);
    public void endElement (String name)
    throws SAXException
    if (name.equals("first-name") )
    firstname=accumulator.toString().trim();
    if (name.equals("last-name"))
    lastname=accumulator.toString().trim();
    My problem is that i have to store the values of first-name and last-name.
    but i have that in both
    <authorizer> </authorizer> Tag and
    <destination> </destination>
    I need to retrive authorizer's firstname,lastname and
    destination's firstname and lastname.
    what i mean is i need to store authorizerFirstName,authorizerLastName
    destinationFirstname and destinationLastname.
    Pls let me know how to do that.
    Thanks in advance.
    Pooja.

    hi pooja,
    I think you are using DataHandler for parsing. Its deprecated. try using contentHandler . You can get the value of the element at the beginning. say for example
    <firstname>sdfs</firstname>
    the startElement will be firstname
    the next method that it invokes will be characters method which has the text associated with the element. I am sending a sample code for your problem. try using it .
    boolean m_boolinAuth = false;
    boolean m_boolinDest = false;
    boolean m_bAuthFName = false;
    boolean m_bAuthLName = false;
    public void startElement(String namespaceURI, String elementName, String qName, Attributes atts)
    //does the logic for startElement
    if(qName.equals("Authorization"))
    m_boolinAuth = true;
    m_boolinDest = false;
    else if(qName.equals("Destination"))
    m_boolinDest = true;
    m_boolinAuth = false;
    if(qName.equals("firstname"))
    m_bFirstName = true;
    if(qName.equals("lastname"))
    m_bLastName = true;
    public void characters(char[] ch, int start, int length)
    //does the logic for characters.
    String str = new String(ch,start,length);
    if(m_bFirstName)
    if(m_boolinAuth)
    m_strAuthFirstName =str;
    else if(m_boolinDest)
    m_strDestFirstName = str;
    m_bFirstName = false;
    if(m_bLastName)
    //same as first name case;
    }

  • SAX Parser and special character problem

    Hi,
    Could anyone help with the following problem?
    Background:
    1. Using a SAX Parser (Oracle Implementation) to read XML from a CLOB, convert this XML to another format to be inserted in the database.
    2. Due to performance issues we parse the input stream from the CLOB.
    3. For same reason, we are not using XSL.
    This is the problem we face:
    1. Values of some of the tags in the XML have special characters (Ex: &, <, >).
    2. While using the SAX Parser, the element handler function for the SAX Parser is called by the frame work with the value of these tags broken up with each of these characters being treated as a tag delimiter.
    Ex: <Description>SomeText_A & SomeText_B</Description>
    is treated as SomeText_A in first call to the handler; SomeText_B in the second call.
    The handler function does not get to see the "&" character.
    Thus, the final conversion is
    Say, <Description> is to be converted to <FreeText>
    we, get <FreeText>SomeText_A</FreeText>
    <FreeText>SomeText_B</FreeText>
    We tried using &; but it then breaks it up into SomeText_A, & and SomeText_B.
    How can we get the whole value for the <Description> tag in the characters() function in the SAXParser so that we can convert it to <FreeText>SomeText_A & SomeText_B</FreeText>.
    Thanks in advance..
    Chirdeep.

    We already tried that..looks like the line where I mentioned that it converted the entity referece characters to an ampersand..
    "We tried using <entity reference for &> but it then breaks it up into SomeText_A, & and SomeText_B."
    null

  • Problem with sax parser

    Hello..
    I have the following problem. When I parse an xml document with blank spaces and numbers with decimals, its sometimes comes out as one string and sometimes as two, for example "First A" sometimes comes out as "First" and "A" and sometimes as "First A", which is how its stored in the xml file. Same with numbers like 19.20. Im enclosing a little of my code..
    public void characters(char buf[], int offset, int len)
    throws SAXException
    if (textBuffer != null) {
    SaveString = ""+textBuffer;
    if(i>-1)
    numbers = SaveString;
    Whats wrong and how do I fix it.
    Best Regards Dan
    PS I have more code, in data and out data if needed.Ds

    Hello,
    I do not know if this is your problem, yet please find hereafter an excerpt of the SAX API:
    public void characters(char[] ch,
                           int start,
                           int length)
                    throws SAXException
    ... SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks;...
    ... Note that some parsers will report whitespace in element content using the ignorableWhitespace method rather than this one (validating parsers must do so)...
    In other words, I am afraid that your issue is the "standard behaviour" of a SAX parser.
    I hope it helps.

  • SAX parser problem in JDK1.5

    I have parse the xml file using SAX in jdk1.5 environment. During the parsing, it missed the some text content.
    for example
    <employeeid>
    <empid>1001</empid>
    <empid>1002</empid>
    </employeeid>
    If i have parse the above xml file using SAX in jdk1.5 environment. The output is
    1001
    100
    during the parsing , SAX parser misses digit of 2.
    if i have parse the above xml file using SAX in jdk1.4 environment , it is working fine.
    what is the problem in jdk1.5
    please help
    bala

    What I expect the problem to be was discussed recently in a topic titled "SAX Parser Problems" that was started on March 14 at 6:59 AM by JackoBS.
    Read that and see if it fixes your problem. If so, it is not a JDK1.5 problem, but a user error.
    Dave Patterson

  • Problem with view object for global variables

    Hi,
    I'm using jdeveloper 11.1.2.3.0
    We are using view object with transient attributes for global variables.
    we defined the view as explained here:
    http://docs.oracle.com/cd/E14571_01/web.1111/b31974/bcstatemgmt.htm#ADFFD19610
    also we defined one of the attributes as primary key.
    When we start to test our application with disable connection pooling we got some problems.
    sometimes the row in the global view object is deleted.
    (for example after using executeEmptyRowSet on other view object).
    it looks strange, we couldn't fוnd why does it happen.
    Any idea?

    As Timo said, it is very hard to help without source.
    Are you sure that you do the next step:
    After the call to super.prepareSession(), add code to create a new row in the transient view object and insert it into the view object.

Maybe you are looking for

  • How to get only error message which i want to display.

    hello, In my main system i am using power supply which is connected with different instruments like data logger ,GSM,GPS.... In my main vi all the subvi of power system ,gsm etc...are conected with each other. now I want to make some changes, for exa

  • Tracking Pad problem/other stuff

    Two days ago my 3 and 4 finger tracking pad commands stopped working. Restarting didn't help. Then after walking away while it was on and coming back a few hours later, the commands started working again. They worked for a little over 24 hours and no

  • Crash in mmFree () from /opt/bea/jrockit-R26.4.0-jre1.5.0

    Hi, Our telecom application is java based application using jrockit-R26.4.0-jre1.5.0_06. During tests, we've got the following crash. Unfortunatly no jrockit dump file was created (sorry about this). Did you already seen this crash? Thanks in advance

  • Adobe Air not allowing "restore window" in Win 7 64 bit???

    I have a very nice flex based program that I am currently marketing.  A client recently bought a laptop with Win 7 (64 bit) on it.  My prog loaded fine, as well as the latest version of Air. However, as the prog was running and the client minimized t

  • How to know a lumia device is original

    how can I distinguish if a lumia device is origial or refourbished?!!