Home > Articles > Web Services > XML

This chapter is from the book

.NET's XML Architecture

.NET's core XML architecture (at least, as of Beta 2) is as you see it in Figure 3.4. This is slightly different than it was for Beta 1, in which the XPathNavigator in Figure 3.4 was called XmlNavigator. The basic layout is somewhat the same, however.

Figure 3.4 .NET's core XML architecture.

The main XML class that you'll use here is XPathNavigator. With this class, you can move through the XML document, using movement commands such as MoveToNext() and MoveToFirstChild(). Or, as the name suggests, you can provide the XPathNavigator an XPath query, and it will return to you an iterator that represents the nodeset returned from the query. Although it isn't discussed here, you have XML DOM Level 2 support using XmlDocument. We won't use XmlDocument here because we'll be primarily interested in XPath queries, and XPathDocument is optimized for quick searches. It might be helpful to know that XmlDocument exists if you're used to working with the XML DOM. However, we will be interested in using other .NET XML classes, starting with the .NET class that enables you to read XML data from a stream.

Reading XML Data

If you have an XML file on disk, XPathNavigator will accept the file's filename and path, and will happily load the file for processing. .NET, however, is stream-based, so it might not be surprising to find that .NET has an XML class designed for reading XML streams. This class is XmlReader, and if you have a stream that you know represents XML data, you can wrap that stream with a reader and it will manage movement through the stream in an XML-friendly fashion.

To see XmlReader in action, let's simulate the file read that XPathNavigator performs when loading XML data. Imagine that you have an XML file called Activities.xml. To load this file into .NET, and to demonstrate XmlReader, you would use this code:

FileStream fstmActivities =
                 new FileStream("Activities.xml",FileMode.Open);
XmlTextReader xrdActivities = new XmlTextReader(fstmActivities);

Note that XmlReader is an abstract class; you don't use it directly. Instead, you use a class derived from XmlReader, such as XmlTextReader. And although you could load the file directly into XmlTextReader, the stream-based constructor was used in this brief example simply because that's how you'll accept the SOAP information from .NET when processing a SoapExtension.

XmlReader gives you a fast, forward-only XML data stream. XmlTextReader is ideal for quickly determining whether your XML document is well-formed and allowing you to progress through the document. You'll see an example of XmlTextReader in action in the next section, "Writing XML Data."

Writing XML Data

If there is a .NET XmlReader, then there probably should be an equivalent writer. In fact, there is—not surprisingly, its class name is XmlWriter. And, like XmlReader, XmlWriter is an abstract class that must be implemented in a derived class. For XmlWriter, the only class provided by .NET for this is XmlTextWriter.

XmlTextWriter also accepts a stream in its constructor, and it is to this stream that XmlTextWriter will write the XML that is created or otherwise slated for output. Listing 3.2 shows both XmlTextReader and XmlTextWriter in action.

Listing 3.2  Reading and Writing XML Data Using .NET Framework Classes

using System;
using System.IO;
using System.Text;
using System.Xml;

