Home

Intel(R) XML Software Suite 1.2 for Java* Environments User's Guide

image

Contents

1. Create an XPath object The newXPath method on the XPathFactory class provides the new XPath object that you can use to evaluate an XPath expression The XPath object can accept XPath expressions and perform evaluation so it mainly supplies compile and evaluate methods and provides an interface to set and get objects XPathVariableResolver XPathFunctionResolver and NamespaceContext optional Create an XPathExpression object To compile an XPath expression call compile java lang String expression This method returns an XPathExpression object that can perform evaluation against an input document This step is optional because you can evaluate input directly without creating an XPathExpression object Perform the evaluation To evaluate an XPath expression against XML data you can call evaluate on a compiled XPathExpression object see the previous step or directly on an XPath object 56 LJ NOTE LJ NOTE Using the Intel XPath Accelerator As input data you can supply a java lang Object instance which specifies the context node as a DOM node or an org xml sax InputSource instance which specifies the input data as an XML stream For DOM node context the Intel XPath Accelerator supports DOM nodes created by the Intel XML Parsing Accelerator and third party DOM nodes The evaluate method of the XPath and XPathExpression objects operates on the XML source and returns resul
2. Perform the transformation transformer transform new javax xml transform dom DOMSource inDoc domResult Get the output Node from the DOMResult org w3c dom Node node domResult getNode You can also use an extension function to redirect your output into one or more files see Other Extensions Customizing the Intel XSLT Accelerator Use the following options to customize the operation of the Intel XSLT Accelerator e Set output properties in the xs1 output element of a stylesheet After the stylesheet is compiled the output properties specified in the XSLT stylesheet can be queried using the getOutputProperties method on the javax xml transform Templates or the javax xml transform Transformer object You can override output property values when performing a transformation by calling setOutputProperty and setOutputProperties onthe Transformer object e Add parameters to your stylesheet during transformation For that the setParameter method of the Transformer object is used After setting a parameter you can retrieve it using the getParameter method e Set the mode property to specify the target behavior that Intel XSLT Accelerator conforms to You can choose between 5 modes Standard MSXML XALANJ XSLTC and XT The default value is Standard You can set this property as follows component name Intel XSLT Accelerator gt lt property name mode value XALANJ gt l
3. writer OutputFactory createXMLEventWriter stream fing 9 V s catch XMLStreamException e e printStackTrace use add method to write ip di ioe ugue a cm Oe ab x SEs caves a3 d XMLEvent event list get i int type event getEventType if type XMLStreamReader START DOCUMENT ab USSU E DOSES i writer add event startDocWritten true else if type XMLStreamReader END DOCUMENT T writer add event stream flush writer add XMLEventFactory newInstance createEndDoc ument stream flush catch XMLStreamException e e printStackTrace catch IOException el el printStackTrace Output the write result System out println stream toString 1 Z it 37 XSSUserGuideFor ava Enabling Data Validation The Intel XML Parsing Accelerator can operate in a validating or a non validating mode To use the Intel XML Schema Accelerator to validate input data do one of the following before parsing e For the SAX mode call the setSchema method in the instance of the SAXParserFactory class For the DOM mode call the in the instance of the DocumentBuilderFactory class e For the SAX mode set the schemaLanguage or schemaSource properties in the instance of the SAXParserFactory class For the DOM mode set the same properties in the instance of the DocumentBuilderFactory class The syntax
4. Getting Version Information as a String 10 See also Getting Started System out println XMLToolkit getVersionAsString Getting Version Information Object Version version XMLToolkit Printing version information Major n System out println Major version getMajorVersion n Seen OWE Tex abt Jo dene version getMinorVersion See Ole prime Joa iS eneelag V getVersion i Mamoies2 BuueclasU version getPatchVersion Show build number of last build before releas System out println BuildNumber version getBuildNumber SyS cem 6 OQUNE EE ee Ibm Vie Lene sewng V sr version getPlatform Version Query Samples Configuring the Intel XML Software Suite The Intel XML Software Suite is distributed with the config xml configuration file in the lt install_dir gt conf directory that enables you to control some product behaviors For example you may want to increase or decrease the memory threshold to speed up data processing or to reduce memory consumption accordingly After successfully installing the Intel XML Software Suite you can delete re create or modify the configuration file as needed With the configuration file you can e Adjust the threshold of memory usage to restrict the amount of system virtual memory consumed by the Intel XML Software Suite The default value is 512MB e Configure parallel XSLT transformati
5. b For the Linux 32 bit systems put 1ibintel xss j so into jre lib i386 C For the Linux 64 bit systems put 1ibintel xss j so into jre lib amd64 Oracle WebLogic Server 9 X 10 X JAVA_HOME JAVA_HOME Enabling for Applications To enable the Intel XML Software Suite for applications replace the default XML processor application wide 1 Copy the intel xss jar file to the web application library a For Windows put intel xss jar into SWEB_APP_ROOT WEB INF 1lib b For Linux put intel xss jar into SWEB APP ROOT WEB INF lib 2 Copy the native library of the Intel XML Software Suite to the java runtime library path of the web application a For Windows put intel xss j dll into SAPP_S ERV b For the Li SAPP_S 22 ER JDK HOM ERV ER JDK HOM ES jre bin nux 32 bit OS put intel xss j so into E jre 1lib i386 Getting Started C For the Linux 64 bit OS put intel xss j so into SAPP SERVER JDK HOME jre lib amd64j LJ note WEB APP ROOT is the directory of the user application APP SERVER JDK HOME specifies the jdk home the web server container uses to run the application Enabling Server wide To enable the Intel XML Software Suite as the default processor for DOM SAX XML Schema XSLT and XPath handling you need to configure the Java system properties and CLASSPATH setting The Intel StAX
6. Unrecognized XSLT attribute on literal result element Invalid attribute value on XSLT instruction 70 Specification Rules names not defined in the specification cause an error for an XSLT instruction The literal result element has no attributes from the XSLT namespace The specification defines the value range or specifics of a certain attribute on an XSLT instruction Relax Rules version in MSXML mode an error occurs The attributes in XSLT namespace not defined in the specification are ignored in the MSXML mode In the MSXML mode an error occurs when xsl output method value is neither xml html text nor a valid QName xsl output standalone is not defined xsl output indent is not defined xsl template priority is an empty string xsl sort data type is neither a number nor a text xsl sort order Mode Restrictions Allowed in all modes Allowed with implementation defined behavior in Standard XT XalanJ and XSLTC modes Partially not allowed with implementation defined behavior in the MSXML mode See the Relax Rules column for details Appendix B Compatibility Modes Support for Various I nterpretations of XSL XSL Condition xsl element name is not a QName Non white space texts in xsl attribute set Invalid pattern Specification Relax Rules Rules If the string resulting from i
7. e The XML input file provides the system ID of the DTD file e The method DocumentBuilderFactory isValidate returns TRUE DocumentBuilderFactory factory DocumentBuilderFactory newInstance factory setValidating true DocumentBuilder parser factory newDocumentBuilder Document document parser parse new File xmlFile KR Enabling DTD Validation in SAX Mode In SAX mode the Intel XML Parsing Accelerator uses the default Apache Xerces SAXParser to perform DTD validation and data parsing DTD validation is performed when the following conditions are met e The method setValidating returns TRUE 39 XSSUserGuideFor ava e The property http java sun com xml jaxp properties schemaLanguage is not set to http www w3 org 2001 XMLSchema e The property http java sun com xml jaxp properties schemaSource is not set Example SAXParserFactory saximpl SAXParserFactory newInstance saximpl setValidating true SAXParser parser saximpl newSAXParser UserDefinedSAXEventHandler userDefinedSAXEventHandler new UserDefinedSAXEventHandler parser parse xmlFileName userDefinedSAXEventHandler 40 E Using the Intel XML Schema Accelerator The Intel XML Schema Accelerator for Java Environments verifies input XML data against a schema A schema is a set of constraints that can be checked or enforced against an XML document Invoke the Intel XML Schema Accelerator th
8. break case XMLEvent PROCESSING INSTRUCTION String target ProcessingInstruction event getTarget default break Frees any resources associated with this Reader reader close Example 3 Writing an XML File with XMLStreamWriter OutputStream out null za A out new FileOutputStream data xml catch FileNotFoundException e e printStackTrace 34 Using the Intel XML Parsing Accelerator SSC XMLStreamWriter is created by XMLOutputFactory XMLOutputFactory factory XMLOutputFactory newInstance XMLStreamWriter writer null writer factory createXMLStreamWriter out ISO SION E write XML file with writeFoo methods weiter wr leeScarceDocumine YISO 8859 i1 Wi p writer writeComment This is a simple StAX streamWriter sample writer writeStartElement greeting EE writenttripuUCTS Label Hie OW ew writer writeCharacters Hello StAX writer writeEndDocument flush and close the writer writer flush writer close oure losem catch XMLStreamException e e printStackTrace catch IOException e e printStackTrace Example 4 Writing an XML File with XMLEventWriter pr Feel einen Zeene Cile public byte loadFile String filename byte buffer new byte 1024 FilelnputStream infile null E infile new FileInputStream filename catch FileNotFound
9. but you could use Using the Intel XML Schema Accelerator a java net URL or a javax xml transform Source instead File schemaLocation new File opt xml docbook xsd docbook xsd Schema schema factory newSchema schemaLocation 3 Get a validator from the schema Validator validator schema newValidator 4 Parse the document you want to check Source source new StreamSource args 0 5 Check the document GZ d validator validate source System QUE joe teg dom aes tU a V ae weillaicl p catch SAXException ex System out println args 0 is not valid because System out println ex getMessage Configuring Validation User applications can employ several means of adjusting the validation process as follows Error Handling When you set an error handler errors found during parsing a schema or validating an XML document are first sent to the ErrorHandler object The error handler can abort the parsing of a schema or validation of an XML document immediately by throwing SAXExcept ion from the handler You can specify your own error handler instead of the default one For that you need to define the following functions void error SAXParseException 43 XSSUserGuideFor ava e void fatalError SAXParseException e void warning SAXParseException The Setting a Custom Error Handler example shows how you can set your own error handl
10. 1 components of 1 features ms 4 Intel XPath Accelerator 1 Sample S PEE 17 UI RR 55 Intel XSLT Accelerator 1 samples siete tns 15 USING e 44 J JAXP Java API for XML Processing 4 P Parsing See Intel XML Parsing Accelerator USING 29 S Samples aiiis bt et epe 12 SAX Simple API for XML 1 KETTEN 29 75 XSSUserGuideFor ava SAXParserFactory iceren Gchematactorv c Simple API for XML See SAX T Template Transformers cent tete TransformerFactory sssse U user defined extensions non XSL input types return values V validator See Intel XML Schema Accelerator essen 76 X XML Suite See Intel amp XML Software cic 1 LEET 55 XPathEXpreSSioOn eee ee eee 55 XPathFactory sss 55 XSL extensible stylesheet language 1 extensions ssssseeeeee 47 EXSLT See EXSLT extensions 47 Othier dec c eR 53 user defined See user defined extenslons sss 50 Objects cosciente 46 DOM frees 46 SAX Events E 46 Streams oce ene 46 Dranstormation seere 44 configuring 45 object types sssssesss 46
11. Core i7 with Intel SSE 4 2 Operates with data in Up to and the format of data above 1GB streams DOM trees or SAX events Supports XSLT extensions including EXSLT extension functions 13 to allow applications to extend XSLT functionality Supports parallel transformation of an XML document with multiple threads Up to and above 1GB Overview Technical Support To receive technical support for the Intel XML Software Suite register for an Intel Premier Support account at the Registration Center To register for an account visit the Intel Registration Center web site If you have forgotten your password send a request to quadsupport mailbox intel com Please do not send your technical issue to this e mail address Additional information and support are available from the Intel Software Network XML User Forum and XML Software Blog To submit an issue via the Intel Premier Support web site do the following 1 Make sure that Java and JavaScript are enabled in your browser 2 Go to http premier intel com and log in 3 Submit your issue a b Click Submit I ssues in the left column Select the product type from the Product Type drop down menu For the Intel Software Products choose Development Environment tools SDV EAP as the product type Select the product for which you want to submit the issue from the Product Name drop down menu Enter a headline type description of
12. Suite 20 Getting Started Create manage and run configurations Debug a Java application Name TransformExample wi i x i i Main Arguments A JRE 5 Classpath E Source BB Environment i Common C C Attach to Local Apr Program arguments C C Local Application foo xml foo xsl output xml mics C C Postmortem debug g Eclipse Application Variables Java Applet v 31Java Application VM arguments E TransformExample Djavax xml transform TransformerFactory com intel xml transform TransformerFactoryImpl Ju JUnit Ji JUnit Plug in Test OSGi Framework Di Remote Java Application Working directory e Default workspace loc TransformExample D Other a T Lap Apply Revet Filter matched 11 of 11 items 9 Debug Close Figure 3 Setting up a Configuration to do XSLT Transformation with the I ntel XML Software Suite Integrating with Application Servers Java EE J2EE Application Servers are the key components of the enterprise computing infrastructure especially in service oriented architecture SOA environments The Intel XML Software Suite can be integrated with application servers to process XML data You can replace the XSLT portion of the default XML processing engine with the Intel XML Software Suite completely or can use it in specific instances Application serv
13. back end business service which may parse the XML data passed in validate that it conforms to a schema perform an XSLT transformation to change and augment its format and extract routing information using XPath Application servers They may provide web services stacks perform data mashups and much more In web services stacks messages may be parsed validated and transformed The Intel XML Software Suite offers various interfaces to the underlying XML data representation providing functionality for SAX StAX or DOM parsing schema or DTD validation XSLT transformation and XPath expression evaluation It is recommended to use the suite for all the functions required instead of combining functional elements with other J AXP implementations For example instead of generating a DOM with Apache Xerces Java Parser and performing an XSLT transformation on the result with the Intel XML Software Suite use the Intel libraries for both these functions This can result in significantly greater efficiency gains Overview Supported Environments The Intel XML Software Suite is supported on the following Java environments Sun Java 2 Platform Standard Edition J 2SE 5 0 Sun Java Platform Standard Edition Java SE 6 Oracle J Rockit 5 0 Oracle J Rockit 6 0 IBM JDK Version 5 0 Linux only IBM SDK for Java 6 Linux only The Intel XML Software Suite is supported on the following Windows and Linux operating systems o
14. changes to them The information here is subject to change without notice Do not finalize a design with this information The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications Current characterized errata are available on request Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order Copies of documents which have an order number and are referenced in this document or other Intel literature may be obtained by calling 1 800 548 4725 or by visiting Intel s Web Site Intel processor numbers are not a measure of performance Processor numbers differentiate features within each processor family not across different processor families See http www intel com products processor_number for details BunnyPeople Celeron Celeron Inside Centrino Centrino Atom Centrino Atom Inside Centrino Inside Centrino logo Core Inside FlashFile i960 InstantlP Intel Intel logo Intel386 Intel486 IntelDX2 IntelDX4 IntelSX2 Intel Atom Intel Atom Inside Intel Core Intel Inside Intel Inside logo Intel Leap ahead Intel Leap ahead logo Intel NetBurst Intel NetMerge Intel NetStructure Intel SingleDriver Intel SpeedStep Intel StrataFlash Intel Viiv Intel vPro Intel XScale Itanium Itanium Inside MCS MMX Oplus OverDrive PDCharm Pentium Pentium Inside
15. data to the Simple API for XML SAX API or a W3C Document Object Model DOM o Simple API for XML SAX model represents data as a sequence of events o Streaming API for XML StAX model provides a bidirectional API for reading and writing It exposes a simple iterator based API and the underlying streaming of events o Document Object Model DOM model represents data as a node tree After the document is parsed the data can be further processed by other components in the library The Intel XML Schema Accelerator validates an XML document against a specified W3C XML schema 7 document XML Schemas define a set of validation constraints which can be used to ensure that the XML data has the correct structure and values for your application to use The Intel XSLT Accelerator transforms an XML document into another XML XHTML or text document by applying a W3C XSLT 1 0 stylesheet The stylesheet describes how to transform the input document to the output document format The Intel XPath Accelerator navigates XML data by evaluating an XML path W3C XPath 8 expression over an XML document or a DOM tree The expressions return references to parts of the document or values extracted from the document for your application to use The Intel XML Software Suite can be plugged into different environments to accelerate XML processing for example Enterprise service busses They introduce intermediaries between the client and the
16. sample XML input documents You can run the examples over the provided XML sample files or with your own files To run an example navigate to the corresponding directory in the lt install_dir gt examples lt component gt directory and run the code For example to run the DOM writer example for the Intel XML Parsing Accelerator do the following 1 To compile the source code type javac Writer java For the InlinedVersionQuery example include the intel xss jar into the CLASSPATH as follows javac e ames lte Ia9 30 596 s jeu InlinedVersionQuery java 2 Torun the sample type java Writer personal xml The samples are divided into several groups by the component they use For the Intel XML Parsing Accelerator The Intel XML Parsing Accelerator can process data in SAX and DOM modes The examples for this component are grouped into dom and sax subdirectories respectively dom Writer Traverses a DOM tree to print a document that has been parsed 13 XSSUserGuideFor ava dom Counter Traverses a DOM tree to get information about the whole document dom DOMAddLines Adds lines to the DOM Node dom GetElement sByTagName Uses the Document getElement sByTagName method to quickly and easily locate elements by the tag name sax Counter Registers a SAX2 ContentHandler and receives the callbacks in order to print information about the document sax DocumentTracer Provides a complete trace of SAX2 even
17. the problem or question in the Issue Title text box Enter a detailed question or a detailed problem description in the Question text box Select Request Type from the drop down menu To complete the submission process click Submit Issue or Submit Issue Upload Files if you need to attach a file for example a test case or a screenshot You will get an issue number that enables you to track your issue 2 Getting Started Quick Start This section of the User s Guide explains how to quickly set up the library for use in your environment After installing the Intel XML Software Suite as described in the Installation Guide do the following 1 Check that the content of the installation directory matches the description in the README file If discrepancies occur consult the Troubleshooting section for recommendations on resolving the issue 2 On Linux enable Java signal processing 14 for example o ForlA 32 architectures export LD_PRELOAD lt JAVA_HOME gt jre lib i386 libjsig so KSH setenv LD PRELOAD JAVA HOME jre lib i386 libjsig so CSH o For Intel 64 architectures export LD PRELOAD JAVA HOME jre lib amd64 1libjsig so setenv LD PRELOAD KSH JAVA HOME jre lib amd64 1libjsig so CSH 3 Option 1 Check that your environment is set up correctly This step is usually done automatically at the installation stage The environment variables should be s
18. to check whether Intel XML Software Suite is used for processing Use the J VM option Djaxp debug 1 or the Java option verbose class If your XML transformation is based on JAXP interfaces and the properties are set correctly you should see the binding information printed on the console On Linux JVM crashed with an error message Program terminated by signal number 11 62 This may be caused by the incorrect setting of LD_PRELOAD Verify that your LD PRELOAD environment variable setting contains the path to libjsig so of your JVM For details on setting this environment variable see Quick Start Troubleshooting You can confirm the value of the LD_PRELOAD environment variable on the command line for example echo LD_PRELOAD 63 Appendix A Acronyms and Definitions This section lists the acronyms used throughout the document with their definitions Table 5 Acronyms Used in this Document Acronym Definition Application programming interface Document object model Extensions to XSL Transformation Input and output Java API for XML processing Java development kit Java native interface Java run time environment Post schema validation infoset Simple API for XML Transformation API for XML Processing Acronym Definition Extensible markup language XML Path Language Extensible stylesheet language XSL transformation Streaming API for XML Appendix
19. year month name date date date date Second in minut seconds time week in year year Using the I ntel amp XSLT Accelerator The current version of the library does not implement the following EXSLT functions of this module dat date Math functions sum pars date week in month These functions provide facilities for performing mathematical operations for example the math max function returns the maximum value of the nodes passed as the argument The current version of the Intel XSLT Accelerator supports all functions of this module as defined in the EXSLT resource 13 specifically math math math math math abs acos asin atan atan2 49 XSSUserGuideFor ava math constant math cos math exp math highest math log math lowest math max math min math power math random math sin MEE INS Ste ete DREES Sets functions These functions enable you to manipulate node sets For example the set difference function gets nodes of two sets as arguments compares them and returns the difference between the two sets The current version of the Intel XSLT Accelerator supports all functions of this module as defined in the EXSLT resource 13 specifically set difference set distinct set has same nod set intersection set leading set trailing Strings functions These functions are responsible for string manipulation For exa
20. A Acronyms and Definitions 65 Appendix B Compatibility Modes Support for various Interpretations of XSL Conditions This section provides details on the Intel XSLT Accelerator compatibility modes Standard XT MSXML Xalan and XSLTC These modes allow you to simulate different XSL behavioral interpretation of third party XSLT processors such as Saxon MSXML Xalan XT and XSLTC You can switch the compatibility mode on and off by setting property parameters in the config xml configuration file located in the lt install_dir gt conf directory Table 6 Compatibility Modes Support for various I nterpretations of XSL Conditions XSL Condition Local variable override Global variable override Named template override Specification Rules Two variables or parameters with the same name inside a template cause an error A stylesheet with more than one binding of a global variable with the same name and import precedence causes an error A stylesheet with more than one Relax Rules A local variable inside the scope of another local variable can have the same name In this case the inner variable shadows the outer variable the outer variable retains its value You can declare a global variable more than once The last declaration takes precedence More than one named template can have the Mode Restrictions Allowed in all modes Standard XT Xalan MSXML and XSLTC
21. Accelerator implements a factory compatible with javax xml parsers SAXParserFactory for all SAXParser objects To obtain a new SAXParserFactory call the newInstance method 28 Using the Intel XML Parsing Accelerator 3 Create the parser The newsAXParser method in the sAxParserFactory class provides a new SAXParser object that you can use 4 Perform the SAX parsing process with the class you created in step 1 The parse method of the sAxParser instance parses an XML Source as a result the event methods in the inherited DefaultHandler Class are called 5 optional Reset the parser The reset method in the SAXParser class can reset the parser for further XML processing The sample code below illustrates these steps Creating a New Handler for Data Processing import org xml sax helpers DefaultHandler class UserDefinedSAXEventHandler extends DefaultHandler public void startElement String uri Parsing an XML File in SAX Mode Get SAX Implementation Factory which is managed by the system do not release it SAXParserFactory saximpl SAXParserFactory newInstance Create a SAXParser object from SAXFactory SAXParser parser saximpl newSAXParser Set user defined EventHandler into SAXparser UserDefinedSAXEventHandler userDefinedSAXEventHandler new UserDefinedSAXEventHandler Parse your XML file through the file parser parse xmlFileName us
22. Allowed in the Standard XT XalanJ and XSLTC modes N A in the MSXML mode Allowed in all modes 66 Appendix B Compatibility Modes Support for Various I nterpretations of XSL Conditions XSL Specification Relax Rules Mode Condition Rules Restrictions template with the same name The last same name and declaration takes import precedence precedence causes an error Unknown variable A variable not You can use an Allowed in the XT declared in the undeclared variable if mode only scope causes a you skip static checking static error An error only occurs N A in other modes when the variable s value is explicitly used at run time Unknown named Unknown named You can use an Allowed in all template template undeclared named modes template if you skip static checking An error only occurs when the template is called during transformation Single right curly Using a single You can use a single Allowed in the XT brace escape in right curly brace right curly brace mode only AVT outside the TD f N A in other modes expression In AVT expression The result is the same as with outside the causes an error Use double left or right curly brace instead They are braces automatically replaced by a single curly brace two right curly Complex content If xsl processing If the offending Allowed with in comment PI instruction and node is a literal implementat and attribute xsl attribu
23. Exception e System err println Can not find the file filename System exit 1 35 XSSUserGuideFor ava ip di int count 0 ByteArrayOutputStream baos new ByteArrayOutputStream while count infile read buffer 1 ISAO Se wea Entree 0 Cocina g infile close return baos toByteArray catch Exception e System err println File error System eae iL 9 return null loadFile String Use eventReader to process the input file and collect the event private void genEvent byte xml list clear InputStream stream new ByteArrayInputStream xml XMLEventReader reader iE ii XMLInputFactory InputFactory XMLInputFactory newInstance reader InputFactory createXMLEventReader stream while reader hasNext list add reader nextEvent il catch XMLStreamException e e printStackTrace genEvent byte pur we wie process jouisdLi sweunel wiircel Y use eventReader to process the input file and get events genEvent loadFile fileName Boolean startDocWritten false 36 Using the Intel XML Parsing Accelerator Create XMLEventWriter by XMLOutputFactory XMMOUEp ME LaCie Omy ROUE DIE t a CiE Dyan XMLOutputFactory newInstance OutputStream stream new ByteArrayOutputStream XMLEventWriter writer null ipw al
24. J ARs and navigate to the Intel XML Software Suite installation directory On the Linux OS install dir lib On the Windows OS install dir Lib Select intel xss jar click Open and OK In the dialog box JARs and class folders on the build path click the intel xss jar name to open the drop down list See Figure 1 In the list of options double click Native library location click External Folder and navigate to the location of the Intel XML Software Suite For Linux e On 32 bit systems install dir bin ia32 intel xss j so e On 64 bit systems install dir bin intel64 intel xss j so Click OK then OK in the Properties window Getting Started Properties for applyxpathjaxp psum ay por Source jects Libranes G Order and Builders Ss TS Proje OH Export E Java Code Style D intel xss jar opt intel xmisoftwaresuite java lib Add JARs b Java Compiler b JRE System Library ibm java2 386 60 P m Saz 1 Add Extemal JARs p Java Editor Javadoc Location Add Variable Project References Add Library Refactoring History Run Debug Settings Add Class Fokler e Figure 1 Specifying Location of the I ntel XML Software Suite library in Eclipse I DE for Linux The Intel XML Software Suite library is now available in your project and you can use it in your Java application to perform XML data processing Using the Intel XML S
25. Processing J AXP 9 a de facto standard for XML processing in the Java environments the current release supports J AXP 1 3 and JAXP 1 4 In addition to these the components making up the suite possess a number of specific features as described in Table 1 Table 1 Component Specific Features Component Conformance Key characteristics Supported file size Intel XML Operates with data in 32 bit Parsing the format of data systems Accelerator streams DOM trees or SAX mode up to 20GB SAX events DOM mode DM up to 300MB Can enable validation G4 pi of documents with the systems Intel XML Schema SAX mode up Accelerator before to 20GB DOM mode assing data to the P g up to 600MB application Can run in the namespace awareness mode Performs DTD and data validation Provides significant XSSUserGuideFor ava Component Conformance Intel XML W3C XML Schema Schema 1 0 7 Accelerator except PSVI post schema validation infoset Intel XSLT W3C XSLT 1 0 Accelerator 3 namespace declaration formats specific for the Apache Xalan XSLTC 11 processor OASIS conformance test suite 6 for the Apache Xalan J ava processor Intel XPath W3C XML Path Accelerator Language XPath 1 0 8 Key characteristics Supported file size performance gains on the Intel Core i7 with Intel SSE 4 2 Provides significant Up to and performance gains on above 1GB the Intel
26. These extensions may be static or instance methods EXSLT Extensions The current version of the Intel XSLT Accelerator supports EXSLT extensions grouped into the following modules Common functions Date and time functions Math functions Sets functions Strings functions Common functions These functions cover the basic operations For example the common object type function returns the type of the supplied object see the Using Object Types section for a definition of processed types The current version of the Intel XSLT Accelerator supports all functions of this module as defined in the EXSLT resource 13 In addition to that the library supports the nodeset Xalan extension which matches the common node set EXSLT extension function Date and time functions These functions handle operations related to date and time for example the date hour in day function returns the hour of the day as a number 48 The current version of the Intel XSLT Accelerator supports all core functions and most other functions as defined in the EXSLT resource 13 specifically date date date date add add duration date day abbreviation dat darek darei date date cares ceres date date darek darek date date date dat day of week in month day in month day in week day in year day name difference duration format date hour in day leap year minute in hour month abbreviation month in
27. attributes xsi schemaLocation or xsi noNamespaceSchemaLocation inside the XML data However this method is not recommended because such schema location hints can introduce a vulnerability to denial of service attacks Get a validator from the schema Parse the document you need to check by creating a javax xml transform Source object for the instance document Validate your data If the source data is valid the library displays nothing If the data is invalid the Intel XML Schema Accelerator throws a SAXExcept ion object or reports errors to the specified custom ErrorHandler The Validation Procedure example illustrates how to check data with the Intel XML Schema Accelerator The current version of the Intel XML Schema Accelerator does not support PSVI so the output is not accompanied by augmented information Valida import import import import import pubike tion Procedure JENA c LO 2 javax xml transform Source javax xml transform stream StreamSource javax xml validation org xml sax SAXException class DocbookXSDCheck public static void main String args throws SAXException 42 IOException 1 Lookup a factory for the W3C XML Schema language SchemaFactory factory SchemaFactory newInstance http www w3 org 2001 XMLSchema factory setErrorHandler new MyErrorHandler 2 Compile the schema Here the schema is loaded from a java io File
28. cified as the stylesheet prefix can be the output in all the modes except for the MSXML mode In the MSXML mode comments such as lt lt abc gt gt do not cause an error In the MSXML mode using an undefined key does not cause an error In other modes it returns an empty nodeset Mode Restrictions modes Not allowed in the MSXML mode Allowed in Standard XT Xalan and XSLTC modes Not allowed in the MSXML mode Allowed in the MSXML mode N A in other modes Allowed in the Standard XT Xalan and XSLTC modes Not allowed in the MSXML mode Appendix C References This section lists relevant external documents referenced in the current document 1 2 10 11 12 13 14 15 16 W3C XML 1 0 Recommendation http www w3 org TR xml W3C Namespaces in XML 1 0 Recommendation http www w3 org TR 2006 REC xml names 20060816 W3C XSLT 1 0 Recommendation http www w3 org TR 1999 REC xslt 19991116 html W3C Document Object Model DOM Level 2 Core Specification http www w3 org TR DOM Level 2 Core Level 3 http www w3 org TR DOM Level 3 Core Simple API for XML http www saxproject org XML W3C Conformance Test Suite http www w3 org XML Test W3C XML Schema 1 0 http www w3 org TR xmlschema 1 http www w3 org TR xmlschema 2 XML W3C XPath 1 0 http www w3 org TR 1999 REC xpath 19991116 Ja
29. cumentBuilder Parse a document Document doc builder parse new FileInputStream new inst ike Eeer e Samu Ak ff Dranken 1e Sweillugicwem tele iwaswmilte wall Ilse reese in seen object org w3c dom NodeList result xpathExp evaluate doc XPathConstants NODESET 57 XSSUserGuideFor ava Resolving External Resources When the evaluated XPath expression references a variable or external function or contains a namespace prefix the XPath evaluation process depends on resolvers set by the calling application Before compiling and evaluating an XPath expression the application uses relative methods to set the correct resolver and context The variable resolver and function resolver can be set as properties of XPathFactory and XPath objects and the namespace context can only be set as a property of XPath Namespace Context When namespace prefixes are used in an XPath expression the prefixes need to be resolved to URI addresses The mapping of a namespace prefix to URI is provided by an object implementing the javax xml namespace NamespaceContext interface You can set your derived javax xml namespace NamespaceContext objects to XPath objects by calling the XPath setNamespaceContext method You need to implement one of the following methods e java lang String getNamespaceURI java lang String prefix e java lang String getPrefix java lang String namespaceURI e java util Iterator getPrefix
30. eblogic90 gt server native linux i686 Djavax xml parsers SAXParserFactory com intel xml sax SAXParserFactoryImpl Djavax xml parsers DocumentBuilderFactory com intel xml dom impl ESDocumentBuilderFactory Dorg xml sax driver com intel xml sax XMLReaderImpl Djavax xml transform TransformerFactory com intel xml transform TransformerFactoryImpl Djavax xml validation SchemaFactory http www w3 org 2001 XMLSchema com intel xml validation impl SchemaFactoryImpl Djavax xml xpath XPathFactory http java sun com jaxp xpath dom com intel xml xpath impl XPat hFactoryImpl export JAVA OPTIONS e CLASSPATH S CLASSPATH install path XMLSoftwareSuite Jav a 1 2 lib intel xss jar export CLASSPATH To prevent the Oracle WebLogic Server start up failures append the Intel XML Software Suite at the end of the Java CLASSPATH For your convenience you can add the commands listed above to the start up command script executed by the WebLogic Server during the initialization For example On Windows lt WLS_install_path gt user_project domains lt DOMAIN_NAME gt bin setDoma inEnv cmd On Linux lt WLS_install_path gt user_project domains lt DOMAIN_NAME gt bin setDoma inEnv sh IBM WebSphere Application Server V6 1 I BM WebSphere is designed to set up operate and integrate e business applications across multiple computing platforms using Java based technolo
31. elax Rules Mode Condition Rules Restrictions Unrecognized If an element in a In the modes other than Not allowed in local XSLT template is MSXML an element not Standard XT instruction with processed in allowed in XSLT 1 0 Xalan and XSLTC forward forwards causes an error if modes compatibility compatible mode initiated at run time with N A in the MSXML version gt 1 0 and mode XSLT 1 0 does not allow to initiate such elements XSLT performs fallback Invalid top level Only the XSLT In the MSXML Allowed in element elements defined mode a top Standard XT in the level element Xalan and XSLTC specification and outside the modes elements with XSLT non null URI from namespace with Not allowed in the other namespaces null URI causes MSXML mode can be top level an error elements In other modes the element is ignored Unrecognized An XSLT If xsl comment Not allowed with attribute on XSLT instruction may has any implementation instruction have attributes attribute in the defined behavior in not from other MSXML mode the MSXML mode namespaces if with both null the expand name and non null N A in other modes of the attribute URI an error has a non null occurs namespace URI Attributes with If xsl stylesheet null namespace or xsl transform URI for example has an attribute attributes with xsl version unprefixed instead of 69 XSSUserGuideFor ava XSL Condition
32. er Setting a Custom Error Handler public class ForgivingErrorHandler implements ErrorHandler public void warning SAXParseException ex System err println ex getMessage SE void error SAXParseException ex System err println ex getMessage bk ulli void fatalError SAXParseException ex throws SAXException throw ex Resolving External Resources To redirect an included or imported file or the specified schema location you can define your own external resource resolver implementing the org w3c dom 1s LSResourceResolver interface For that call method resolveResource which allows user code to resolve external resources and returns them as org w3c dom 1s LSInput Returned values can be characterStream byteStream stringData systemId and publicId 44 5 Using the Intel XSLT Accelerator This section explains how to transform XML data with the Intel XSLT Accelerator how to customize the processing Performing the XSL Transformation To transform your XML input data with the Intel XSLT Accelerator do the following 1 Instantiate a TransformerFactory object To abstract your application code from the transformer implementation the J AXP interface provides an abstract TransformerFactory Class To obtain a factory call the newInstance static method on this class Provide your XML data into the transformer Calling the newTransformer Source xslSource meth
33. erDefinedSAXEventHandler optional Reset the SAXParser instance created by SAXParserPactory parser reset Parsing Data in DOM Mode To parse your input data with the Intel amp XML Parsing Accelerator 29 J note XSSUserGuideFor ava 1 Geta javax xml parsers DocumentBuilderFactory object by calling the newInstance static method 2 Create the parser The newDocumentBuilder method in the javax xml parsers DocumentBuilderFactory class provides the new DocumentBuilder object that you can use 3 Perform the DOM parsing process The parse method of the DocumentBuilder object works over XML source and creates a tree view Document object The source data processed by the parser can be of the following types o An XML file o URI of an XML file o InputSource o InputStream from XML content or a file The Parsing an XML file to a DOM Tree example illustrates these steps with sample code Parsing an XML file to a DOM Tree import javax xml parsers DocumentBuilderFactory import javax xml parsers DocumentBuilder import org w3c dom Document Get a DocumentBuilderFactory instance DocumentBuilderFactory factory DocumentBuilderFactory newInstance Create a DocumentBuilder form DocumentBuilderFactory DocumentBuilder builder factory newDocumentBuilder Parse your XML file to a DOM tree through the file URI Document doc builder parse new File xmlFileName Document destro
34. ers use shell scripts to set Java runtime parameters and environment variables These scripts may ignore the CLASSPATH variable set by the Intel XML Software Suite installer This section shows how to integrate the Intel XML Software Suite into the application server to make the application server scripts load its libraries appropriately Apache Tomcat Servlet JSP Container 5 5 6 0 To enable the Intel XML Software Suite with Apache Tomcat do one of the following Option 1 Replace the default XML processor server wide 21 XSSUserGuideFor ava 1 a For the Windows OS put intel xss jar into OMCAT_HOM OMCAT_HOM b For the Lin OMCAT_HOM OMCAT_HOM ENcommon endorsed for Tomcat 6 0 the path is E lib or JAVA_HOME jre lib ext ux OS put intel xss jar into E common endorsed for Tomcat 6 0 the path is E 1ib or JAVA HOME jre lib ext 2 a For the Windows OS put intel xss j dll into JAVA_HOME jre bin b For the Linux 32 bit systems put 1ibintel xss j so into jre 1ib 1386 JAVA HOME C For the Linux 64 bit systems put 1ibintel xss j so into jre lib amd64 JAVA HOME Option 2 Replace the default XML processor application wide 1 a For the Windows OS put intel xss jar into WEB APP ROOTNWEB INF lib b For the Linux OS put intel xss jar into WEB_APP_ROOT WI INF lib GI B 2 a For Windows put intel xss j dll into JAVA_HOME jre bin
35. erty and Value P com intel xml sax XMLReaderImpl XSL Djavax xml transform TransformerFactory Transformer com intel xml transform TransformerFactoryImpl Schema Djavax xml validation SchemaFactory Validator http www w3 org 2001 XMLSchema com intel xml validation impl SchemaFactoryImpl Djavax xml xpath XPathFactory http java sun com jaxp xpath dom com intel xml xpath impl XPathFactoryImpl StAX Djavax xml stream XMLInputFactory components com intel xml stream XMLInputFactoryImpl Djavax xml stream XMLOutputFactory com intel xml stream XMLOutputFactoryBase Djavax xml stream XMLE ventFactory com intel xml stream XMLEventFactoryImpl Similar settings need to be set to enable Intel XML Software Suite in Eclipse IDE Getting Version Information The Intel XML Software Suite enables you to get the library version information using the GetVersion API The Version Query samples demonstrate how to extract the version information and view it from the command line interface These samples are located in the install dir examples common VersionQuery folder The example code below shows how to run a Version Query Sample import com intel xml XMLToolkit import com intel xml XMLToolkit Version public class InlinedVersionQuery Prints the version Info of Intel XML Software Suite to the standard output emile ten ter weil unes Siew cues t 1
36. es java lang String namespaceURI The User defined Namespace Context example demonstrates setting the namespace prefix mapping through the getNamespaceURI method User defined Namespace Context public class MyNamespaceContext implements NamespaceContext public String getNamespaceURI String prefix if prefix equals user return http user com else SES Eer mulli public String getPrefix String namespace 1 if namespace equals http user com return user else 58 Using the Intel XPath Accelerator ixewE Bei mu ii public Iterator getPrefixes String namespace return null Variable Resolver When variables are used in an XPath expression the Intel XPath Accelerator needs to get the type and value of these variables For that JAXP enables you to implement an XPathVariableResolver object and to set the object via setXPathVariableResolver XPath and XPathFactory objects have this method If the XPathVariableResolver is set on XPathFactory all XPath objects constructed from this XPathFactory use the specified XPathVariableResolver by default The Intel XPath Accelerator uses the XPathVariableResolver object to retrieve the value of a user defined variable A value of a variable must not change during the evaluation process The XPathVariableResolver interface provides method java lang Object resolveVariable QName variableName returning the variable value according t
37. et as shown in Table 2 Option 2 Modify the way you start your application following the steps below It can speed up the class loading process and provide additional flexibility l Specify JAXP 9 factories on your Java command line for the components you wish to use by modifying the system properties as shown in Table 3 For example Getting Started java Djavax xml parsers SAXParserFactory com intel xml sax SAXParserFactoryImpl 2 Set the run time parameters to specify the path to the Intel XML Software Suite native library o ForlA 32 architectures java Djava library path install dir bin ia32 o For Intel 64 architectures java Djava library path install dir bin intel64 Table 2 Environment Settings EI Variable Name Linux OS Windows OS Platform 1A 32 CLASSPATH install dir gt lib intel install dir gt Lib intel XSS jar XSS jar Intel amp 64 CLASSPATH install dir lib intel install dir gt Lib intel XSS jar XSS jar PATH lt install_dir gt Bin intel64 LD_LIBRARY_PATH lt install_dir gt bin inte164 Table 3 Configuring J VM to use the I ntel XML Software Suite Component VM Property and Value SAX Parser Djavax xml parsers SAXParserFactory com intel xml sax SAXParserFactoryImpl DOM Parser Djavax xml parsers DocumentBuilderFactory com intel xml dom impl ESDocumentBuilderFactory XML Reader Dorg xml sax driver XSSUserGuideFor ava Component VM Prop
38. factories S must be omitted from the system properties of the Oracle WebLogic Server configuration due to a known limitation in the StAX component of the Intel XML Parsing Accelerator To configure the system properties and CLASSPATH do the following For the Windows OS e SET JAVA_OPT Djava libra XMLSoftware lt BEA_HOME gt w IONS JAVA OPTIONS ry path install path Suite Java 1 2 Bin ia32 server_10 0 lt or weblogic90 gt Djavax xml server native win 32 parsers SAXParserFactory com intel xml sax SAXParserFactoryImpl Djavax xml parsers DocumentBuilderFactory com intel xml dom impl ESDocumentBuilderFactory Dorg xml sa Djavax xml Djavax xml x driver com intel xml sax XMLReaderImpl transform TransformerFactory com intel xml transform TransformerFactoryImpl validation SchemaFactory http www w3 org 2001 XMLSchema com intel xml validation impl S chemaFactory java sun c Impl Djavax xml xpath XPathFactory http om jaxp xpath dom com intel xml xpath impl XPathFactoryImpl e SET CLASSPAT lt install_pat For the Linux OS e JAVA_OPTIONS lt install_pat H SCLASSPATH S h gt XMLSoftwareSuite Java 1 2 Lib intel xss jar S JAVA_OPTIONS Djava library path h gt XMLSoftwareSuite Java 1 2 bin ia32 23 J note E Tip XSSUserGuideFor ava lt BEA_HOME gt wlserver_10 0 lt or w
39. for enabling input data validation differs for SAX and DOM parser operating modes The DOM Mode Enabling Validation by Calling setSchema Method and DOM Mode Enabling Validation by Setting Properties examples show how to enable validation when parsing in the DOM mode The SAX Mode Enabling Validation by Calling setSchema Method and SAX mode Enabling Validation by Setting Properties examples show how to enable validation when parsing in the SAX mode DOM Mode Enabling Validation by Calling setschema Method DocumentBuilderFactory factory DocumentBuilderFactory newInstance SchemaFactory sfactory SchemaFactory newInstance http www w3 org 2001 XMLSchema Schema schema sfactory newSchema new File schemaFile factory setSchema schema DocumentBuilder parser factory newDocumentBuilder Document document parser parse new File xmlFile SAX Mode Enabling Validation by Calling setSchema Method SAGE lca Been 1e EQUES XXE EKCIEOE Y o NEWINSCENCE C P ebe EU EXE EGNEW ISHEeNelENEN SchemaFactory newInstance http www w3 0rg 2001 XMLSchema Schema schema sfactory newSchema new File schemaFile factory setSchema schema SAXPamrser parser Eactory newsoAxParser parser parse new File xmlFile userDefinedSAXEventHandler DOM Mode Enabling Validation by Setting Properties DocumentBuilderFactory factory DocumentBuilderFactory newInstance factory setValidatin
40. form xmlns my class xalan java lang Integer In addi tion to the abridged syntax the Intel XSLT Accelerator supports Apache Xalan ava specific namespace declaration syntax for J ava extensions 10 defined in Table Formats for Xalan Namespace Declaration 2 Call th e extension function in your templates for example lt xsl variable name new pop select my class valueOf 12345 gt LJ NOTE You can call an extension function inside another extension function both for user defined and for EXSLT extension functions Table 6 Formats for Xalan Namespace Declaration xmlns my class xalan full class name Where full class name is the fully qualified class name Exa xm mples Ins my class xalan java util Hashtable xmlns my class xalan mypackage myclass Package xm format Lns my package xalan package_name Where package_name is the beginning of the Java package name Exa mples xmlns my package xalan java util xmlns my package xalan mypackage Not 54 e that unlike Apache XSLTC the Intel XSLT Accelerator has no concept of a Using the Intel XSLT Accelerator Name Format NEN default object for extension functions Java m EN A format xmlns java http xml apache org xalan java Other Extensions In addition to EXSLT and user defined extensions the Intel XSLT Accelerator supports the redirect extensio
41. g true factory setNamespaceAware true factory setAttribute http java sun com xml jaxp properties sch emaSource file C temp technical documents JAXP examples 1 xsd DocumentBuilder parser factory newDocumentBuilder Document document parser parse new File C temp technical documents JAXP examples 1 xml 38 Using the Intel XML Parsing Accelerator SAX mode Enabling Validation by Setting Properties SE EE Bue TACELOLY BEE EE EE EE EE P factory setValidating true factory setNamespaceAware true SAPE S CHOSE EIER parser setProperty http java sun com xml jaxp properties schem aLanguage http www w3 org 2001 XMLSchema parser setProperty http java sun com xml jaxp properties schem aSource file C temp technical documents JAXP examples 1 xsd parser parse new File C temp technical documents JAXP examples 1 xml userDefinedSAXEventHandler For details on the Intel XML Schema Accelerator specifics see Using the Intel XML Schema Accelerator Enabling DTD Validation The Intel amp XML Parsing Accelerator can validate the DTD during SAX mode and DOM mode parsing Enabling DTD Validation in DOM Mode Example In DOM mode the Intel XML Parsing Accelerator uses the default Apache Xerces J SAXParser to perform DTD validation and the Intel DOM implementation to parse the data DTD validation is performed when the following conditions are met
42. gy Now Intel XML Software Suite can be successfully integrated with IBM WebSphere to accelerate the XML transactions After installing IBM WebSphere follow these steps to replace the default XML processor server wide 24 Getting Started 1 Copy intel xss jar to the Java extension library directory for the Application Server e For the Windows OS put intel xss jar into WEBSPHERE_ HOME APPLICATION_SERVER java jre lib ext e For the Linux OS put intel xss jar into WEBSPHERE_ HOME APPLICATION SERVER java jre lib ext 2 Copy the Intel native library to the Java runtime library path for the Application Server e For the Windows OS put intel xss j dll into WEBSPHERE HOME APPLICATION_SERVER java jre bin e For the Linux 32 bit systems put intel xss j so into WEBSPHERE HOME APPLICATION SERVER java jre lib i386 e For the Linux 64 bit systems put intel xss j so into WEBSPHERE HOME APPLICATION SERVER Jjava jre lib amd64 LJ note Integration has only been tested with WebSphere version 6 1 and JDK 1 5 If you have a problem start up the server with the trace option on and refer to the following log files for more information e Windows e Command startServer bat serverName trac e Log Location APPLICATION_SERVER profiles AppSrv01 logs lt
43. h Verify that your environment variables are configured to point to the correct locations For details on setting the required variables see Quick Start You can confirm the values for the path variables on the command line for example e OnLinux OS echo SLD LIBRARY PATH e On Windows OS echo PATH Exception in thread main java lang UnsatisfiedLinkError home java api jni lib libintel xss j so cannot open shared object file No such file or directory java lang UnsupportedClassVersionError unsupported classversion 49 0 61 XSSUserGuideFor ava Verify that you are using a JDK or JRE environment compatible with the Intel XML Software Suite Please consult the Installation Guide for a list of supported J DK and JRE versions Check that your architecture is supported by this JDK or JRE environment The Intel XML Software Suite runs on 1 5 0 or above JDK and JRE environments Check the version of Java installation by running java version During compilation of an example from the Apache Xalan J ava website class org apache xml serializer Serializer is not found Make sure that the provided serializer jar file is in the value of the CLASSPATH environment variable During execution of the example the following error is produced java lang NoClassDefFoundError org apache xml serializer Make sure that the provided serializer jar file is in the value of the CLASSPATH environment variable Need
44. in their applications The document assumes knowledge of XML and Java programming skills When viewing this guide in PDF format your Adobe Reader viewer might generate hyperlinks from URL formatted text of the guide To disable this option modify your preferences to disable automatic hyperlink generation Product Overview The Intel XML Software Suite for Java environments is an XML processing library that you can use to parse process and serialize the XML data used in your application The library implements the J AXP 9 standard for XML processing in Java so that it can be easily used as an alternative to your normal J AXP provider be that a default implementation installed in your Java runtime environment or a third party implementation You can do an easy drop in replacement and use this product without changing your application The Intel XML Software Suite provides a rich industrial strength implementation of the J AXP API which ensures exceptional performance Now you can obtain the best that the Intel architecture can offer and take advantage of such new features as the character and string processing instructions in the Intel Streaming SIMD Extensions 4 2 Intel SSE 4 2 and scalability across multiple cores The Intel XML Software Suite covers all major stages of XML data processing with each stage handled by a separate component as follows XSSUserGuideFor ava The Intel XML Parsing Accelerator parses XML
45. inds dei atau 39 4 Using the Intel XML Schema Accelerator sssssssisssrrsssrrrnrrntsrrnrrrrnrrrrerrrserrnere 41 Validating Da tanssinsa rper et tte edes d Rn Ripe aedi e eer RE RR ERO t bd E ake 41 Configuring Validation uiri matre cie ebbe cuuiste e DE EREN nE ni nR ibi erena 43 5 Using the Intel XSLT Accelerator memes 45 Performing the XSL Transformation csssesssssssssssss eed 45 Customizing the Intel XSLT Accelerator memes 46 Ge amih rs P 47 XSLT Sce t LE 48 6 Using the Intel XPath Accelerator 0 menm 56 Performing the XPath Evaluation ccc ect eed 56 Resolving External Resources cece cece eee ene een sen nennen 58 7 TYOUDIESHOOUING WEE 61 Appendix A Acronyms and Definitions sss tine 64 Appendix B Compatibility Modes Support for various Interpretations of XSL Conditions 66 Appendix Cy Referentes EG 73 1 Overview About This Document LJ NOTE This document describes the Intel XML Software Suite with an overview of its major features and a high level view of the API and intended usage With this document you will be able to e start using the Intel XML Software Suite e run the samples supplied with the package e employ advanced functionality of the libraries making up the suite e troubleshoot product related issues The document is targeted at developers that need to perform XML data processing
46. intel Intel XML Software Suite 1 2 for Java Environments User s Guide Copyright 2007 2008 Intel Corporation All Rights Reserved Document Number 317575 005US Revision 1 5 World Wide Web http www intel com Document Number 317575 005US Disclaimer and Legal Information INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS NO LICENSE EXPRESS OR IMPLIED BY ESTOPPEL OR OTHERWISE TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT EXCEPT AS PROVIDED IN INTEL S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE MERCHANTABILITY OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLESS OTHERWISE AGREED IN WRITING BY INTEL THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR Intel may make changes to specifications and product descriptions at any time without notice Designers must not rely on the absence or characteristics of any features or instructions marked reserved or undefined Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future
47. mple the str tokenize function splits up a string and returns a node set of token elements each containing one token from the string The current version of the Intel XSLT Accelerator supports most functions of this module as defined in the EXSLT resource 13 specifically SES teen STEE EE str padding EE str tokenize 50 Using the Intel XSLT Accelerator The current version of the library does not implement the following EXSLT functions of this module str replace str encode uri and str decode uri The current version of the Intel XSLT Accelerator does not support the following EXSLT modules dynamic functions random and regular expressions LJ NOTE The Intel XSLT Accelerator does not support alternative language implementations of EXSLT functions For example http exslt org functions func is not supported so you cannot make use of implementations in JavaScript technology The current version of the Intel XSLT Accelerator is fully compatible with the Apache Xalan XSLTC processor 11 in extension function support Using an EXSLT Function For detailed instructions on how to use EXSLT functions see the EXSLT website 13 This section describes how to call an EXSLT function L LJ NOTE Declare a namespace referring to the EXSLT module that contains the desired function For example to call a date and time function type lt xsl stylesheet version 1 0 xmlns xsl http www w3 org 1999 XSL T
48. n the Java language during XSLT transformation Specifically the stylesheet in this example invokes Java methods defined in java lang Integer and java land String classes For more information on using extensions with the Intel XSLT Accelerator see XSLT Extensions Redirect Uses the Xalan specific redirect extension to divide transformation output and write parts of it to specified files instead of dumping the whole output into a single javax xml transform Result object For more details on the example consult the Apache Xalan J ava website 10 Apache Xalan Samples This directory holds selected samples from the Apache Xalan J ava web site 10 that show ease of adapting your Apache Xalan J ava based application to the Intel XSLT Accelerator Each example is located in a separate subdirectory With this release the following examples are 15 XSSUserGuideFor ava SimpleTransform Chain transformations TransformThread UseStylesheetPI UseStylesheetParam Uses the xs1 stylesheet to convert an xm1 source file and print the output Demonstrates the use of the Transformation API for XML processing TrAX Explicitly sets the SAX XMLReader and SAX ContentHandler for processing the xs1 stylesheet and the xml input files and producing the output Feed output of one transformation as input into another Pipe illustrates a forwarding model where each Transformer Object directs its output into the foll
49. n IA 32 and Intel 64 architectures as well as other x86 architectures The Linux OS Red Hat Enterprise Linux Server and Advanced Platform 5 0 Red Hat Enterprise Linux AS 4 0 2 6 kernel Red Hat Enterprise Linux ES 4 0 2 4 kernel Red Hat Enterprise Linux AS 3 0 2 4 kernel Red Hat Enterprise Linux ES 3 0 2 4 kernel SUSE Linux Enterprise Server 10 2 6 kernel SUSE Linux Enterprise Server 9 2 6 kernel The Windows OS Windows Server 2003 Standard Edition Windows Server 2003 DataCenter Edition Windows Server 2003 Enterprise Edition Windows Server 2008 Windows XP Windows Vista XSSUserGuideFor ava The Intel XML Software Suite achieves the best performance on the Intel architectures by using features of the Intel platforms and compiler tuning However new software algorithms enable large performance gains on other platforms as well If you need support for the platforms not listed above send a request to xmlinfo intel com LJ NOTE The Intel XML Software Suite for Java Environments is now available on HP UX OS 11iV2 supporting the Itanium 9 based platforms For additional product details please see The Intel XML Software Suite for Java Environments on HP UX OS Major Features All libraries of the Intel XML Software Suite possess the following key features High Performance The libraries making up the suite demonstrate high performance by using an underlying native XML p
50. n patch facility use something like dos2unix patch_alt_parser txt patch xmlbeans 2 3 0 src store org apache xmlbeans impl store Loc ale java patch alt parser txt Build the file xbeans jar from the build directory using the commands od 2 3 0 ant deploy These commands build the file xbeans jar in the build ar directory You can test that the build ran successfully by running ant checkintest Getting Started To use the Intel XML Parsing Accelerator in XMLBeans 1 Replace the old xbean jar file with a new file You may find it in places such as bea weblogic92 common lib apache_xbean jar for Oracle WebLogic Server 9 2 Configure environment variables and set the system properties to use the Intel amp XML Parsing Accelerator For example these can be put in Auser projects domainsVDomainl ntermediary bin setDomainEnv cmd for Oracle AquaLogic Service Bus 2 5 e SET JAVA_OPTIONS JAVA_OPTIONS Djava library path install_path gt XMLSoftwareSuite Java 1 2 Bin ia32 Dorg apache xmlbeans xmlreader com intel xml sax XMLReaderImpl SET CLASSPATH CLASSPATH lt install_path gt XMLSoftwareSuite Java 1 2 Lib intel xss jar To make the Intel XML Software Suite the default processor for only parsing and not all XML processing append the Intel XML Software Suite to the end of the Java CLASSPATH Adjust the configurations above for your applications that use XMLBeans For example Oracle AquaLogic Ser
51. n specific for the Apache Xalan Java implementation 10 which enables you to redirect parts of the transformation output to one or more files To see how this extension is used run the Redirect application in the Examples directory In the current version this extension supports the following encodings e UTF 8 e US ASCII e SO 8859 1 e UTF 16 UTF 16LE e UTF 16BE e UTF 32 UTF 32LE e UTF 32BE For instructions on running this example see Sample Applications 55 6 Using the Intel XPath Accelerator The Intel amp XPath Accelerator for Java Environments evaluates XPath expressions against input data An XPath expression is similar to a path as in URL and can include expressions to manipulate strings numbers and Boolean values For example the expression book title author Charles Dickens finds the titles of books written by Charles Dickens in a given XML document Performing the XPath Evaluation To evaluate your input data with the Intel XPath Accelerator 1 Instantiate an XPathFactory object To abstract your application code from the XPath implementation use the XPathFactory abstract class from the J AXP interface To obtain a factory call the newInstance or newInstance String url static method on this class The optional parameter uri specifies the object model The current implementation in the Intel XPath Accelerator only supports the W3C DOM object model which is URI DEFAULT_OBJECT_MODEL_URI
52. nstantiating name attribute is not a QName an error occurs An XSLT processor may signal the error or recover by ignoring the element itself and instantiate its content XSLT instructions have restrictions on their contents If the pattern specified in the template is is neither ascending nor descending xsl sort case order is neither upper first nor lower first In other modes the attribute is not specified and the errors described above are ignored In the MSXML mode the XSLT processor signals an error In other modes it recovers In the MSXML mode an error occurs when xsl attribute set contains non white space texts In the MSXML mode the pattern error is Conditions Mode Restrictions Allowed in Standard XT Xalan and XSLTC modes Not allowed in the MSXML mode Allowed in Standard XT Xalan and XSLTC modes Not allowed in the MSXML mode Allowed in Standard XT XalanJ and XSLTC 71 XSSUserGuideFor ava XSL Condition Output Namespace Alias stylesheet prefix Nested comment Undefined key 72 Specification Rules invalid an error occurs Undefined in the specification XML specification does not allow nested comments Undefined in the specification Relax Rules checked statically If the pattern is invalid it processor signals an error In other modes the behavior is undefined The namespace spe
53. o the input name For example if you want to evaluate an XPath expression book name Svar you need to implement an XPathVariableResolver from which the var can be retrieved see the User defined XPath Variable Resolver example User defined XPath Variable Resolver public class MyVarResolver implements XPathVariableResolver public Object resolveVariable QName qName if qName getLocalPart equals var perur Weizen enee each else return null Function Resolver When user defined functions are used in an XPath expression the Intel XPath Accelerator needs to access the value returned by the function J AXP allows you to implement an XPathFunctionResolver object and set the object via setXPathFunctionResolver for these purposes Both XPath and XPathFactory objects have this method If the XPathFunctionResolver is set on the XPathFacory all XPath objects constructed from this XPathFactory use the specified XPathFunctionResolver by default The Intel XPath Accelerator uses the XPathFunctionResolver to retrieve the value of a user defined function 59 XSSUserGuideFor ava The XPathFunctionResolver interface provides the XPathFunction resolveFunction QName functionName int arity method returning the XPathFunction object according to the input function name and its arity Object XPathFunction also requires you to provide the implementation so that you could wrap the function code into an XPathFunction
54. object For example if you want to evaluate an XPath expression user maximum 3 4 a XPathFunctionResolver sample could be the one shown in the User defined XPath Function Resolver example User defined XPath Function Resolver public class MyFunctionResolver implements XPathFunctionResolver public XPathFunction resolveFunction QName fname int arity if fname equals new QName http user com maximum Tinea return new XPathFunction public Object evaluate java util List args ii args Size 2 1 Double argl Double args get 0 Double arg2 Double args get 1 if argl gt arg2 ESA est else return arg2 else return null D I else return null 60 7 Troubleshooting This section describes the errors that you might get and their typical solutions Exception in thread main javax xml transform TransformerFactoryConfigurationError Provider com intel xml transform TransformerFactoryImpl not found Verify that your CLASSPATH environment variable setting contains the path to jar files of the Intel XML Software Suite for J ava Environments For details on setting the required CLASSPATH see Quick Start You can confirm the values for the CLASSPATH environment variable on the command line for example e On Linux OS echo CLASSPATH e On Windows OS echo CLASSPATH Exception in thread main java lang UnsatisfiedLinkError no intel xss j in java library pat
55. od on the TransformerFactory class creates a Tranformer object This method reads a supplied Source stylesheet and produces a Transformer object that you can use to perform the transformation You can supply the stylesheet just as your input data in a stream of XML markup StreamSource in a DOM node DOMSource SAX input SAXSource or StAX input StAXSource Perform the transformation The transform Source xmlSource Result transformResult method of the Transformer object reads from the XML source and places the output of the transform in a Result object The XML source can be provided in the form of a StreamSource DOMSource Or SAXSource object and the output can be a StreamResult DOMResult SAXResult or StAXResultobject The steps required to perform an XSL transformation are shown in the Using a Transformer to get a DOM Tree example and further illustrated in the TransformExample sample application supplied with the product Consult Sample Applications for details on locating and running the example Using a Transformer to get a DOM Tree 45 XSSUserGuideFor ava Generate a Transformer object tFactory TransformerFactory newInstance javax xml transform Transformer transformer tFactory newTransformer new javax xml transform stream StreamSource foo xs1 Create an empty DOMResult object for the output javax xml transform dom DOMResult domResult new javax xml transform dom DOMResult
56. oftware Suite in Eclipse IDE To use the Intel XML Software Suite as the default XML data processing engine move intel xss jar to the top of the external libraries list which is located in the Order and Export tab of the project properties see Figure 2 19 XSSUserGuideFor ava Properties for applyxpathjaxp type filter text Java Build Path e x Resource Source E Projects Libraries Mee CBsoure Sproet mL Exported entries are contributed to dependent projects P Java Code Style b Compile a intel xss jar opt intel xmlsoftwaresuite java lib U lava Compiler LI JRE System Library ibm java24386 60 E Java Editor Down a athjaxp src Javadoc Location Ee Pptyspathjexp Project References Refactoring History Bottom Run Debug Settings Select All Deselect All e es 93 Figure 2 Enabling the Intel XML Software Suite as the processing engine Alternatively you may keep your current processing engine as the default library and configure the J VM to use the Intel XML Software Suite capabilities in specific cases You can do this in the configuration running or debugging by adding new properties to Arguments gt VM augments see Table 3 for a list of available Intel XML Software Suite key classes for different modes of XML data processing Figure 3 demonstrates setting up a debugging configuration with XSLT Transformation performed by the Intel XML Software
57. on to allow the Intel XSLT Accelerator to manipulate an XML document in multiple threads The value of this option must be an integer The default value is 0 so the feature is disabled a larger value enables parallel transformation and sets the number of maximum working threads However the Intel XSLT Accelerator can further adjust the maximum number of threads for instance if you set this option to 128 threads the Intel XSLT 11 XSSUserGuideFor ava Accelerator may choose to create only 4 threads for optimal performance e Configure DocumentBuilderFactory to ignore all unsupported features and attributes By default DocumentBuilderFactory throws exceptions for unsupported features and attributes To ignore the unsupported features and attributes set the throw unknown feature value as false component name Intel XSLT Accelerator gt lt property name namespace prefix value false gt lt component gt The settings in the configuration file can apply to all or specific components They have the following format lt property name name_of_property value current_value gt Component specific settings are inside respective component tags for example component name Intel XSLT Accelerator gt lt property name maximum memory value 512m gt lt component gt On startup the Intel XML Software Suite loads and parses config xml to get the settings If no correct value is found or if an error occ
58. owing transformer UseXMLFilters illustrates a backward model where each Transformer object is an extension of the SAX xMLFilter interface and sets each preceding filter as the parent of the following filter in the chain Spawns multiple threads with each thread running two transformations on two different XML files Reads the stylesheet processing instruction in the XML source file to select the stylesheet for the transformation For more information see Configuring the Intel amp XSLT Accelerator Takes a stylesheet parameter reads the xml source file and the xs1 stylesheet and performs the transformation The stylesheet parameter appears as a text node in the output For more information on these parameters see Configuring the Intel XSLT Accelerator In addition to example subdirectories the ApacheXalanSamples directory contains the supporting file serializer jar Most samples need serializer jar only at 16 Getting Started compile time but Pipe SAX2SAX and UseXMLFilters samples need it both at compile time and at run time For the Intel XPath Accelerator ApplyXPathJAXP Evaluates an XPath expression over an input XML source XPathVariable Evaluates an XPath expression with variables over an XML source XPathExternalFunction Evaluates an XPath expression referring to an external function over a pre built DOM tree Version Query Samples InlinedVersionQuery Gets the version info of the In
59. plication You can implement content handlers error handlers and other methods depending on your needs Because SAXParser is a wrapper for the SAXReader object you can easily plug in your own reader instead of it For SAX specific methods you can use a SAXTransformerFactory object see Java API for XML Processing J AXP description 9 This feature enables the use of XML filter to pass output of one transformation as input for another transformation via the SAXTransformerFactory newXMLFilter Source and newXMLFilter Templates methods StAX Events You can use StAX Streaming API for XML events in your input data source stylesheet instructions or output You can use the XMLInputFactory object to create a 47 XSSUserGuideFor ava XMLEventReader or XMLStreamReader which can then be used to construct a StAXSource Similarly StAXResult can be constructed with XMLOutputFactory For StAX specific methods you can see the javax xml stream part of Java API for XML Processing J AXP description 9 XSLT Extensions You can expand the functionality of XSLT transformations with XSLT extensions An extension can be expressed as a function or an element Intel XSLT Accelerator provides a subset of the function and element extensions that are defined by the EXSLT community project 13 These extensions are referred to as EXSLT extensions You can also define you own Java extension functions that can be invoked during a transformation
60. ransform xmlns date http exslt org dates and times lt xsl stylesheet gt Call the extension function in your templates For example get the year as a number type from the input string call the date year function in the following way lt xsl value of select date year gt By default the extension namespace is output into the result tree To prevent this specify the excension element prefixes attribute value with the module namespace prefix User Defined Extension Functions User defined extension functions enable you to augment transformations with custom functions Extension functions can operate with several XSLT and non XSLT object types as input arguments and return values This section describes each object type in turn and lists the Java argument types that the object type can map to 51 XSSUserGuideFor ava Using Object Types The Intel XSLT Accelerator supports passing the following types of XSLT objects as arguments to extension functions e Simple types string Boolean or number e Node set types e Result tree fragments as unchangeable sets of nodes Table 5 Mapping XSLT Object Types to J ava Argument Types XSLT Type Java Argument Type Node set org w3c dom traversal NodelIterator org w3c dom Node or its subclasses org w3c dom NodeList java lang String java lang Object char double float long int short byte boolean Result tree fragment Same a
61. reader hasNext reader next int nextEvent reader getEventType Xour processing code switch nextEvent case XMLStreamReader START ELEMENT String nameStartElement reader getLocalName break case XMLStreamReader END ELEMENT String nameEndElement reader getLocalName break case XMLStreamReader CHARACTERS String text reader getText break case XMLStreamReader PROCESSING INSTRUCTION String target reader getPITarget default break Frees any resources associated with this Reader reader close Example 2 Parsing an XML File with StAX Iterator API Get XMLInputFactory which is managed by the system do not velease it XMLInputFactory InputFactory XMLInputFactory newInstance Create an XMLEventReader object from InputFactory 33 XSSUserGuideFor ava XMLEventReader reader InputFactory createEventReader xmlFileName Iterate on the document with XMLEventReader and get the information of the document from the events while reader hasNext XMLEvent event reader nextEvent switch event getEventType case XMLEvent START ELEMENT QName nameStartElement event asStartHlement getName case XMLEvent END ELEMENT OName nameEndElement event asEndElement getName break case XMLEvent CHARACTERS String text event asCharacters getData
62. rocessing core In the product major processing is done inside the core which interacts with client application via the standard J ava native interface J NI This architecture is transparent to the application Portable and Platform Specific Performance the libraries making up the suite can use the available features of the underlying hardware platform On the Intel Core TM i7 with Intel Streaming SIMD Extensions 4 2 Intel SSE 4 2 that accelerate string and character processing or Intel platforms supporting multiple cores you can get significant performance gains without changing the software configuration The Intel SSE 4 2 use two forms of parallelism o performing operations on multiple 8 or 16 byte characters at a time using the Intel Architecture s 256 bit XMM registers o performing several operations concurrently on the array of characters Conformance and Compatibility The libraries of the Intel XML Software Suite conform to the following standards defining XML data processing o W3C XML 1 0 1 o W3C Namespaces in XML 1 0 2 except Qualified Names in Declarations Overview o W3C DOM level 2 0 core and partially DOM level 3 core 4 with the limitations and specifics defined in the product Release Notes o SAX 2 0 Core and Extensions 5 with specifics defined in the product Release Notes o W3C XML Conformance Test Suite 6 except the XML 1 1 and namespaces in XML 1 1 cases o Java API for XML
63. rough the Intel XML Parsing Accelerator when performing DOM and SAX parsing as described in section Using the Intel XML Parsing Accelerator Validating Data To run the Intel amp XML Schema Accelerator for Java Environments against your XML data 1 Get a SchemaFactory object To abstract your application code from the schema implementation the JAXP interface provides an abstract SchemaFactory class The newInstance static method should be called on this class to obtain a factory A SchemaFactory object is o Not thread safe application code must ensure that only one thread uses a SchemaFactory object at any given moment Implementations are encouraged to mark methods as synchronized to prevent exceptions being generated o Not re entrant application code cannot recursively invoke the newSchema method while it is already invoked even in the same thread 2 Load and compile the schema to be used The schema can be loaded from a file in a java io File object a remote URL in a java net URL object or an XML transformation in a javax xml transform Source object If the schema location is not specified the J AXP interface provides the following method for creating a new schema Ssehenahdaetory HEEN SchemaFactory newInstance http www w3 org 2001 XMLSchema L 41 XSSUserGuideFor ava LJ NOTE 4 Schema schema factory newSchema You could also specify the location of the schema using the
64. s for the Node set type String java lang String java lang Object boolean char double float long int short byte Boolean boolean java lang String 52 Using the Intel XSLT Accelerator XSLT Type Java Argument Type Number LJ NOTE java lang Object java lang Boolean char boolean double float long int short byte java lang String java lang Object java lang Double Nodes passed to extension functions as node sets or result tree fragments are read only and cannot be modified by extension functions Extension functions can return the following value types Simple XSLT types strings number types and Boolean values XSLT node sets that correspond to org w3c dom traversal NodeIterator and org w3c dom Node J ava return types Result tree fragments to be contributed to the XSLT result document that corresponds to org w3c dom DocumentFragment Java type Non XSLT types are Java objects that are passed as stylesheet parameters or returned by extension functions Non XSLT object types are mapped to J ava arguments as follows native types or superclasses double float long int short char 53 XSSUserGuideFor ava e byte e java lang String Using your Extension Function To invoke a user defined extension function 1 Declar e the namespace for your function s for example lt xsl stylesheet version 1 0 xmlns xsl http www w3 org 1999 XSL Trans
65. serverName gt e Linux e Command startServer lt serverName gt trac e Log Location APPLICATION_SERVER profiles AppSrv01 logs lt serverName gt See also Replacing the Default XML Parser 25 XSSUserGuideFor ava Replacing the Default XML Parser Some web service applications such as Oracle AquaLogic Service Bus are built on top of Apache XMLBeans which provides a number of facilities for XML processing Older XMLBeans implementations only worked with the Piccolo default SAX parser This section explains how to configure XMLBeans to use the Intel XML Parsing Accelerator First create an xbean jar file using the patch patch_alt_parser txt J Note You may need to customize these steps for your environment 1 26 Download the patch patch_alt_parser txt from https issues apache org jira browse XMLBEANS 378 This patch enables you to use other SAX parsers Download the source code from http xmlbeans apache org sourceAndBinaries For example for version 2 3 0 use the command svn co http svn apache org repos asf xmlbeans tags 2 3 0 Some firewalls may block access to the repository In the example below this code is placed at c dev xmlbeans 2 3 0 Configure environment variables For example e SET path path c dev apache ant 1 7 1 bin e SET JAVA HOME c dev Java jdk1 5 0_07 e SET XMLBEANS_HOME c dev xmlbeans 2 3 0 Apply the patch_alt_parser txt patch If you are using the cygwi
66. skoool Sound Mark The Journey Inside Viiv Inside vPro Inside VTune Xeon and Xeon Inside are trademarks of Intel Corporation in the U S and other countries Other names and brands may be claimed as the property of others Copyright C 2007 2008 Intel Corporation All rights reserved Revision History Document Revision Description Revision Number Number Date 317576 Intel amp XML Software Suite 1 0 for Java Environments 2007 317576 ooa e Intel XML Software Suite 1 1 for Java Environments August 2008 317576 Intel XML Software Suite 1 2 for Java Environments October 2008 Table Of Contents 1 NE 1 Lieler VER ee Dn Ce 1 Product e EE 1 Supported Environments esi ket ean EE EE RENE ER SEA REE DENER NEEE AE EE BEE dea 3 Major Features Ze steererez deisde Ange t eg lac betes ceeded eege e tiered 4 Technical SUPPONE TEE 7 2 Getting Started EE 8 QUE Te 8 Getting Version Information cccceceee eect eee enses esee eee nnn 10 Configuring the Intel XML Software Gute 11 Sample Application S reniir or cire erede denis Med e ena ee cede hr Pr pa queue Ce Pa we AEREAS 13 Working with the Intel XML Software Gute 17 3 Using the Intel XML Parsing Accelerator 28 Parsing Data in SAX Mode 28 Parsing Data in DOM Mode 29 Parsing and Writing Data in StAX Mode 32 Enabling Data Validation itis rere etre rim aa etx FEN ER ERN EFE pur RE Rea Rd once 38 Enabling DTD Validationi erre Ea EL v
67. t component gt 46 Using the Intel XSLT Accelerator In this example the Intel XSLT Accelerator conforms to the Xalan J processor behavior Object Types Using Object Types As shown in the transformation description XML processing can involve data streams DOM trees SAX events and StAX events Each object type has its specifics in the transformation as described below Streams To create a StreamSource object use a system ID which is a filename following the URI syntax or a java io InputStream or java io Reader object DOM Trees Your transformations can involve DOMSource and DOMResult objects provided by the javax xml transform DOM package These involve operations with a DOM document object model tree To transform DOMSource into a stream create a new Transformer object and make a copy of your DOM tree as a stream of data To produce a DOMResult object out of a stream of data use the Document BuilderFactory object which creates a DocumentBuilder object for your needs To transform your data into a DOM tree create a new DOMResult object or use DOMResult setNode to assign a new container SAX Events You can use SAX Simple API for XML events in your input data source stylesheet instructions or output In the transformation engine the SAXParser interface defines several parse methods to handle SAX events When a parse method is called the parser invokes one of the callback handler methods in your ap
68. t objects java lang String or java lang Object If the type of the returned output is not specified the method produces the output as a String object You can also specify the return type to get method output as an Object of one of the following types XPathConstants BOOLEAN XPathConstants NUMBER XPathConstants STRING XPathConstants NODESET or XPathConstants NODE The evaluate method of the XPath and XPathExpression objects is thread safe You can call it from multiple threads with different input data The Sample XPath Evaluation example demonstrates the steps of the evaluation process The JAXP 1 3 specification 9 allows the context to be a node set However this does not conform to W3C XPath 1 0 recommendation 8 In JAXP 1 4 the node set as context is removed As it is difficult to provide a safe implementation of XPath processing of such input the Intel XPath Accelerator throws an exception if a node set is specified as the input context to avoid confusion Sample XPath Evaluation Generate an XPathFactory object EE HERE EE EE dEEMenE e lu UE EXE Y new no tancer Generate an XPath object javax xml xpath XPath xpath factory newXPath Compile an expression javax xml xpath XPathExpression xpathExp xpath compile a b c Create a document builder DocumentBuilderFactory docFactory DocumentBuilderFactory newInstance DocumentBuilder builder docFactory newDo
69. te result element ion defined construction create nodes the node and its behavior in other than text content are the MSXML ones while ignored in the mode 67 XSSUserGuideFor ava XSL Condition Unrecognized top level XSLT instruction 68 Specification Rules instantiating the content of xsl comment an error occurs The XSLT processor may signal an error or recover by ignoring the offending nodes and their content Only the XSLT elements defined in the specification and elements with non null URI from other namespaces can be top level elements Relax Rules MSXML mode In other modes an error occurs If the offending node is constructed using xsl element the element is converted to a text node with the string value of this element node This is relevant for all modes If xsl processing instruction contains top level XSLT instructions an error occurs in the MSXML mode In the MSXML mode an unrecognized top level XSLT instruction causes an error In other modes the unrecognized element is ignored Mode Restrictions Partially allowed with implementat ion defined behavior in Standard XT Xalanj and XSLTC modes See the Relax Rules column for details Not allowed in the MSXML mode Allowed in Standard XT Xalan and XSLTC modes Appendix B Compatibility Modes Support for Various I nterpretations of XSL Conditions XSL Specification R
70. tel XML Software Suite by importing corresponding classes StandaloneVersionQuery Gets the version info of the Intel XML Software Suite by invoking corresponding methods with reflect mechanism Multi component Samples BookStore Demonstrates how to use Intel DOM parsing validation XPath and XSLT functionality in a sample workflow of online book purchasing SoapMessage Shows how to use Intel XPath and validation capabilities on a SOAP message Working with the Intel XML Software Suite Before working with the Intel XML Software Suite set up your environment as specified in Quick Start 17 XSSUserGuideFor ava Working in Eclipse IDE You can now develop your XML and SOA applications from Eclipse IDE using the Intel XML Software Suite for Java Environments This section describes how to integrate the Intel XML Software Suite into the Eclipse 3 3 IDE as an external library for your application or as a resource for your plug ins LJ Note Before starting the integration make sure that Eclipse IDE and the Intel XML Software Suite are successfully installed on your machine See the Installation Guide for instructions Adding the Intel XML Software Suite to a Project Complete these steps to add a new jar library to your Eclipse project T 18 Create a new project or open an existing one Right click your project and select Properties Go to Java Build Path gt Libraries tab Click Add External
71. tor implements a factory compatible with javax xml stream XMLInputFactory 2 Call the createStreamReader or createEventReader methods for XML input to create XMLStreamReader or XMLEventReader 3 Iterate the XMLStreamReader or XMLEventReader objects to get XML document information Example 1 and Example 2 illustrate document parsing with the sample code To write a document in StAX mode 1 Call the newInstance method to get an XMLOutputFactory instance The Intel XML Parsing Accelerator implements a factory compatible with javax xml stream XMLOutputFactory 2 Call the XMLOutputFactory createStreamWriter or createEventWriter methods with an output stream to create XMLStreamWriter or XMLEventWriter 3 Call the methods of the XMLStreamWriter or XMLEventWriter objects to write the XML document to the output stream Example 3 and Example 4 illustrate document parsing with the sample code Example 1 Parsing an XML File with StAX Cursor API SC T XM Get XMLInputFactory which is managed by the system do not release it EE ACCOR y isjexbElgexenE ey EE EE c mcs cline 0 P Create an XMLStreamReader object from InputFactory XM LStreamReader reader InputFactory createStreamReader xmlFileName 32 Using the Intel XML Parsing Accelerator Iterate on the document with XMLStreamReader and get the information of the document according to current status while
72. ts for the files parsed This is useful for making sure that a SAX parser implementation communicates all the information in the document to the SAX handlers sax Writer Registers a SAX2 ContentHandler and receives callbacks to print the document that is parsed StAX StreamReader Counter Iterates with a StAX StreamReader to count the number of events in the document that is parsed StAX StreamReader Tracer Iterates with a StAX StreamReader to print the document StAX EventReader Counter Iterates with a StAX EventReader to count the number of events in the document that is parsed StAX EventReader Tracer Iterates with a StAX EventReader to print the document that is parsed StAX EventWriter SimpleEventWriter java Writes a series of XML Events through 14 Getting Started StAX StreamWriter SimpleStreamWriter java Writes a sample XML document through the XMLStreamWriter StAX StreamWriter RepairNamespaceWriter java Demonstrates the namespace repairing feature of the StAX Writer For the Intel XML Schema Accelerator Consists of the ValidatingParser and Validator samples which demonstrate validation of XML documents in the stream SourceValidator SAX and DOM modes against the XML Schema documents For the Intel XSLT Accelerator Transform Performs a stream to stream transformation for the specified xnl and xsl files ExtensionFunction Shows how to make use of extension functions defined i
73. urs the product uses the default built in value If the library 1ibintel xss j so on the Linux OS or intel xss j d11 on the Windows OS is not in the folder where it was originally installed the Intel XML Software Suite searches for config xml at conf relative to the folder where the library is located Configuring Components In addition to centralized configuration settings via an external file you can adjust the operation of individual Intel XML Software Suite components programmatically specifically e The Intel XML Parsing Accelerator e Enable input data validation mode see Enabling Data Validation e Enable DTD validation mode see Enabling DTD Validation e The Intel XML Schema Accelerator e Seta custom error handler or an external resource resolver see Configuring Validation 12 Getting Started e The Intel XSLT Accelerator e Set output properties and add parameters to the XSL stylesheet see Configuring the Intel XSLT Accelerator e Add your own extension functions see User Defined Extension Functions e The Intel XPath Accelerator e Set external resource resolvers for namespace contexts XPath variables and functions see Resolving External Resources Sample Applications he distribution of the Intel XML Software Suite includes many source code examples that show how you can use the product with your application These examples are packaged with source files makefiles and
74. va API for XML Processing J AXP https jaxp dev java net Apache Xalan Java transformer http xml apache org xalan j Apache Xalan C transformer http xml apache org xalan c OASIS XSLT Conformance test suite http www oasis open org committees documents php wg abbrev xslt Extension to XSLT http exslt org Java Signal Chaining http java sun com j2se 1 5 0 docs quide vm signal chaining html http wiki eclipse org FAQ What is the classpath of a plug in963F http wiki eclipse org FAQ How do add a library to the classpath of a plug in96 3F 73 Index A Apache Xalan oo 53 C ContentHandler iisas 29 D Document Object Model 1 DocumentBuilderFactory 30 DOM document object model 1 E ErrorHandler sssssssesse 42 EXSLT evtensions 47 COMMON sisirin teneras 47 Date and me 47 declaring pnamespace n 47 Mathis esset ener besote on 47 eI cR 47 Ke ue 47 USING em 50 extensible stylesheet language 1 external resources in schema validation 42 XPath iter ERA 57 function resolver 58 namespace context 57 variable resolver 58 l Intel XML Parsing Accelerator 1 using in DOM mode 30 in SAX mode 29 Intel amp XML Schema Accelerator 1 samples emet ene 15 UII 40 Intel XML Software Suite
75. vice Bus 2 5 has an additional library path so replace the corresponding line above with Djava library path lt install_path gt XMLSoftwareSuite Java 1 2 Bin ia32 lt install_ path gt bea weblogic92 server native win 32 27 3 Using the Intel XML Parsing Accelerator The Intel XML Parsing Accelerator for Java Environments performs parsing of input XML data following the SAX or DOM model and can evaluate input data against a set of constraints by using the Intel XML Schema Accelerator Parsing Data in SAX Mode When parsing the document in SAX mode you need to define the set of actions to be executed when a certain part of an XML document is parsed The Intel XML Parsing Accelerator supports e the SAX2 rg xml sax ContentHandler interface e the org xml sax DocumentHandler interface compatible with SAX 1 0 standard 5 The main difference between the two interfaces is that ContentHandler provides namespace support while DocumentHandler does not To parse a document in SAX mode 1 Implement an event handler To implement and register an event handler create a new class inheriting from the class org xml sax helpers DefaultHandler The DefaultHandler class provides all the required methods for parsing events Your code can inherit from this class and implement the methods your application actually uses See Creating a New Handler for Data Processing 2 Get a SAXParserFactory instance The Intel XML Parsing
76. xpansion feature to TRUE in DocumentBuilderFactory In this mode the read only DOM APIs are not thread safe because of the lazy expansion of DOM nodes GI To achieve thread safe DOM tree traversal set this feature to FALSE The Editing a Document Object example demonstrates creating a new element with an emp loyeeld local name belonging to the test namespace and then appending the element to a document object Editing a Document Object E import org w3c dom Element import org w3c dom Node Access to the child node that is the root element of the leren leng EE Tm emere o rte Elemen E Mr c cetero Gn emeng LH 3 Create an element object Element element Clore Geet lemaneNS ees V euployeeg g Append th lement object as the last child of the root element Node appendedChild rootElement appendChild element 31 XSSUserGuideFor ava Parsing and Writing Data in StAX Mode The Streaming API for XML includes two API sets the cursor API and the iterator API The cursor API enables efficient reading and writing of the XML data It has the XMLStreamReader and XMLStreamWriter interfaces The iterator API enables easy pipelining It is an easy to use easy to extend event based API with XMLEventReader and XMLEventWriter interfaces To parse a document in StAX mode 1 Call the newInstance method to get an XMLInputFactory instance The Intel XML Parsing Accelera
77. y method provides a performance benefit for all Java DOM parsing XML files For intensive workloads such as repeated J ava DOM parsing of large XML files during a prolonged amount of time by many threads performance of the product may degrade due to extensive memory usage To avoid this explicitly invoke Document destroy to do cleanup and set the Document Object to NULL as shown in the Tuning for Intensive Workloads example In this case the application code notifies the J VM that the Document object returned by DocumentBuilder parse will not be used any more 30 Using the Intel XML Parsing Accelerator Document destroy can provide a more significant performance boost for XML files larger than 640K and more than 2 threads or iterations Tuning for Intensive Workloads EE A find the method destroy and invoke it to do the clean up Class docClass doc getClass Method dtor docClass getMethod destroy new Class 0 aie Cleo f matin dtor invoke doc new Object 0 catch Exception e notify JVM that this object will not be used any more Coe imul Accessing and Updating the DOM Tree LJ note To access and update the DOM tree created by a DocumentBuilder use the DOM API methods For a detailed description of these methods see the API documentation Index_API_Java html To achieve a better performance for document parsing set the http apache org xml features dom defer node e

Download Pdf Manuals

image

Related Search

Related Contents

Stackshot manual (v1.5) - Extreme  Pelco Keyboard KBD5000 User's Manual  CXU - Cambridge Audio  ディアム - サンワカンパニー  ELEVADOR DE CADENA ELÉCTRICO  ASUS CP6230 S7729 User's Manual  3R RGA01 - Windshield for Rain Gauge - Manual - Rev. A  Targus THZ160CA  souffleur avant 66  

Copyright © All rights reserved.
Failed to retrieve file