Durations
For calculating durations you can use a function like or just use the subtraction operator - with two date values lt xsl value-of , The result is an xs dayTimeDuration value of P2D. Duration functions work in the opposite direction. For example, you can use the hours-from-duration function on P2D to get 48 lt xsl variable name hours
Working with MSSOAP
When working with MSSOAP, you have the option of using an RPC client or a Serialization client. The RPC client works essentially the same way that SOAPy does however, there are some subtle differences. For example, to initialize a connection with remote service description, use the mssoapinit method as opposed to SOAPy's get_proxy, but the net effect is the same as shown here sc response sc.methodName param, param Again, the net effect of web service RPC implementations is to allow you to work...
How to use Xalan
Xalan is a Java 1.1 character mode application. To use it, you'll need a Java 1.1-compatible virtual machine such as Sun's Java Development Kit JDK , or Java Runtime Environment JRE , Apple's Macintosh Runtime for Java 2.2 MRJ , or Microsoft's virtual machine. You'll need to set your CLASSPATH environment variable to include both the xalan.jar and xerces.jar files both included in the Xalan distribution . On Unix Linux you can set this in your .cshrc file if you use csh or tcsh or in your...
SOAP and WSDL
In the last chapter, you learned about web services and how they work toward enabling disparate systems to communicate. Of course, if everyone just chose their own formats in which to send messages back and forth, that wouldn't do much good in the interoperability area, so a standard format is a must. XML-RPC is good for remote procedure calls, but otherwise limited. SOAP overcomes that problem by enabling rich XML documents to be transferred easily between systems, even allowing for the...
Verifying Username and Password Credentials
The one thing we haven't discussed is how the authentication details are validated by the Web service. If you're using X509 certificates as the credentials, no checking is done by the Security input filter to validate the certificate you passed another nail in the coffin of using X509 certificates for authentication If you're using username and password security credentials, once you receive a lt wsse UsernameToken gt , you must verify that the username and password are correct. If you don't...
Error Management
If you try to replace the method you are calling with any method you did not implement, the service will automatically trigger an error, which will be caught by the client and can be checked via the faultCode method. So if we change one line in the client script to message new XML_RPC_Message 'label.getArtists', params Could not use the XML-RPC service. Unknown method As we did not implement the method, the service will signal the error automatically without any intervention needed by the...
Example DBMSXMLGEN Generating Complex XML Inputting User Defined Types For
When you input a user-defined type UDT value to DBMS_XMLGEN functions, the user-defined type is mapped to an XML document using canonical mapping. In the canonical mapping, user-defined type's attributes are mapped to XML elements. Attributes with names starting with are mapped to attributes of the preceding element. User-defined types can be used for nesting in the resulting XML document. For example, consider tables, EMP and DEPT To generate a hierarchical view of the data, that is,...
C IBM Redbooks
For information on ordering these publications see How to get IBM Redbooks on page 287. The XML Files Using XML for Business-to-Business and Business-to-Consumer Applications, SG24-6104 The XML Files Using XML and XSL with IBM WebSphere V3.0, SG24-5479 Lotus Domino Release 5.0 A Developer's Handbook, SG24-5331 Using VisualAge for Java to Develop Domino Applications, SG24-5424 Connecting Domino to the Enterprise Using Java, SG24-5425 Domino and WebSphere Together, SG24-5955
Objectives 1
To understand what a schema is. To understand the basic differences between DTDs and schema. To be able to create Microsoft XML Schema. To become familiar with both Microsoft XML Schema and W3C XML Schema. To use schema to describe elements and attributes. It is hard to be truly excellent, four-square in hand and foot If you describe things as better than they are, you are considered to be romantic if you describe things as worse than they are, you will be called a realist and if you describe...
Creating the CGI Script
The xslt.cgi script pulls the stylesheets together and coordinates the processing and updating of the XML on disk. While this application lets you edit and display XML in your browser, it only consists of a single CGI script and two XSL sheets. The source data that may constantly change is also stored on disk as XML. XSLT transformations can be done programmatically using the xml.xslt.processor.Processor class provided 4XSLT is installed, as shown earlier . When the CGI script launches, it...
Example The DOM DOMErrorHandler interface
public boolean handleError DOMError error In Xerces-2, the XMLSerializer class implements the DOMWriter interface, so if you prefer you can use these methods instead of the ones discussed in the last section. Example 13.5 demonstrates a complete program that builds a simple SVG document in memory and writes it into the file circle.svg in the current working directory using a r n line end and the UTF-16 encoding. The error handler is set to an anonymous inner class that prints error messages on...
Returning Partial Results
When selecting the results of a large column, you might want to retrieve only a portion of the result and create a URL to the column instead. For example, consider the case of a travel story Web site. If all the travel stories are stored in a table, and users search for a set of relevant stories, you do not want to list each entire story in the result page. Instead, you show the first 100 characters or gist of the story and then return a URL to the full story.This can be done as follows Example...
Listing Traversing DOM Tree Using XmlDocument Class
lt Page Language C gt lt Import Namespace System.Xml gt lt script runat server gt void Page_Load object sender, EventArgs e string xmlPath Request.PhysicalApplicationPath App_Data Books.xml XmlDocument doc new XmlDocument doc.Load xmlPath XmlNode rootNode doc.DocumentElement DisplayNodes rootNode Print the node type, node name and node value of the node if node.NodeType XmlNodeType.Text Response.Write Type node.NodeType Value node.Value lt br gt Response.Write Type node.NodeType Name node.Name...
Searching XML Data with Oracle Text
This chapter explains the use of Oracle Text functionality in indexing and querying XML data. It contains the following sections Searching XML Data with Oracle Text Assumptions Made in This Chapter's Examples Oracle Text Users and Roles Querying with the CONTAINS Operator Using the WITHIN Operator to Narrow Query Down to Document Sections INPATH or HASPATH Operators Search Using XPath-Like Expressions Building a Query Application with Oracle Text Step 1. Create a Section Group Preference Step...
The doInitBody Method 1
The doInitBody method of the outputChatMessages tag handler is very similar to that of the outputPathNames tag handler, which we discussed in Section 10.4.5, The doInitBody Method. One major difference is that the BonForumStore method that is invoked by outputChatMessages is different, as shown here outputTable new TreeMap bonForumStore.outputForumChatMessages command, attrl, attr2, attr3, pageContext.getSession This method returns a TreeMap object with nodeKey.aKey values as keys and chat...
How Does Oracle Enqueue and Dequeue and Process XML Messages
In an OTN document, it says that an Oracle database can enqueue and dequeue XML messages and process them. How does it do this Do I have to use XML SQL Utility XSU in order to insert an XML file into a table before processing it, or can I enqueue an XML file directly, parse it, and dispatch its messages through the AQ process Must I use XML SQL Utility every time I want to INSERT or UPDATE XML data into Oracle9i Database Answer AQ supports enqueing and dequeing objects. These objects can have...
The wwordDocument Element
The root element of Example 2-2,vr wordDocument, has a large number of attributes xmlns sl ht topp schemas .microsoft. com schemaLibrary 2003 core 0 03 auxHint 9F-00AA0 0C14 8 8 2 w macrosPresent no w embeddedObj Present no w ocxPresent no xml space preserve gt Actually, F st f thtst art technically camtspact dtclarati cs. Thty art prtstct c tvtry W rdpr ctssicgt- d cuFtct that W rd utputs, rtgardltss f whtthtr all tht camtspacts art actually ustd ic tht d cumtct. Ic W rdpr ctssicgt-, y u cac...
Dequeue Using AQ XML Servlet
You can perform dequeue requests over the Internet using SOAP. See Also Oracle9i Application Developer's Guide - Advanced Queuing for information about receiving AQ messages using SOAP. In the Books0nline scenario, assume that the East shipping application receives AQ messages with a correlation identifier 'RUSH' over the Internet. Example 23-4 Receiving and Dequeuing AQ XML Messages The dequeue request will have the following format lt xml version 1.0 gt lt AQXmlReceive xmlns lt...
Introducing Java DOM and Java Bean APIs for XMLType
Oracle XML DB supports the following Java Application Program Interfaces APIs Java Document Object Model DOM API for XMLType. This is a generic API for client and server, for both XML schema-based and non- schema-based documents. It is implemented using the Java package oracle.xdb.dom. To access XMLType data using JDBC use the class oracle.xdb.XMLType. Java Bean API for XMLType. This is a high performance API for the server for XML schema-based documents. It is implemented using Java package...
Configuring the UriFactory Package to Handle DBUris
The UriFactory, as explained in Creating Instances of UriType Objects with the UriFactory Package on page 12-25, takes a URL and generates the appropriate subtypes of the UriType to handle the corresponding protocol. For HTTP URLs, UriFactory creates instances of the HttpUriType. But when you have an HTTP URL that represents a URI path, it is more efficient to store and process it as a DBUriType instance in the database. The DBUriType processing involves fewer layers of communication and...
Calling an Extension Function
The next example shows how to make use of a function in the FunctX stylesheet library, details of which I mention later in this appendix. You can download the XSLT 2.0-compatible version of the library from I suggest that you choose the commented version for your download, which you should save in a convenient folder. It is advisable to retain the library intact, as there are some interdependencies. The functx contains-word function works in a similar way to XPath contains . It takes two string...
The Currency Converter Proxy
This example shows how to take advantage of a currency conversion service, one of several free services found at www.xmethods.net ve2 index.po. The basic signature of the service is as follows float rate getRate string countryFrom, string countryTo It accepts the ISO standard country abbreviation as found in a URL for two countries, and returns the conversion rate between their currencies. For example, calling getRate with us and uk might return 0.57. There are three steps to this example 1....
Specifying Doctype Limiters to Distinguish Between Tags
Oracle8i release 8.1.5 and higher allow you to specify doctype limiters to distinguish between these tags across doctypes. Simply specify the doctype in parentheses before the tag as follows contact address' address' Now when the XML section group sees an address tag, it will index it as the address section when the document type is contact, or as the email section when the document type is mail.
MSXML NamedNodeMap Object
The NamedNodeMap object is MSXML3.0's support for namespaces and attribute nodes. getNamedItem name This method retrieves the attribute with the given name. getQualifiedItem baseName, namespaceURI This method retrieves the attribute but within the given namespace context. item index This method returns the item at the given index. If there is no such item, None is returned. This method returns the next node in the collection. This method removes the given item from the node collection....
Anatomy of a DTD
Now that you have seen a DTD, let's look at each of the DTD declarations in more detail. Generally, DTDs consist of three basic parts The current name example needs to be expanded to explore the more complex aspects of DTDs. In this section, you will create an XML vocabulary for listing contacts all of your friends and family. Note, however, that there are many existing vocabularies for contacts on the Internet. Using a simplified format will enable you to quickly create your own vocabulary.
Determining a Nodes Type
You can use the constants built in to the DOM to see what type of node you are dealing with. It may be an element, an attribute, a CDATA section, or a host of other things. All the node type constants are listed in Appendix D. To test a node's type, compare its nodeType attribute to the particular constant you're looking for. For example, a CDATASection instance has a nodeType equal to cdata_section_node. An Element with potential children has a nodeType equal to element_node. When traversing a...
XMLAgg Function
XMLAgg function is an aggregate function that produces a forest of XML elements from a collection of XML elements. Figure 10-7 describes the XMLAgg syntax. As with XMLConcat , any arguments that are null are dropped from the result. XMLAgg function is similar to the SYS_XMLAGG function except that it returns a forest of nodes, and does not take the XMLFormat parameter. This function can be used to concatenate XMLType instances across multiple rows. Example 10-13 XMLAgg Generating Department...
Transforming to a simple text file
We've already done most of the work involved in setting up the environment to transform the same DXL output file we used in the last example for XML output. In this case, we've copied the original Domino agent TransformXMLtoXMLfile and renamed the new copy TransformXMLtoTextFile. In the new agent we've specified a new XSL stylesheet to use for the transformation and a new output file name. Refer to 4.3, Transforming from XML to XML on page 212 to get an overview of the environment and the Java...
deleteNode
You have seen how the optionally recursive node deletion works. Now let's look at the public method by which a user application deletes a BonNode from a ForestHashtable. Here is the source code for its deleteNode method public boolean deleteNode NodeKey keyOfNodeToDelete, boolean leafOnly if this.containsKey keyOfNodeToDelete if leafOnly return false was not a leaf node, so not deleted return You can see how easy node access is when you have the NodeKey. Of course, this does not require the...
Object Type XMLType
Oracle9i follows this approach and introduces a new object type XMLType. The main purpose of XMLType is to encapsulate the CLOB storage and to provide XPath-based methods to ease the handling of XML documents. XMLType can be used like any other Oracle type in tables. XMLType provides several methods for processing XML documents STATIC createXML xml VARCHAR CLOB MEMBER getClobVal RETURN CLOB MEMBER getStringVal RETURN VARCHAR MEMBER getNumberVal RETURN NUMBER MEMBER isFragment RETURN NUMBER The...
getContentType Function
getContentType function returns the MIME information for the URL. The HttpUriType de-references the URL and gets the MIME header information. You can use this information to decide whether to retrieve the URL as BLOB or CLOB based on the MIME type. You would treat a Web page with a MIME type of x jpeg as a BLOB, and one with a MIME type of text plain or text html as a CLOB. Example 12-1 Using getContentType and HttpUriType to Return HTTP Headers Getting the content type does not fetch all the...
WriteAttributeString Method Writes Attributes and Namespace Declarations
The WriteAttributeString method has two different tasks. One task is to write out attributes and associate them with a user defined namespace prefix. The second task is to generate namespace declarations. If writing attributes and the localname parameter is xmlns, then this method is considered to be creating a namespace declaration. In the following code example, the WriteAttributeString method is used to write attributes inside an element. novel Write the ISBN attribute. 1-8630-014 The...
Every StartTag Must Have an EndTag
One of the problems with parsing HTML documents is that not every element requires a start-tag and an end-tag. Take the following example lt p gt Here is some text in an HTML paragraph. lt br gt Here is some more text in the same paragraph. lt P gt And here is some text in another HTML paragraph. lt p gt Notice that the first lt p gt tag has no closing lt p gt tag. This is allowed in HTML, because most web browsers can figure out where the end of the paragraph should be. In fact, years ago,...
The XmlSerializer Class
The central element in the XML serialization architecture is the XmlSerializer class, which belongs to the System.Xml.Serialization namespace. The XML serialization process can be used to quickly develop an XML-driven application and get the best of both worlds objects for programming and XML for data transfer or storage. The XmlSerializer does the transformations from one representation to the other. To accomplish its functionalities, the XmlSerializer class exposes the methods shown in Table...
Register the SunJSSE Provider
You need to explicitly register the SunJSSE provider before accessing its services. This registration can be done in two possible ways static or dynamic. Edit the security property file. for WIN32, this file is as follows For any Unix-based system Solaris, Linux and so on , this file is as follows The java.security file contains one property of the type This property declares a provider and sets its preference order n . If no specific provider is requested, the preference order determines the...
Info Kve 1
setParameter DOMString name, DOMUserData value DOMUserData getParameter DOMString name Returns the value of the parameter, if known boolean canSetParameter DOMString name, DOMUserData value Returns true if the DOM implementation is able to set the given parameter to the given value
Transforming to EDI
EDI Electronic Data Interchange has been around for over 30 years, and has a loyal following of hundreds of thousands of organizations, which use it for conducting secure business transactions between EDI-compatible organizations. EDI transactions follow a syntax called X12, which provides security and flexibility in a compact and rigidly standardized format. Because of this, transformations between EDI and XML are possible, but standards have to be just as rigid on the XML side to make sure...
Oracle XML DB Servlet Example
The following is a simple servlet example that reads a parameter specified in a URL as a path name, and writes out the content of that XML document to the output stream. Example 20-1 Writing an Oracle XML DB Servlet test.java import javax.servlet.http. import javax.servlet. import java.util. import java.io. import javax.naming. import oracle.xdb.dom. public class test extends HttpServlet protected void doGet HttpServletRequest req, HttpServletResponse resp throws ServletException, IOException...
DOM with JavaScript
To introduce document manipulation with the XML Document Object Model, we begin with a simple scripting example that uses JavaScript and Microsoft's msxml parser. This example takes an XML document Fig. 8.2 that marks up an article and uses the DOM API to display the document's element names and values. Figure 8.3 lists the JavaScript code that manipulates this XML document and displays its content in an HTML page. Line 15 lt script type text javascript language JavaScript gt Sun Microsystem's...
Oracle XML DB Configuration Example
The following is a sample Oracle XML DB configuration file Example A-1 Oracle XML DB Configuration File lt xdbconfig lt protocolconfig gt lt common gt lt extension-mappings gt lt mime-mappings gt lt mime-mapping gt lt mime-mapping gt lt mime-mapping gt lt mime-mapping gt lt mime-mapping gt lt mime-mapping gt lt lang-mappings gt lt lang-mapping gt lt lang gt english lt lang gt lt lang-mapping gt lt lang-mappings gt lt charset-mappings gt lt charset-mappings gt lt encoding-mappings gt lt...
Using XMLType In Triggers
You can use the new and old binds inside triggers to read and modify the XMLType column values. For INSERT and UPDATE statements, you can modify the new value to change the value being inserted. Example 4-39 Creating XMLType Triggers For example, you can write a trigger to change the purchase order if it does not contain a shipping address CREATE OR REPLACE TRIGGER po_trigger BEFORE INSERT OR UPDATE ON po_xml_tab FOR EACH ROW declare if NEW.poDoc.existsnode ' SHIPADDR' 0 then when updating, if...
Writing Images Using XmlWriter
The techniques described in the previous sections can also be used with any sort of binary data that can be expressed with an array of bytes, including images. This section provides you with an example and demonstrates how to embed a JPEG image in an XML document. The structure of the sample XML document is extremely simple. It consists of a single employee node, and inside that node there is an image node holding the binary image data plus an attribute containing the original file name. Code...
DTDHandler
SAX is mostly about the instance document, not the DTD or schema. However, given a validating parser, or at least an internal DTD subset, the DTD can affect the contents of the instance document in six ways 1. It can provide default values for attributes. 2. It can assign types to attributes which affects their normalized value. 3. It can distinguish between ignorable and non-ignorable white space. 4. It can declare general entities. 5. It can declare unparsed entities. The first four are...
PLSQL DOM API for XMLType Examples
Example 8-1 Creating and Manipulating a DOM Document This example illustrates how to create a DOMDocument handle for an example element PERSON -- This example illustrates how to create a DOMDocument handle for an example docelem dbms_xmldom.DOMElement node dbms_xmldom.DOMNode nodelist dbms_xmldom.DOMNodelist buf varchar2 2000 var xmltype ' lt PERSON gt lt NAME gt ramesh lt NAME gt lt PERSON gt ' doc dbms_xmldom.newDOMDocument var dbms_xmldom.writetobuffer ndoc, buf docelem...
Example A stylesheet for generating SpreadsheetML
lt xsl stylesheet version 1.0 xmlns xsl http www.w3.org 19 9 9 XSL Transform 0 lt xsl output method xml omit-xml-declaration no indent yes encoding US-ASCII gt lt xsl template match d dinosaurs gt lt xsl processing-instruction Excel.Sheet lt xsl lt --Namespace declarations moved from Workbook to xsl stylesheet-- lt Style ss ID Default ss Name Normal gt lt Alignment ss Vertical Bottom gt lt NumberFormat s s Format mmm -yy gt lt NumberFormat ss Format amp quot amp quot , 0.00 gt lt Worksheet ss...
updateXML and NULL Values
UpdateXML treats NULL values by mapping them to non-existent attribute, element, or text values. For instance if you update node, ' empno text ' with a NULL value, it is treated as if element empno is being removed. Setting an attribute to NULL removes the attribute. There are exceptions to this. The section, NULL Updates When Object Types Are Generated by XML Schema Registration on page 4-36 discusses this further. In this case, when you update an element and pass a NULL value to it, the...
XMLSEQUENCE Function
The XMLSequence function has two forms The first form inputs an XMLType instance and returns a VARRAY of top-level nodes. This form can be used to shred XML fragments into multiple rows. The second form takes as input a REFCURSOR argument, with an optional instance of the XMLFormat object and returns the varray of XMLTypes corresponding to each row of the cursor. This form can be used to construct XMLType instances from arbitrary SQL queries. Note that in this release, this use of XMLFormat...
Retrieving the XML Data Type Column from Client
This section focuses on the out-of-process access to the XML data type from a client ASP.NET page. There are different ways to retrieve an XML data typed column using a SqlDataReader object. Using the methods of the SqlDataReader class, you can retrieve the XML data either as a string or as an SqlXml object. The next section starts by exploring the steps involved in retrieving the contents of an XML column as a string. Retrieving the XML Data Type Column as a String Listing 10-4 retrieves the...
WebConfigurationManager Class
One of the important configuration-related classes is the WebConfigurationManager class that provides programmatic access to configuration files and configuration sections. This class is contained in the System.Web.Configuration namespace and is specifically used for retrieving and updating configuration settings from a web.config file. Table 14-3 discusses the properties of the WebConfigurationManager class. Table 14-3. Properties of the WebConfigurationManager Class Table 14-3. Properties of...
Creating XMLenabled Web pages
All this XML versatility does require just a little extra tweaking Your content that is, the data is separate from its context the way you present it in XML documents. That means you have to add some formatting information if you want to display more than just raw XML markup on a Web page. When it comes to actually adding formatting information, you have a couple of options. You can link an XML document to a CSS Cascading Style Sheets stylesheet which would hopefully make the information easier...