namespace RdrWtr
{
   /// <summary>
   /// Summary description for Class1.
   /// </summary>
   class Class1
   {
      static void Main(string[] args)
      {
         try
         {
            // Create a file stream
            FileStream fstmXmlOut = new FileStream("MyXML.xml",
                                                   FileMode.Create);
                                                   
            // Create an encoding
            UTF8Encoding objEncoding = new UTF8Encoding();
            
            // Create an XML text writer
            XmlTextWriter objXmlWriter =
                           new XmlTextWriter(fstmXmlOut,objEncoding);
                           
            // Create some XML
            objXmlWriter.WriteStartDocument();
            objXmlWriter.WriteStartElement("m",
                                           "Employees",
                                           "http://www.myurl.com");
            objXmlWriter.WriteAttributeString("xmlns",
                                              "m",
                                              null,
                                              "http://www.myurl.com");
                                              
            // Write an employee element
            objXmlWriter.WriteStartElement("m",
                                           "Employee",
                                           "http://www.myurl.com");
            objXmlWriter.WriteStartAttribute("m",
                                             "id",
                                             "http://www.myurl.com");
            objXmlWriter.WriteString("175-A15");
            objXmlWriter.WriteEndAttribute();
            objXmlWriter.WriteStartElement("m",
                                           "Name",
                                           "http://www.myurl.com");
            objXmlWriter.WriteString("Kenn Scribner");
            objXmlWriter.WriteEndElement(); // Name
            objXmlWriter.WriteStartElement("m",
                                           "Title",
                                           "http://www.myurl.com");
            objXmlWriter.WriteString("Code Gecko");
            objXmlWriter.WriteEndElement(); // Title
            objXmlWriter.WriteEndElement(); // Employee
            
            // Write another employee element
            objXmlWriter.WriteStartElement("m",
                                           "Employee",
                                           "http://www.myurl.com");
            objXmlWriter.WriteStartAttribute("m",
                                             "id",
                                             "http://www.myurl.com");
            objXmlWriter.WriteString("129-B68");
            objXmlWriter.WriteEndAttribute();
            objXmlWriter.WriteStartElement("m",
                                           "Name",
                                           "http://www.myurl.com");
            objXmlWriter.WriteString("Mark Stiver");
            objXmlWriter.WriteEndElement(); // Name
            objXmlWriter.WriteStartElement("m",
                                           "Title",
                                           "http://www.myurl.com");
            objXmlWriter.WriteString("Code Godzilla");
            objXmlWriter.WriteEndElement(); // Title
            objXmlWriter.WriteEndElement(); // Employee
            
            // Finish off the document
            objXmlWriter.WriteEndElement(); // Employees
            
            // Flush it to the file
            objXmlWriter.Flush();
            objXmlWriter.Close();
            fstmXmlOut.Close();
            
            // Create a file stream
            FileStream fstmXmlIn = new FileStream("MyXML.xml",
                                                  FileMode.Open);
                                                  
            // Create an XML text writer
            XmlTextReader objXmlReader = new XmlTextReader(fstmXmlIn);
            
            while (objXmlReader.Read())
            {
               switch (objXmlReader.NodeType)
               {
                  case XmlNodeType.XmlDeclaration:
                     Console.WriteLine("<?xml version=\"1.0\"?>");
                     break;
                     
                  case XmlNodeType.Element:
                     Pad(objXmlReader.Depth);
                     Console.Write("<{0}", objXmlReader.Name);
                     if ( objXmlReader.HasAttributes )
                     {
                        bool bAttr =
                                 objXmlReader.MoveToFirstAttribute();
                        while ( bAttr )
                        {
                           Console.Write(" {0}=\"{1}\"",
                                         objXmlReader.Name,
                                         objXmlReader.Value);
                           bAttr = objXmlReader.MoveToNextAttribute();
                        } // while
                     } // if
                     Console.WriteLine(">");
                     break;
                     
                     case XmlNodeType.Text:
                        Pad(objXmlReader.Depth);
                        Console.WriteLine(objXmlReader.Value);
                        break;
                        
                     case XmlNodeType.EndElement:
                        Pad(objXmlReader.Depth);
                        Console.WriteLine("</{0}>", objXmlReader.Name);
                        break;
                        
                     default:
                        break;
               } // switch
            } // while
            
            // Close the file
            objXmlReader.Close();
            fstmXmlIn.Close();
         } // try
         catch (Exception ex)
         {
            Console.WriteLine("Exception: {0}\n",ex.Message);
         } // catch
      }
      
      static void Pad(int iDepth)
      {
         for ( int i = 0; i < iDepth; i++ )
         {
            Console.Write("   ");
         } // for
      }
   }
}

As you see in Listing 3.2, we provide XmlTextReader and XmlTextWriter with streams instead of asking them to open the files directly. This is again because you'll be given streams of XML when dealing with SOAP from within .NET in Chapter 6.

Creating XML elements with XmlTextWriter is a simple matter of deciding what type of element to create and then writing the element information to the stream using the XmlTextWriter method that is most appropriate. We used the combination of WriteStartElement(), WriteString(), and WriteEndElement(), but you could have also used WriteElementString() or created entirely different sorts of elements, like those dedicated to a DTD or comment.

After we created the XML file, we read it back into memory and displayed it on the console screen using XmlTextReader. In this case, to format the output in more familiar terms, we determine what type of element XmlTextReader is currently indicating and spit out formatted text accordingly. We treated the start of an element differently than we treated the content or ending element tag, for example.

It's nice having XmlTextReader and XmlTextWriter, but they work at a rather low level when it comes to dealing with XML. Next you'll see how to move up the abstraction hierarchy and work with XML at a slightly higher level.

