...
Code Block | ||
---|---|---|
| ||
// get binary stream InputStream xJdfStream = [...] // validate XJdfValidator xJdfValidator = XJdfValidator.newInstance(xJdfStream); boolean result = xJdfValidator.isValid(); // message output List<String> messages = xJdfValidator.getMessages(); String msgText = xJdfValidator.getMessagesText(); |
XJdfNavigator
The XJdfNavigator class provides functionality for reading, modifying and analyzing XJDF Documents using XPath. XPath is a very powerful XML Technology for working with XML Documents. More details about the XPath W3C Standard can be found here: http://www.w3.org/TR/xpath/.
XJdfNavigator directly works on InputStream objects or Byte Arrays, so there is no need to parse the document before hand. This mechanism saves time, code complexity and performance. One XJdfNavigator instance is required for each XJDF Document processed. There are several methods for reading, modifying and analyzing the document.
XPath Expressions
The following is a short XPath overview of expressions which are significant to XJDF Documents. The XJDF snippet after is used for extracting these attribute values:
XPath Expression | Attribute Value |
---|---|
/XJDF/GeneralID/@IDUsage | "CatalogID" |
/XJDF/ParameterSet[@Name='RunList']/Parameter[./Part/@Run='Cover']/RunList/FileSpec/@URL | "cover.pdf" |
/XJDF/ProductList/Product/@Amount | "1500" |
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by CIP4 xJdfLib 0.4 -->
<xjdf:XJDF xmlns:xjdf="http://www.CIP4.org/JDFSchema_2_0" ID="XJDF_2GYLJJJG"
JobID="FA-SIG-123456" Category="Web2Print" Version="2.0">
<xjdf:GeneralID IDUsage="CatalogID" IDValue="46" />
<xjdf:ProductList>
<xjdf:Product Amount="1500"/>
</xjdf:ProductList>
<xjdf:ParameterSet Name="RunList">
<xjdf:Parameter>
<xjdf:RunList>
<xjdf:FileSpec URL="cover.pdf"/>
</xjdf:RunList>
<xjdf:Part Run="cover"/>
</xjdf:Parameter>
<xjdf:Parameter>
<xjdf:RunList>
<xjdf:FileSpec URL="body.pdf"/>
</xjdf:RunList>
<xjdf:Part Run="body"/>
</xjdf:Parameter>
</xjdf:ParameterSet>
</xjdf:XJDF> |