Class PrintTalkNavigator


  • public class PrintTalkNavigator
    extends org.cip4.lib.xjdf.xml.internal.XmlNavigator
    Navigator class which simplify XPath handling using PrintTalk Documents.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BUSINESS_ID
      XPath to attribute 'BusinessID' of PurchaseOrder Node in PrintTalk Document.
      static java.lang.String CURRENCY
      XPath to attribute 'Currency' of PurchaseOrder Node in PrintTalk Document.
      static java.lang.String TIMESTAMP
      XPath to attribute 'TimeStamp' in PrintTalk Document.
      static java.lang.String XJDF
      XPath to embedded XJDF Document in PrintTalk Document.
      • Fields inherited from class org.cip4.lib.xjdf.xml.internal.XmlNavigator

        nsManager, xmlDocument, xPath
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object extractNode​(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.InputStream getPtkStream()
      Returns the PrintTalk Document as Stream.
      java.lang.String readXJdfAttribute​(java.lang.String xPathXJdf)
      Read attribute from embedded XJdf Document in PrintTalk.
      void replaceNode​(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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.IOException
        Custom 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.ParserConfigurationException
        Custom 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.IOException
        Custom 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.IOException
        Custom 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.ParserConfigurationException
        Custom 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.SAXException
        Custom 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.ParserConfigurationException
        Custom 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.SAXException
        Custom 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.IOException
        Returns 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.IOException
        Returns 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.XPathExpressionException
        Read 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.JAXBException
        Evaluates 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.XPathExpressionException
        javax.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.ParserConfigurationException
        Replace 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.ParserConfigurationException
        javax.xml.bind.JAXBException
        javax.xml.xpath.XPathExpressionException