Navigating XML with .NET

When people who know .NET think of navigating an XML document, they probably think of XPathDocument and XPathNavigator before XmlReader and XmlWriter. This is because these two XPath classes provide you with the capability to deal with the XML document in a couple different ways. First, you can access the XML information using a pull model. That is, you obtain XML information when you request it. Second, you have the option of providing an XPath location step to extract a nodeset, which you access using XPathNodeIterator. In most cases, you'll probably use a combination of the two.

Pulling XML Element Information with .NET

If you are familiar with XML and XML technologies, you've undoubtedly heard of SAX, the Simple API for XML. We even mentioned it earlier in the chapter. SAX is a stream-based approach to reading XML information. You create callback functions that the SAX parser will invoke when it senses information that you're interested in accepting. That is, if you create a callback function for the start of an element tag, SAX will invoke your callback function whenever it reads a starting tag. This is a push model because SAX is shoving XML your way as it encounters the information within the document.

.NET, however, works the other way. .NET provides you with a water fountain instead of a fire hose, and you can sip from the fountain when you want. As you sip (read XML element information), more information is readied for your next request. You pull in more information as you're ready.

The .NET XPath classes expose a window into which you examine the XML. Whenever you're working with these classes, it's important to remember that you are working with only a single XML element at any one time. To work with another XML element, you must move the "window." If you're new to .NET and .NET's XML handling capabilities, this is probably the hardest concept to comprehend. This is most likely because of the nature of the classes—by appearance, you perform an element-based action upon the entire XML document, which at first seems odd.

For example, say that you have an instance of XPathNavigator, which contains an XML document. At first, it seems odd to execute code written like this:

` objXPN is an instance of XPathNavigator that contains
` an XML document
Dim strElementValue As String = objXPN.Value

This seems odd because it isn't apparent that when you ask for the "value" of the XPathNavigator, you're really asking for the value associated with the XML element that the XPathNavigator object is currently referencing (the XML element in the "window"). If you "pull" more data, by executing XPathNavigator's MoveToNext() method, for example, the XML element sitting in the window will change and you'll retrieve the value for that element rather than the initial element.

When you're comfortable with the pull model, however, it makes a lot of sense. With SAX, whenever one of your callback methods is invoked, you must deal with that piece of data then and there. If you want that information cached in any way, you implement the caching. With XPathNavigator, though, the data waits for you. When you're ready for more data, just pull in more data. We'll demonstrate this more graphically in the next section, ".NET and XPath," where you'll learn about retrieving a nodeset using XPath only to recursively examine the nodeset as the results are displayed in a .NET Windows Forms tree view.

.NET and XPath

You've already done the hard work if you've created and debugged the XPath query that you intend to apply to an XML document contained within XPathDocument. To execute the query, you create an instance of the associated XPathNavigator and execute its Select() method. Select() accepts as input the XPath location step as a string and returns in response an instance of XPathIterator. You then use XPathIterator to rummage through the nodeset.

The code that you'll need to perform the XPath query is simply this:

Dim objNodeItr As XPathNodeIterator = _
                           objXPathNav.Select({XPath query text})

Of course, a bit more is involved to set up the objects, but making the Select() call is about all you really need. Given the iterator, you can access all the nodes in the nodeset, extracting data from each as necessary.

To demonstrate this, we created a utility, called XPathExerciser, to write and test XPath queries. A portion of the Windows Forms application is shown in Listing 3.3.

Listing 3.3  XPath Queries Using XPathNavigator

Private Sub cmdQuery_Click(ByVal sender As System.Object, _
                           ByVal e As System.EventArgs) _
                           Handles cmdQuery.Click
   ` Execute the query
   Try
      ` Check for text
      If txtQuery.Text.Length >= 1 Then
         ` Perform the query
         Dim objNodeItr As XPathNodeIterator = _
                           m_objXPathNav.Select(txtQuery.Text)
         If Not objNodeItr Is Nothing Then
            ` Iterate through the nodeset and display in the
            ` tree control
            FillNodesetTree(objNodeItr)
         Else
            ` No nodes to add...
            tvwNodeSet.Nodes.Add("No nodes returned fromXPath query...")
         End If
      End If
   Catch ex As Exception
      ` Show error
      MsgBox(ex.Message, _
             MsgBoxStyle.Critical, _
             "XPath Exerciser Error")
      tvwNodeSet.Nodes.Clear()
      tvwNodeSet.Nodes.Add(New TreeNode("***Error executing XPath query...",
                                        6,
                                        6))
   End Try
End Sub

Private Sub FillNodesetTree(ByVal objNodeItr As XPathNodeIterator)
   ` Clear the tree
   tvwNodeSet.Nodes.Clear()
   
   ` Cut off screen update
   tvwNodeSet.BeginUpdate()
   
   ` Create the root node
   Dim node As TreeNode = New TreeNode("(Context node)", 6, 6)
   tvwNodeSet.Nodes.Add(node)
   
   ` Advance through the nodeset
   While objNodeItr.MoveNext
      AddTreeNode(objNodeItr.Current, node)
   End While
   
   ` Update screen
   tvwNodeSet.EndUpdate()
