Package org.cip4.lib.xprinttalk.xml
Class PrintTalkNavigator
- java.lang.Object
-
- org.cip4.lib.xjdf.xml.internal.XmlNavigator
-
- org.cip4.lib.xprinttalk.xml.PrintTalkNavigator
-
public class PrintTalkNavigator extends org.cip4.lib.xjdf.xml.internal.XmlNavigatorNavigator class which simplify XPath handling using PrintTalk Documents.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBUSINESS_IDXPath to attribute 'BusinessID' of PurchaseOrder Node in PrintTalk Document.static java.lang.StringCURRENCYXPath to attribute 'Currency' of PurchaseOrder Node in PrintTalk Document.static java.lang.StringTIMESTAMPXPath to attribute 'TimeStamp' in PrintTalk Document.static java.lang.StringXJDFXPath to embedded XJDF Document in PrintTalk Document.
-
Constructor Summary
Constructors Constructor Description PrintTalkNavigator(byte[] xPrintTalkBytes)Custom constructor.PrintTalkNavigator(byte[] xPrintTalkBytes, boolean namespaceAware)Custom constructor.PrintTalkNavigator(java.io.File ptkFile)Custom constructor.PrintTalkNavigator(java.io.File ptkFile, boolean namespaceAware)Custom constructor.PrintTalkNavigator(java.io.InputStream xPrintTalkStream)Custom constructor.PrintTalkNavigator(java.io.InputStream xPrintTalkStream, boolean namespaceAware)Custom constructor.PrintTalkNavigator(java.lang.String ptkPath)Custom constructor.PrintTalkNavigator(java.lang.String ptkPath, boolean namespaceAware)Custom constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectextractNode(java.lang.String xPath)Evaluates an XPath expression on PrintTalk Document and returns a parsed Node object as result.byte[]getPtkBytes()Returns the PrintTalk Document as Byte Array.java.io.InputStreamgetPtkStream()Returns the PrintTalk Document as Stream.java.lang.StringreadXJdfAttribute(java.lang.String xPathXJdf)Read attribute from embedded XJdf Document in PrintTalk.voidreplaceNode(java.lang.String xPath, java.lang.Object replacement)Replace a node in PrintTalk Document located by the XPath expression.-
Methods inherited from class org.cip4.lib.xjdf.xml.internal.XmlNavigator
addNamespace, evaluate, evaluateBoolean, evaluateDouble, evaluateInt, evaluateLong, evaluateNode, evaluateNodeList, evaluateString, extractNode, getXmlBytes, getXmlDocument, getXmlStream, readAttribute, readAttribute, removeNode, replaceNode, updateAttribute, updateAttribute
-
-
-
-
Field Detail
-
TIMESTAMP
public static final java.lang.String TIMESTAMP
XPath to attribute 'TimeStamp' in PrintTalk Document.- See Also:
- Constant Field Values
-
BUSINESS_ID
public static final java.lang.String BUSINESS_ID
XPath to attribute 'BusinessID' of PurchaseOrder Node in PrintTalk Document.- See Also:
- Constant Field Values
-
CURRENCY
public static final java.lang.String CURRENCY
XPath to attribute 'Currency' of PurchaseOrder Node in PrintTalk Document.- See Also:
- Constant Field Values
-
XJDF
public static final java.lang.String XJDF
XPath to embedded XJDF Document in PrintTalk Document.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PrintTalkNavigator
public PrintTalkNavigator(java.io.InputStream xPrintTalkStream) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOExceptionCustom constructor. Accepting a PrintTalk as Input Stream for initializing.- Parameters:
xPrintTalkStream- The PrintTalk Document as Input Stream.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(java.io.InputStream xPrintTalkStream, boolean namespaceAware) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationExceptionCustom constructor. Accepting a PrintTalk as Input Stream for initializing.- Parameters:
xPrintTalkStream- The PrintTalk Document as Input Stream.namespaceAware- True if navigator should be XML Namespace aware.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(byte[] xPrintTalkBytes) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOExceptionCustom constructor. Accepting a PrintTalk as byte array for initializing.- Parameters:
xPrintTalkBytes- The PrintTalk Document as Byte Array.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(byte[] xPrintTalkBytes, boolean namespaceAware) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOExceptionCustom constructor. Accepting a PrintTalk as byte array for initializing.- Parameters:
xPrintTalkBytes- The PrintTalk Document as Byte Array.namespaceAware- True if navigator should be XML Namespace aware.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(java.lang.String ptkPath) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationExceptionCustom constructor. Accepting a path for initializing.- Parameters:
ptkPath- The path to the PrintTalk Document.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(java.lang.String ptkPath, boolean namespaceAware) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXExceptionCustom constructor. Accepting a path for initializing.- Parameters:
ptkPath- The path to the PrintTalk Document.namespaceAware- True if navigator should be XML Namespace aware.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(java.io.File ptkFile) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationExceptionCustom constructor. Accepting a file for initializing.- Parameters:
ptkFile- The file of the PrintTalk Document.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
PrintTalkNavigator
public PrintTalkNavigator(java.io.File ptkFile, boolean namespaceAware) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXExceptionCustom constructor. Accepting a file for initializing.- Parameters:
ptkFile- The file of the PrintTalk Document.namespaceAware- True if navigator should be XML Namespace aware.- Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.org.xml.sax.SAXException- - If any parse errors occur.java.io.IOException- - If any IO errors occur.
-
-
Method Detail
-
getPtkBytes
public byte[] getPtkBytes() throws javax.xml.transform.TransformerException, java.io.IOExceptionReturns the PrintTalk Document as Byte Array.- Returns:
- PrintTalk Document as Byte Array.
- Throws:
javax.xml.transform.TransformerException- If this document could not be transformed.java.io.IOException- - If any IO errors occur.
-
getPtkStream
public java.io.InputStream getPtkStream() throws javax.xml.transform.TransformerException, java.io.IOExceptionReturns the PrintTalk Document as Stream.- Returns:
- PrintTalk Document as Stream.
- Throws:
javax.xml.transform.TransformerException- If this document could not be transformed.java.io.IOException- - If any IO errors occur.
-
readXJdfAttribute
public java.lang.String readXJdfAttribute(java.lang.String xPathXJdf) throws javax.xml.xpath.XPathExpressionExceptionRead attribute from embedded XJdf Document in PrintTalk.- Parameters:
xPathXJdf- XPath expression of XJDF attribute needed.- Returns:
- Value of attribute as String.
- Throws:
javax.xml.xpath.XPathExpressionException- Is being thrown in case an exception occurs.
-
extractNode
public java.lang.Object extractNode(java.lang.String xPath) throws javax.xml.xpath.XPathExpressionException, javax.xml.bind.JAXBExceptionEvaluates an XPath expression on PrintTalk Document and returns a parsed Node object as result.- Parameters:
xPath- XPath expression to execute to.- Returns:
- The parsed PrintTalk Node object.
- Throws:
javax.xml.xpath.XPathExpressionExceptionjavax.xml.bind.JAXBException
-
replaceNode
public void replaceNode(java.lang.String xPath, java.lang.Object replacement) throws javax.xml.xpath.XPathExpressionException, javax.xml.bind.JAXBException, javax.xml.parsers.ParserConfigurationExceptionReplace a node in PrintTalk Document located by the XPath expression.- Parameters:
xPath- Location of the node to be replaced.replacement- The new node.- Throws:
javax.xml.parsers.ParserConfigurationExceptionjavax.xml.bind.JAXBExceptionjavax.xml.xpath.XPathExpressionException
-
-