Class JDFValidator


  • public class JDFValidator
    extends java.lang.Object
    this is the non-commandline part of the original checkJDF and used both by the JDF Editor and checkJDF Refactored JDFValidator to be non-static in order to make it thread compatible. Previously, only one thread at a time could call JDFValidator from within the same JVM. Now an instance of JDFValidator and the the method validate should be called. JDFValidator can still be called from the command line in the same way as before. TODO Break out validation error handling logging so that new error handlers can easily be registered. For example, there should be an error handler for logging to the XML log file and an error handler for logging to the sysOut. Perhaps org.xml.sax.ErrorHandler could be used?
    • Field Detail

      • vMultiID

        public VString vMultiID
      • translation

        protected java.lang.String translation
      • bTiming

        public boolean bTiming
      • bWarning

        protected boolean bWarning
      • bQuiet

        public boolean bQuiet
      • bPrintNameSpace

        protected boolean bPrintNameSpace
      • bValidate

        public boolean bValidate
      • bWarnDanglingURL

        public boolean bWarnDanglingURL
        if true, warn on URL attributes that point to Nirvana
      • allFiles

        public VString allFiles
      • proxyHost

        public java.lang.String proxyHost
      • proxyPort

        public java.lang.String proxyPort
      • schemaLocation

        public java.lang.String schemaLocation
      • xmlOutputName

        public java.lang.String xmlOutputName
      • xslStyleSheet

        public java.lang.String xslStyleSheet
      • devCapFile

        public java.lang.String devCapFile
      • bMultiID

        public boolean bMultiID
      • version

        protected static final java.lang.String version
    • Constructor Detail

      • JDFValidator

        public JDFValidator()
    • Method Detail

      • toMessageString

        public static java.lang.String toMessageString​(KElement checkOut)
        Parameters:
        checkOut -
        Returns:
      • setDoc

        public void setDoc​(JDFDoc d)
        set the JDFDoc (JDF or JMF) to set
        Parameters:
        d - the JDFDoc to set this to
      • setIgnorePrivate

        public void setIgnorePrivate​(boolean bIgnore)
        if bI
        Parameters:
        bIgnore -
      • setPrint

        public void setPrint​(boolean b)
        sets the System.out print on or off
        Parameters:
        b -
      • printBadJDF

        protected JDFElement printBadJDF​(KElement kElement,
                                         int indent,
                                         KElement xmlParent,
                                         boolean bIsNodeRoot,
                                         java.lang.String id,
                                         java.lang.String elmName,
                                         KElement testElement,
                                         boolean bIsValid)
      • printNonNamespace

        protected void printNonNamespace​(KElement kElement,
                                         int indent,
                                         KElement xmlParent,
                                         java.lang.String pref,
                                         java.lang.String elmName,
                                         java.lang.String nsURI,
                                         KElement testElement,
                                         boolean isJDFNS,
                                         boolean bTypo)
      • getInvalidText

        protected java.lang.String getInvalidText​(JDFElement jdfElement)
      • setJDFSchemaLocation

        public void setJDFSchemaLocation​(java.lang.String _schemaLocation)
        this can be either a file or a network url
        Parameters:
        _schemaLocation -
      • setJDFSchemaLocation

        public void setJDFSchemaLocation​(java.io.File _schemaLocation)
        Parameters:
        _schemaLocation - the schema location
      • processAllFiles

        public XMLDoc processAllFiles()
        processes all files that have been placed into the public VString member JDFValidator.allFiles
        Returns:
        XMLDoc the xml output document
      • processZipFile

        public XMLDoc processZipFile​(java.io.File argFile)
        we may want to create something similar for a zip stream
        Parameters:
        argFile -
        Returns:
        XMLDoc the output file
      • processMimeStream

        public XMLDoc processMimeStream​(java.io.InputStream inStream)
        process a mime file
        Parameters:
        argFile -
        Returns:
      • processSingleDocument

        public XMLDoc processSingleDocument​(JDFDoc doc)
        process a single document as specified by doc if doc==null, reprocess the currently stored document
        Parameters:
        doc - the parsed document to process
        Returns:
        the xml output of the validation
      • isValid

        public boolean isValid​(JDFDoc doc)
        process a single document as specified by doc if doc==null, reprocess the currently stored document
        Parameters:
        doc - the parsed document to process
        Returns:
        the xml output of the validation
      • processSingleURLStream

        public XMLDoc processSingleURLStream​(java.io.InputStream stream,
                                             java.lang.String url)
        process a single document as specified by doc
        Parameters:
        stream - the input stream
        url - the url that the stream is sent to
        Returns:
        the xml output of the validation
      • processSingleStream

        public XMLDoc processSingleStream​(java.io.InputStream stream,
                                          java.lang.String fileName,
                                          javax.mail.BodyPart bp)
        process a single document as specified by doc
        Parameters:
        stream - the input stream
        fileName - the fileName that the stream originated from
        bp -
        Returns:
        the xml output of the validation
      • processSingleFile

        public XMLDoc processSingleFile​(java.lang.String fileName)
        process a single file document as specified by fileName
        Parameters:
        fileName - the path of the file to parse and validate
        Returns:
        the xml output of the validation
      • processSingleFile

        @Deprecated
        public XMLDoc processSingleFile​(java.io.InputStream inStream,
                                        java.lang.String url,
                                        java.lang.String xmlFile)
        Deprecated.
        - use either processSingleDoc, processSingleStream or processSinglFile(String) this will be made private
        processes a single file
        Parameters:
        inStream -
        url -
        xmlFile -
        Returns:
      • processSingleFile

        protected XMLDoc processSingleFile​(java.io.InputStream inStream,
                                           java.lang.String url,
                                           java.lang.String xmlFile,
                                           javax.mail.BodyPart bp)
        processes a single file
        Parameters:
        inStream -
        url -
        xmlFile -
        Returns:
      • setAllFiles

        protected void setAllFiles​(MyArgs args)
      • addFile

        public void addFile​(java.lang.String xmlFile)
      • isBWarning

        public boolean isBWarning()
        Returns:
        the bWarning
      • setWarning

        public void setWarning​(boolean warning)
        Parameters:
        warning - the bWarning to set
      • setValidatorFactory

        public void setValidatorFactory​(ICheckValidatorFactory pvalidatorFactory)
        Parameters:
        validatorFactory - the validatorFactory to set