Package org.sbml.jsbml.xml.stax

Examples of org.sbml.jsbml.xml.stax.DateProcessor


      // A DatesParser can only modify a contextObject which is a
      // ModelHistory instance.
      if (contextObject instanceof History) {
        History modelHistory = (History) contextObject;
        DateProcessor dateProcessor = new DateProcessor();

        // The date to parse is the text of a 'W3CDTF' element.
        // However, the date will be parsed only if the syntax of this
        // node and the previous
        // node respects the SBML specifications.
        if (elementName.equals("W3CDTF") && hasReadW3CDTF) {

          // If the previous node was a 'created' element and
          // respected the SBML specifications,
          // a new Date will be created and set to the text value of
          // this node.
          // Sets the created Date of modelHistory.
          if (hasReadCreated && previousElement.equals("created")) {
            String stringDate = dateProcessor.formatToW3CDTF(characters);
           
            try {
              Date createdDate = DateParser.parse(stringDate);
              modelHistory.setCreatedDate(createdDate);

              logger.debug("processCharactersOf: getIsoDateNoMillis " + DateParser.getIsoDateNoMillis(createdDate));
             
            } catch (InvalidDateException e) {
              logger.warn("Cannot read the following date properly: " + stringDate);
              if (logger.isDebugEnabled()) {
                e.printStackTrace();
              }
            }
           
          }
          // If the previous node was a 'modified' element and
          // respected the SBML specifications,
          // a new Date will be created and set to the text value of
          // this node.
          // Sets the modified Date and adds the new Date to the
          // listOfModifications of modelHistory.
          else if (previousElement.equals("modified")) {
            String stringDate = dateProcessor.formatToW3CDTF(characters);

            try {
              Date modifiedDate = DateParser.parse(stringDate);
              modelHistory.setModifiedDate(modifiedDate);
            } catch (InvalidDateException e) {
View Full Code Here


      // A DatesParser can only modify a contextObject which is a
      // ModelHistory instance.
      if (contextObject instanceof History) {
        History modelHistory = (History) contextObject;
        DateProcessor dateProcessor = new DateProcessor();

        // The date to parse is the text of a 'W3CDTF' element.
        // However, the date will be parsed only if the syntax of this
        // node and the previous
        // node respects the SBML specifications.
        if (elementName.equals("W3CDTF") && hasReadW3CDTF) {

          // If the previous node was a 'created' element and
          // respected the SBML specifications,
          // a new Date will be created and set to the text value of
          // this node.
          // Sets the created Date of modelHistory.
          if (hasReadCreated && previousElement.equals("created")) {
            String stringDate = dateProcessor.formatToW3CDTF(characters);
           
            try {
              Date createdDate = DateParser.parse(stringDate);
              modelHistory.setCreatedDate(createdDate);

              logger.debug("processCharactersOf : getIsoDateNoMillis " + DateParser.getIsoDateNoMillis(createdDate));
             
            } catch (InvalidDateException e) {
              logger.warn("Cannot read the following date properly :" + stringDate);
              if (logger.isDebugEnabled()) {
                e.printStackTrace();
              }
            }
           
          }
          // If the previous node was a 'modified' element and
          // respected the SBML specifications,
          // a new Date will be created and set to the text value of
          // this node.
          // Sets the modified Date and adds the new Date to the
          // listOfModifications of modelHistory.
          else if (previousElement.equals("modified")) {
            String stringDate = dateProcessor.formatToW3CDTF(characters);

            try {
              Date modifiedDate = DateParser.parse(stringDate);
              modelHistory.setModifiedDate(modifiedDate);
            } catch (InvalidDateException e) {
View Full Code Here

      // A DatesParser can only modify a contextObject which is a
      // ModelHistory instance.
      if (contextObject instanceof History) {
        History modelHistory = (History) contextObject;
        DateProcessor dateProcessor = new DateProcessor();

        // The date to parse is the text of a 'W3CDTF' element.
        // However, the date will be parsed only if the syntax of this
        // node and the previous
        // node respects the SBML specifications.
        if (elementName.equals("W3CDTF") && hasReadW3CDTF) {

          // If the previous node was a 'created' element and
          // respected the SBML specifications,
          // a new Date will be created and set to the text value of
          // this node.
          // Sets the created Date of modelHistory.
          if (hasReadCreated && previousElement.equals("created")) {
            String stringDate = dateProcessor.formatToW3CDTF(characters);
           
            try {
              Date createdDate = DateParser.parse(stringDate);
              modelHistory.setCreatedDate(createdDate);

              logger.debug("processCharactersOf : getIsoDateNoMillis " + DateParser.getIsoDateNoMillis(createdDate));
             
            } catch (InvalidDateException e) {
              logger.warn("Cannot read the following date properly :" + stringDate);
              if (logger.isDebugEnabled()) {
                e.printStackTrace();
              }
            }
           
          }
          // If the previous node was a 'modified' element and
          // respected the SBML specifications,
          // a new Date will be created and set to the text value of
          // this node.
          // Sets the modified Date and adds the new Date to the
          // listOfModifications of modelHistory.
          else if (previousElement.equals("modified")) {
            String stringDate = dateProcessor.formatToW3CDTF(characters);

            try {
              Date modifiedDate = DateParser.parse(stringDate);
              modelHistory.setModifiedDate(modifiedDate);
            } catch (InvalidDateException e) {
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.xml.stax.DateProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.