End Sub

Private Sub AddTreeNode(ByRef objCurrXMLNode As XPathNavigator, _
                        ByRef nodParent As TreeNode)
   Try
      ` Create the new node
      Dim node As TreeNode
      Select Case objCurrXMLNode.NodeType
         Case XPathNodeType.Text
            nodParent.Nodes.Add(New TreeNode(objCurrXMLNode.Name & _
                               "{" & objCurrXMLNode.Value & "}", 2, 2))
            Exit Sub
            
         Case XPathNodeType.Comment
            nodParent.Nodes.Add(New TreeNode(objCurrXMLNode.Name & _
                               "{" & objCurrXMLNode.Value & "}", 4, 4)) 
            Exit Sub
            
         Case XPathNodeType.Attribute
            nodParent.Nodes.Add(New TreeNode(objCurrXMLNode.Name & _
                               "{" & objCurrXMLNode.Value & "}", 3, 3))
            Exit Sub
            
         Case XPathNodeType.Root
            node = New TreeNode("{root}", 1, 1)
            
         Case Else
            node = New TreeNode(objCurrXMLNode.Name, 0, 0)
            
      End Select
      
      ` Add ourselves to the tree
      nodParent.Nodes.Add(node)
      
      ` Look for attributes
      Dim objNodeClone As XPathNavigator
      If objCurrXMLNode.HasAttributes Then
         objNodeClone = objCurrXMLNode.Clone
         objNodeClone.MoveToFirstAttribute()
         AddTreeNode(objNodeClone, node)
         While objNodeClone.MoveToNextAttribute
            AddTreeNode(objNodeClone, node)
         End While
      End If
      
      ` Find children
      objNodeClone = objCurrXMLNode.Clone
      If objNodeClone.HasChildren Then
         objNodeClone.MoveToFirstChild()
         AddTreeNode(objNodeClone, node)
         While objNodeClone.MoveToNext()
            AddTreeNode(objNodeClone, node)
         End While
      End If
   Catch ex As Exception
      ` Show error
      MsgBox(ex.Message, _
             MsgBoxStyle.Critical, _
             "XPath Exerciser Error")
      tvwNodeSet.Nodes.Clear()
      
      tvwNodeSet.Nodes.Add(New TreeNode("***Error executing XPath query...",
                                        6,
                                        6))
                                        

    End Try
End Sub

XPathExerciser enables you to select an XML file against which you want to apply XPath queries. XPathExerciser then displays the file in the Web Browser ActiveX control after you've browsed for your particular XML file. Then, with the file in hand, you type in your XPath query and click the Query button. If things go well, the tree control displays the resulting nodeset. If this operation sounds familiar, it should. As you might remember, the XPathExerciser user interface was presented in Figure 3.2.

What is important to see from Listing 3.3 is the combination of XPath and pull methods, such as MoveToFirstChild() and MoveToNext(). Note also that, given an instance of XPathNavigator, you can recursively read the XML element information and build a tree view.

NOTE

This book was written with the second beta version of Visual Studio .NET and the .NET Framework. As of this second beta, an issue exists with ActiveX and COM interoperability: If the source files were created on the Windows XP operating system (originally called Whistler) and later were transferred to an older version of Windows, the source files will be modified by Visual Studio .NET and the reference to the ActiveX control will be dropped. When Visual Studio .NET drops the ActiveX control, it also drops any sibling controls (controls at the same user interface scope, such as when grouped on a form or group box). Therefore, we have included two versions of XPathExerciser, one for XP and one for other versions of Windows. The executable itself executes without error in either case, and you can mix and match executables at will. Just the source and project files present problems.

.NET and XLink

You might be wondering if special support for XLink is built into the .NET Framework. There is, but it requires a bit of additional overhead.

XPathNavigator has a method, MoveToId(), that is designed to work with id attributes. The additional overhead mentioned is that the id attribute must be explicitly defined in the XML DTD or schema that is associated with your XML document. If you have no DTD or schema, MoveToId() won't work for you. However, you still may use XPath to search for all elements with an id attribute, or even an id attribute containing a specific identifying value.

.NET and XSL

The final general-purpose XML technology we mentioned is XSL, and .NET supports XSL through its XSLTransform class. If you load an XML document into an instance of XPathDocument and then load an XSL style sheet into XSLTransform, you can run the style sheet in this manner:

objXSL.Transform(objXMLDoc,null,objWriter);

Here, objXSL is the XSLTransform instance, objXMLDoc is the XPathDocument, and objWriter is the XmlTextWriter that you'll use to persist the changes.

To provide a useful demonstration of transformations within the .NET Framework, we created the XSLExerciser application, whose user interface you see in Figure 3.5. If you browse for an XML file and an associated style sheet, you can click the XForm button to execute the transform. If you've elected to save the results, the new XML document will be recorded within the file that you specified. You can also view the output either as text or as XML contained within the Web Browser control.

Figure 3.5 The XSLExerciser user interface.

Listing 3.5 shows you how to handle the transform action itself. The code that you see is executed when you click the XForm button. You don't need to load any files until you actually want to perform the transformation, so if you need to adjust the style sheet, as often happens, you can do so easily and retransform the document.

Listing 3.4  XPath Queries Using XPathNavigator

private void cmdXForm_Click(object sender, System.EventArgs e)
{
   try
   {
      // Open the original XML document
      m_objXMLDoc = new XPathDocument(m_strXMLPath);
      
      // Open the stylesheet
      XslTransform objXSL = new XslTransform();
      objXSL.Load(m_strXSLPath);
      
      // Create a stream to contain the results
      m_stmOutput = new MemoryStream();
      
      // Create and overlay an XML writer
      ASCIIEncoding objEncoding = new ASCIIEncoding();
      XmlTextWriter objWriter = new XmlTextWriter(m_stmOutput,
                                                  objEncoding);
                                                  
      // Do the transform
      objXSL.Transform(m_xpdXMLDoc,null,objWriter);
      
      // Save output as a string
      byte[] bytes = m_stmOutput.ToArray(); 
      m_strXMLOutput = objEncoding.GetString(bytes);
      
      // Check to see if we need to save the file...
      if ( optSave.Checked && m_strOutPath.Length > 0 )
      {
         FileStream fstmXMLOut = new FileStream(m_strOutPath,
                                                FileMode.Create);
         m_stmOutput.Position = 0;
         TextReader objTRFrom = new StreamReader(m_stmOutput);
         TextWriter pbjTWTo = new StreamWriter(fstmXMLOut); 
         twTo.WriteLine(trFrom.ReadToEnd());
         twTo.Flush();
         fstmXMLOut.Close();
      } // if
      
      // Close the stream
      m_stmOutput.Close();
      
      // Enable the UI
      cmdView.Enabled = true;
      
      // Show results
      lblResults.ForeColor = SystemColors.ControlText;
      lblResults.Text = "Transformation successful, now click View";
   } // try
   catch (Exception ex)
   {
      // Show results
      lblResults.ForeColor = Color.Red;
      lblResults.Text = "Transformation Unsuccessful";
      
      MessageBox.Show(ex.Message,
                      "XSLExerciser Error",
                      MessageBoxButtons.OK,
                      MessageBoxIcon.Error);
   } // catch
}

A lot of this code you saw previously. One thing that we do differently is to create a memory-based stream, into which we shove the transformed XML:

// Create a stream to contain the results
m_stmOutput = new MemoryStream();

We do this because we then have the transformed XML in one location, ready to display or store into a file.

No single book has everything that you'll need to work with a technology as diverse as XML. However, a few books are well worth examining to gain a bit more detail regarding this fascinating and pliant tool. Unfortunately, as of this printing, no .NET-specific XML books are available, but hopefully this chapter has given you the basics that you'll need to move forward into the .NET world.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020