Package org.cip4.jdflib.validate
Class JDFValidator
java.lang.Object
org.cip4.jdflib.validate.JDFValidator
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?-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classThis is just a quick and dirty class to centrally switch print on and off -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanprotected booleanbooleanDeprecated.booleanDeprecated.booleanbooleanif true, warn on URL attributes that point to Nirvanaprotected booleanprotected XMLDocprotected JDFValidator.MySysOutprotected Stringprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidfillDoc(InputStream inStream, String xmlFile, jakarta.mail.BodyPart bp) protected StringgetInvalidText(JDFElement jdfElement) protected KElementgetTestElement(KElement kElement, KElement xmlParent) protected voidhandleNull(String xmlFile, KElement testFileRoot) booleanbooleanprocess a single document as specified by doc if doc==null, reprocess the currently stored documentprotected JDFElementprintBadJDF(KElement kElement, int indent, KElement xmlParent, boolean bIsNodeRoot, String id, String elmName, KElement testElement, boolean bIsValid) protected booleanprintBadTarget(JDFResourceLink rl, int indent, KElement testElement, String rRef, String resLinkName, String procUsage, String errMessage, JDFResource res) protected voidprintBaseBadResLink(JDFResourceLink rl, KElement testElement, String rRef) protected booleanprintDanglingRefElement(JDFRefElement re, int indent, KElement testElement, String rRef, String refName, String errMessage) protected booleanprintDanglingResLink(JDFResourceLink rl, int indent, KElement testElement, String rRef, String resLinkName, String procUsage, String errMessage) protected voidprintInvalidLinkInNode(JDFResourceLink rl, KElement testElement, JDFNode n) protected booleanprintInvalidRefElem(JDFRefElement re, int indent, KElement testElement, String rRef, String refName, String errMessage, KElement targEl) protected voidprintNonNamespace(KElement kElement, int indent, KElement reportParent, String pref, String elmName, String nsURI, KElement testElement, boolean isJDFNS, boolean bTypo) protected voidprintRealDevCap(KElement testElement, JDFNode jdfNode, JDFJMF jmfRoot) protected voidprintSemiValidReslink(JDFResourceLink rl, KElement testElement, JDFResource res) protected booleanprintSingleRefElem(JDFRefElement re, int indent, KElement testElement, boolean isValid, String rRef, String refName, String errMessage) processes all files that have been placed into the public VString member JDFValidator.allFilesprocessMimeStream(InputStream inStream) process a mime fileprotected voidprocessSingleDoc(String url, String xmlFile, KElement testFileRoot) process a single document as specified by doc if doc==null, reprocess the currently stored documentprocessSingleFile(InputStream inStream, String url, String xmlFile) Deprecated.- use either processSingleDoc, processSingleStream or processSinglFile(String) this will be made privateprotected XMLDocprocessSingleFile(InputStream inStream, String url, String xmlFile, jakarta.mail.BodyPart bp) processes a single fileprocessSingleFile(String fileName) process a single file document as specified by fileNameprotected voidprocessSingleJDF(String url, String xmlFile, KElement testFileRoot, KElement checkJDFxmlRoot, JDFNode root) processSingleStream(InputStream stream, String fileName, jakarta.mail.BodyPart bp) process a single document as specified by docprocessSingleURLStream(InputStream stream, String url) process a single document as specified by docprocessZipFile(File argFile) we may want to create something similar for a zip streamprotected voidreset()protected voidsetAllFiles(MyArgs args) voidset the JDFDoc (JDF or JMF) to setvoidsetIgnorePrivate(boolean bIgnore) if bIvoidsetJDFSchemaLocation(File _schemaLocation) voidsetJDFSchemaLocation(String _schemaLocation) this can be either a file or a network urlvoidsetPrint(boolean b) sets the System.out print on or offvoidsetValidatorFactory(ICheckValidatorFactory pvalidatorFactory) voidsetWarning(boolean warning) static StringtoMessageString(KElement checkOut)
-
Field Details
-
vBadID
-
vMultiID
-
pOut
-
translation
-
bTiming
Deprecated. -
bWarning
protected boolean bWarning -
bQuiet
Deprecated. -
bPrintNameSpace
protected boolean bPrintNameSpace -
bValidate
public boolean bValidate -
bWarnDanglingURL
public boolean bWarnDanglingURLif true, warn on URL attributes that point to Nirvana -
level
-
allFiles
-
proxyHost
-
proxyPort
-
schemaLocation
-
xmlOutputName
-
xslStyleSheet
-
devCapFile
-
testlists
-
bMultiID
public boolean bMultiID -
version
-
sysOut
-
-
Constructor Details
-
JDFValidator
public JDFValidator()
-
-
Method Details
-
toMessageString
- Parameters:
checkOut-- Returns:
-
setDoc
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
-
printNonNamespace
-
getTestElement
-
getInvalidText
-
printSingleRefElem
protected boolean printSingleRefElem(JDFRefElement re, int indent, KElement testElement, boolean isValid, String rRef, String refName, String errMessage) -
printInvalidRefElem
-
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
-
printInvalidLinkInNode
-
printDanglingResLink
-
printBaseBadResLink
-
printRealDevCap
-
setJDFSchemaLocation
this can be either a file or a network url- Parameters:
_schemaLocation-
-
setJDFSchemaLocation
- Parameters:
_schemaLocation- the schema location
-
processAllFiles
processes all files that have been placed into the public VString member JDFValidator.allFiles- Returns:
- XMLDoc the xml output document
-
processZipFile
we may want to create something similar for a zip stream- Parameters:
argFile-- Returns:
- XMLDoc the output file
-
processMimeStream
process a mime file- Parameters:
argFile-- Returns:
-
processSingleDocument
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
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
process a single document as specified by doc- Parameters:
stream- the input streamurl- the url that the stream is sent to- Returns:
- the xml output of the validation
-
processSingleStream
process a single document as specified by doc- Parameters:
stream- the input streamfileName- the fileName that the stream originated frombp-- Returns:
- the xml output of the validation
-
processSingleFile
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.- use either processSingleDoc, processSingleStream or processSinglFile(String) this will be made privateprocesses 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
-
processSingleJDF
-
handleNull
-
fillDoc
-
reset
protected void reset() -
setAllFiles
-
addFile
-
isBWarning
public boolean isBWarning()- Returns:
- the bWarning
-
setWarning
public void setWarning(boolean warning) - Parameters:
warning- the bWarning to set
-
setValidatorFactory
- Parameters:
validatorFactory- the validatorFactory to set
-