Package org.cip4.jdflib.core
Class JDFDoc
java.lang.Object
org.cip4.jdflib.core.XMLDoc
org.cip4.jdflib.core.JDFDoc
- All Implemented Interfaces:
Cloneable,IStreamWriter
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionJDFDoc()constructorconstructor - create the kind of JDF you needJDFDoc(String strDocType, JDFElement.EnumVersion version) constructor - create the kind of JDF you needJDFDoc(DocumentJDFImpl document) constructorconstructor note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImplconstructor from a document note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImpl -
Method Summary
Modifier and TypeMethodDescriptionvoidclear the vector of all IDs of elements that are dirtyclone()cloneintcollectGarbageResources(VString nodeNames) Deprecated.use JDFNode.eraseUnlinkedResourcescreateElement(String elementName) createElement create a JDFElement that floats in nirvana.static JDFDocDeprecated.simply use constructorprotected JDFDoccreateRoot(Document document) gets the content typestatic Stringgets the contentType for a given root elementget/create the associated XMLDocUserData - it is always there!get a vector of all IDs of elements that are dirtyprotected DocumentXMLImplgetImpl()booleanif true (the default) initialize element when they are created, else don't call init() when an element is initially createdgetJDFNodeByID(String id) Deprecated.use getRoot().getTarget(id, AttributeName.ID) and cast.GetJDFRoot - get the jdf rootGetJMFRoot - get the jmf rootgetMemberDocumentprotected XMLDocUserDataMethod getXMLDocUserData - get the associated XMLDocUserDataprotected XMLParserget the correct parser for this type of documentprotected booleandoes the owner document of this have an associated XMLDocUserDatabooleanis the node with ID dirty?static JDFDocparse a JDF filestatic JDFDocparse a JDF filestatic JDFDocparse a JDF input streamstatic JDFDocparseString(String string) parse a JDF stringstatic JDFDocparse a given urlprotected voidpushParser(XMLParser xmlParser) static voidregisterCustomClass(String strElement, String packagepath) register new custom class in the factoryprotected voidvoidsetInitOnCreate(boolean bInitOnCreate) if true (the default) initialize element when they are created, else don't call init() when an element is initially createdprotected voidsetMemberDoc(DocumentXMLImpl myDoc) initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType)voidsetXPathValues(JDFAttributeMap valueMap) set the xpath values of thei to the values in the nodetoString()toStringwrite2HttpURL(URL strURL, HTTPDetails det) write2HTTPURL(URL strURL, HTTPDetails det) This method sends the contents of this JDFDoc to the URLstrURLand receives the response in the returned JDFDoc.write2URL(String strURL, HTTPDetails details) This method sends the contents of this JDFDoc to the URLstrURLand receives the response in the returned JDFDoc.Methods inherited from class org.cip4.jdflib.core.XMLDoc
appendChild, cloneNode, copyMeta, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElementDefinition, createElementNS, createEntity, createEntityReference, createEvent, createNodeIterator, createNodeIterator, createNotation, createProcessingInstruction, createRange, createTextNode, createTreeWalker, createTreeWalker, equals, flush, getAttributes, getBodyPart, getChildNode, getChildNodes, getDocMemoryUsed, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getErrorChecking, getFirstChild, getIdentifier, getIdentifiers, getImplementation, getIndent, getLastChild, getLineWidth, getLocalName, getMultiPart, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getNSMap, getOriginalFileName, getParentNode, getPrefix, getPreviousSibling, getProcessingInstruction, getRoot, getRootName, getSchemaLocation, getSchemaLocationFile, getValidationResult, getXMLComment, getXSLTURL, getZipReader, hasAttributes, hasChildNodes, hashCode, importNode, insertBefore, isDirty, isNull, isSchemaValid, isSupported, normalize, parseZipFile, putIdentifier, removeChild, removeIdentifier, replaceChild, setBodyPart, setErrorChecking, setIndent, setLineWidth, setNodeValue, setNSMap, setOriginalFileName, setPrefix, setSchemaLocation, setValidationResult, setXSLTURL, setZipReader, toXML, write2File, write2File, write2File, write2File, write2File, write2HttpURL, write2HTTPURL, write2Stream, write2Stream, write2StreamStatic, write2StreamStatic, write2String, write2URL, write2URL, write2Zip, writeStream
-
Constructor Details
-
JDFDoc
public JDFDoc()constructor -
JDFDoc
constructor from a document note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImpl- Parameters:
document-
-
JDFDoc
constructor note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImpl- Parameters:
document-
-
JDFDoc
constructor- Parameters:
document-
-
JDFDoc
constructor - create the kind of JDF you need- Parameters:
strDocType- - ElementName.JDF, ElementName.JMF, "Config" ...
-
JDFDoc
constructor - create the kind of JDF you need- Parameters:
strDocType- - ElementName.JDF, ElementName.JMF, "Config" ...version-
-
-
Method Details
-
reparse
-
createRoot
- Overrides:
createRootin classXMLDoc
-
getImpl
-
getJDFRoot
GetJDFRoot - get the jdf root- Returns:
- JDFNode - the root of the JDF file
-
setMemberDoc
- Overrides:
setMemberDocin classXMLDoc
-
getJMFRoot
GetJMFRoot - get the jmf root- Returns:
- JDFJMF - the root of the JMF file
-
clone
clone -
toString
toString -
createJDF
Deprecated.simply use constructorCreateJDF- Parameters:
jdfPath-- Returns:
- JDFDoc
-
getJDFNodeByID
Deprecated.use getRoot().getTarget(id, AttributeName.ID) and cast.returns a JDFNode by its id attribute- Parameters:
id- the ID parameter of the JDF node- Returns:
- JDFNode - the corresponding JDF Node, null if no such node exists
-
collectGarbageResources
Deprecated.use JDFNode.eraseUnlinkedResourcesremoves all dangling resources and cleans up the rrefs attributes- Parameters:
nodeNames- the list of nodenames to remove, remove all if nodenames is empty- Returns:
- the number of collected resources
-
getContentType
gets the content type- Returns:
- the content type, Text/XML if neither jdf nor jmf
-
parseStream
parse a JDF input stream- Parameters:
is-- Returns:
- the parsed JDFDoc
-
parseFile
parse a JDF file- Parameters:
file-- Returns:
- the parsed JDFDoc
-
parseString
parse a JDF string- Parameters:
file-- Returns:
- the parsed JDFDoc
-
parseFile
parse a JDF file- Parameters:
fileName-- Returns:
- the parsed JDFDoc
-
parseURL
parse a given url- Parameters:
url- the url to searchbp- the bodypart that the CID url is located in- Returns:
- the parsed JDFDoc
-
setRoot
initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType) -
registerCustomClass
register new custom class in the factory- Parameters:
strElement- fully qualified namepackagepath- package path
-
write2URL
This method sends the contents of this JDFDoc to the URLstrURLand receives the response in the returned JDFDoc. the content type is automagically set to either text/xml for undefined xml or to application/vnd.cip4-jdf+xml or application/vnd.cip4-jmf+xml- Parameters:
strURL- the URL to write to- Returns:
- docResponse the response received from URL. A Null document if no response was received, or an exception occurred
-
write2URL
This method sends the contents of this JDFDoc to the URLstrURLand receives the response in the returned JDFDoc. the content type is automagically set to either text/xml for undefined xml or to application/vnd.cip4-jdf+xml or application/vnd.cip4-jmf+xml- Parameters:
strURL- the URL to write to- Returns:
- docResponse the response received from URL. A Null document if no response was received, or an exception occurred
-
getXMLParser
get the correct parser for this type of document- Overrides:
getXMLParserin classXMLDoc- Returns:
-
pushParser
- Overrides:
pushParserin classXMLDoc- Parameters:
xmlParser-
-
write2HTTPURL
- Parameters:
strURL-det-- Returns:
-
write2HttpURL
- Parameters:
strURL-det-- Returns:
-
getContentType
gets the contentType for a given root element- Parameters:
e-- Returns:
-
createElement
Description copied from class:XMLDoccreateElement create a JDFElement that floats in nirvana. This must be appended to a node with appendChild (created in namespace JDFCoreConstants.NONAMESPACE (DOM Level 2)).
Another way would be to use KElement.appendElement(String elementName, String nameSpaceURI)- Overrides:
createElementin classXMLDoc- Parameters:
elementName- name of the element that is created- Returns:
- Element - unconnected element that is created
-
getXMLDocUserData
Method getXMLDocUserData - get the associated XMLDocUserData- Returns:
- XMLDocUserData of this object
-
hasXMLDocUserData
protected boolean hasXMLDocUserData()does the owner document of this have an associated XMLDocUserData- Returns:
- true if XMLDocUserData of this exists
-
getCreateXMLDocUserData
get/create the associated XMLDocUserData - it is always there!- Returns:
- the XMLDocUserData of this
-
getDirtyIDs
get a vector of all IDs of elements that are dirty- Returns:
- VString - the vector of element IDs
-
clearDirtyIDs
public void clearDirtyIDs()clear the vector of all IDs of elements that are dirty -
isDirty
is the node with ID dirty?- Parameters:
strID- id the id to be checked- Returns:
- boolean - true if the node with ID=id is dirty
-
setInitOnCreate
public void setInitOnCreate(boolean bInitOnCreate) if true (the default) initialize element when they are created, else don't call init() when an element is initially created- Parameters:
bInitOnCreate-
-
getInitOnCreate
public boolean getInitOnCreate()if true (the default) initialize element when they are created, else don't call init() when an element is initially created- Returns:
- bInitOnCreate
-
getMemberDocument
getMemberDocument- Overrides:
getMemberDocumentin classXMLDoc- Returns:
- the MemberDocument
-
setXPathValues
Description copied from class:XMLDocset the xpath values of thei to the values in the node- Overrides:
setXPathValuesin classXMLDoc- Parameters:
valueMap- the map of values, if this is still null, MUST be fully qualified- See Also:
-