Class JDFValidator

java.lang.Object
org.cip4.jdflib.validate.JDFValidator

public class JDFValidator extends 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 Details

    • vBadID

      public VString vBadID
    • vMultiID

      public VString vMultiID
    • pOut

      protected XMLDoc pOut
    • translation

      protected String translation
    • bTiming

      @Deprecated public boolean bTiming
      Deprecated.
    • bWarning

      protected boolean bWarning
    • bQuiet

      @Deprecated public boolean bQuiet
      Deprecated.
    • bPrintNameSpace

      protected boolean bPrintNameSpace
    • bValidate

      public boolean bValidate
    • bWarnDanglingURL

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

    • allFiles

      public VString allFiles
    • proxyHost

      public String proxyHost
    • proxyPort

      public String proxyPort
    • schemaLocation

      public String schemaLocation
    • xmlOutputName

      public String xmlOutputName
    • xslStyleSheet

      public String xslStyleSheet
    • devCapFile

      public String devCapFile
    • testlists

    • bMultiID

      public boolean bMultiID
    • version

      protected static final String version
    • sysOut

      protected JDFValidator.MySysOut sysOut
  • Constructor Details

    • JDFValidator

      public JDFValidator()
  • Method Details

    • toMessageString

      public static 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, String id, String elmName, KElement testElement, boolean bIsValid)
    • printNonNamespace

      protected void printNonNamespace(KElement kElement, int indent, KElement reportParent, String pref, String elmName, String nsURI, KElement testElement, boolean isJDFNS, boolean bTypo)
    • getTestElement

      protected KElement getTestElement(KElement kElement, KElement xmlParent)
    • getInvalidText

      protected String getInvalidText(JDFElement jdfElement)
    • printSingleRefElem

      protected boolean printSingleRefElem(JDFRefElement re, int indent, KElement testElement, boolean isValid, String rRef, String refName, String errMessage)
    • printInvalidRefElem

      protected boolean printInvalidRefElem(JDFRefElement re, int indent, KElement testElement, String rRef, String refName, String errMessage, KElement targEl)
    • printDanglingRefElement

      protected boolean printDanglingRefElement(JDFRefElement re, int indent, KElement testElement, String rRef, String refName, String errMessage)
    • printBadTarget

      protected boolean printBadTarget(JDFResourceLink rl, int indent, KElement testElement, String rRef, String resLinkName, String procUsage, String errMessage, JDFResource res)
    • printSemiValidReslink

      protected void printSemiValidReslink(JDFResourceLink rl, KElement testElement, JDFResource res)
    • printInvalidLinkInNode

      protected void printInvalidLinkInNode(JDFResourceLink rl, KElement testElement, JDFNode n)
    • printDanglingResLink

      protected boolean printDanglingResLink(JDFResourceLink rl, int indent, KElement testElement, String rRef, String resLinkName, String procUsage, String errMessage)
    • printBaseBadResLink

      protected void printBaseBadResLink(JDFResourceLink rl, KElement testElement, String rRef)
    • printRealDevCap

      protected void printRealDevCap(KElement testElement, JDFNode jdfNode, JDFJMF jmfRoot)
    • setJDFSchemaLocation

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

      public void setJDFSchemaLocation(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(File argFile)
      we may want to create something similar for a zip stream
      Parameters:
      argFile -
      Returns:
      XMLDoc the output file
    • processMimeStream

      public XMLDoc processMimeStream(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(InputStream stream, 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(InputStream stream, String fileName, jakarta.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(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(InputStream inStream, String url, 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(InputStream inStream, String url, String xmlFile, jakarta.mail.BodyPart bp)
      processes a single file
      Parameters:
      inStream -
      url -
      xmlFile -
      Returns:
    • processSingleDoc

      protected void processSingleDoc(String url, String xmlFile, KElement testFileRoot)
    • processSingleJDF

      protected void processSingleJDF(String url, String xmlFile, KElement testFileRoot, KElement checkJDFxmlRoot, JDFNode root)
    • handleNull

      protected void handleNull(String xmlFile, KElement testFileRoot)
    • fillDoc

      protected void fillDoc(InputStream inStream, String xmlFile, jakarta.mail.BodyPart bp)
    • reset

      protected void reset()
    • setAllFiles

      protected void setAllFiles(MyArgs args)
    • addFile

      public void addFile(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