Tag Archive for: xpath

XPath & XQuery Tutorial for SQL Pros (Video)


Prior to starting at Altova I had zero experience with both XPath and XQuery. The first task I was presented with was to train myself on both query languages as quickly as possible and produce a concise video that would serve as an XPath tutorial and XQuery tutorial. It was important to develop a thorough understanding of their features and capabilities because both languages are integral to app development in MobileTogether and querying data in XMLSpy. I started with a strong background in SQL, learning XPath and XQuery by building queries first in SQL, and then determining how to replicate them in both query languages.

Read more…

Tags: , , , , ,

XML Grid Gets a Makeover


If you’ve worked with XML in XMLSpy you’ve likely utilized XML Grid View to get a graphical representation of your XML document’s structure. This visual representation of the document’s hierarchical structure makes it immediately easier to understand and edit the content.

In the latest version of the XML editor, XML Grid looks a little different – in fact, it’s been completely rebuilt from scratch to offer even more unique functionality for editing, querying, calculating, and sharing XML data.

Learn about XML Grid in XMLSpy
Read more…
Tags: , , , ,

Build Advanced XML Reports with New XPath Debugger


Altova StyleVision is a unique, easy-to-use tool for creating business reports using a drag-and-drop visual design interface. StyleVision lets you build reports for XML as well as database and XBRL sources. Each design you create can be automated for recurring reporting to HTML, PDF and Word, either using the auto-generated XSLT stylesheet or via StyleVision Server.

Integral to XSLT stylesheet design is XPath for selecting and calculating data, as well as defining styling rules, in your report. New features added to StyleVision include an XPath debugger that makes testing and perfecting your report easier than ever. Let’s see how it works.

Developer working from home
Read more…
Tags: , , , , , , ,

3 Ways XML Text View Just Got Better


Though XMLSpy includes a helpful Grid View for visual editing, Text View remains the most popular pane for developers using the XML editor. Intelligent XML editing functionality helps make the job easier, and we’re continuously adding functionality to the XMLSpy Text View to facilitate this.

Let’s look at some new functionality XML developers will have at their disposal starting with Release 3 of XMLSpy 2017.

XML developer

Read more…

Tags: , , ,

New Features for Mobile Development


The latest version of MobileTogether is available today, adding even more functionality to this game-changing framework for building and deploying native mobile apps faster than any other solution.

To start with, we’ve completely revised the pricing for MobileTogether, with a new model that’s simple to understand and ridiculously affordable.

In addition, Version 2.1 introduces over 30 important new features added based on real-world developer feedback, from new functionality for building tables, to sophisticated error handling actions, to flexible options for beautiful UI design.

Let’s take a look at how these new features combine to let you build the most sophisticated data-centric apps for iOS, Android, and Windows devices.

MobileTogether 2.1 announcement

Read more…

Tags: , , , , ,

How to Debug XPath and XQuery Expressions


XPath and XQuery are powerful functional programming languages for selecting and querying data in desktop or mobile applications – and, in fact, XQuery was added to the TIOBE Index in early 2016.

When you’re writing XPath and XQuery statements, it’s vital to ensure your expressions return the desired results, and this can be a frustrating process of trial and error. The XPath / XQuery Debugger in XMLSpy makes it easy to test and troubleshoot your code, in the very same window where you’re developing your expressions.

XPath/XQuery Debugger

Read more…

Tags: , , , ,

Five Not-to-Miss Features in Altova’s Latest Product Release


I’m excited to reveal some details of today’s Release 2 of Altova MissionKit 2016 desktop developer tools and software products!

v2016r2 introduces over 20 new features and updates to the Altova product line – but that’s a lot to cover in one blog post. Let’s take a look at the top five that are sure to blow your socks off.

New in Altova products

Read more…

Tags: , , , , ,

XPath Editor and Tester (Video)


Writing XPath expressions is an important skill for any developer – whether they are for an XSLT stylesheet, complex XQuery instruction, or even selecting data in a mobile application. And while XPath syntax is simple by nature, it’s also powerful, and writing and debugging the most efficient expression to select exactly the data you need can be a challenge.

This quick video demonstrates some of the tools in the XMLSpy XPath editor that make developing and testing XPath, as well as XQuery, easier. By using a point and click interface for interactive, incremental expression building, you’ll get what you need faster and with less frustration.

To learn more about XPath, check out these free resources:

Tags: ,

New Online Training for XPath 3.0


We are happy to introduce our latest online training course offering a comprehensive look at XPath 3.0. This course is available free-of-charge, in a self-paced and straightforward format. With interactive examples it’s easy to learn new material, and you can even download sample files to experiment writing your own XPath expressions as you go. It is perfect for those who are new to XPath or experienced users looking to learn about the added features in Version 3.0.

XPath training

Let’s take a look at what you’ll learn in the free XPath Training course.  

Read more…

Tags: , , ,

Innovative New XPath/XQuery Tools


Support for XPath and XQuery in XMLSpy got a major boost with Release 3 of Version 2015. In addition to adding support for the latest standards versions – XPath 3.1 and XQuery 3.1 – we’ve added innovative new tools for developing and testing XPath and XQuery expressions in the XPath/XQuery window.

These new tools make it much faster to develop, evaluate, and refine expressions and statements before adding them to larger XSLT or XQuery documents. This will save you time and frustration – because you can understand how each operator or function works and ensure that your expressions return the desired results immediately. I found the function descriptions and entry helpers especially helpful for learning how the new maps and arrays features in XPath/XQuery 3.1 are implemented.

XPath and XQuery Tools

Read more…

Tags: , ,

New Support for XPath/XQuery 3.1, WS-Security, and More Debut in R3


Release 3 of the Version 2015 Altova MissionKit desktop developer tools and Altova server software products is now available with updated standards support, customer requested features, and innovative new functionality that will save you time on everything from XPath and XQuery development, to advanced data mapping, to XBRL report rendering and beyond. You can skip right to the good stuff and upgrade now, or click Read More below for all the details.
clip_image005

Read more…

Tags: , , , , , , , , , , ,

A Cross-Platform Simulator for Enterprise Mobile App Development


In the past it was difficult and time consuming to synchronize development of cross-platform mobile enterprise applications because each mobile operating system required a different tool set or unique steps to build a compiled result.

Altova MobileTogether simplifies and accelerates cross-platform mobile development with the MobileTogether Designer. Using MobileTogether, developers create a single Solution file for Android, iOS, Windows Phone 8, Windows 8, and in HTML-5 browsers on other platforms.

Even better, the MobileTogether Designer includes a Simulator window that lets developers instantly execute the Solution to test logic, view the design as it will appear on a variety of devices, and examine changes in workflow data during execution.

Here is a view of the BizBudget example Solution as seen in the Simulator representations for iOS and Android devices:

MobileTogether Simulator showing iOS and Android devices

Both views were generated from the same solution file, simply by changing the simulation preview device.
Read more…

Tags: , , , , ,

XPath Expressions for Data Reporting


In our earlier post titled Use XPath Expressions to Refine Data Selection, we described how to use XMLSpy to develop an XPath expression to select one table of data contained in a much larger data set provided by the US Department of Education.

An HTML report based on XPath data selection in StyleVision

We can reuse the work in XMLSpy to quickly create a StyleVision design for a report or an e-Form to communicate highlights from the data.
Read more…

Tags: , , , , ,

Use XPath Expressions to Refine Data Selection


In this era of big data we often need to simplify analysis and communication by creating customized views into sections of a larger file. XPath, short for XML Path Language, is designed to allow users to address parts of large XML documents. XMLSpy supports XPath with an XPath Analyzer window and in its interface for charting XML data, MapForce supports XPath functions for XML data mapping, and StyleVision supports XPath in conditional templates, extension templates, and template filtering.

faces-laptop

Read more…

Tags: , , , , ,

Using Table Row and Column Conditions in StyleVision 2013


The ability to conditionally hide table rows or columns has been a popular feature request from StyleVision users. StyleVision 2013 adds the capability in the form of conditional expressions on table rows and columns. Conditional processing can be set on individual columns and rows of static and dynamic tables, as well as on column and row headers, to display or hide the column, row, or header depending on the truth of the condition. The conditions are specified using StyleVision’s XPath Expression editor. If a condition evaluates to true, the column, row, or header is displayed; otherwise it is not (i.e., is hidden).

StyleVision 2013 Edit XPath Expression dialog

Let’s take a look at some scenarios for which this new feature is exceptionally useful.

Read more…

Tags: , ,

XPath Enhances XML Reports


In our previous post on Creating Elegant Reports for GPS XML Data we used an XPath expression to select nodes from an XML document for an elevation line chart. You can also use XPath to compute values. Altova StyleVision includes strong support for XPath, and we can write XPath expressions to add interesting information to our GPS XML reports. For instance, we can process the elevation data stored by the GPS device in meters to plot a chart showing the elevation in feet above sea level instead.

Altova StyleVision line chart

Read more…

Tags: , , ,

New! XSLT Technology Training


We’re excited to introduce our new XSLT Technology training as the latest Altova Online Training offering. As with all our trainings, XSLT Technology is released as a free, self-paced course, available online, so students can fit it into their busy schedules.

XSLT transforms XML data into other formats, and this course will transform a beginner XML student into an advanced user. Intermediate and advanced students will gain valuable techniques to add to their XML toolkits.

clip_image002

Read more…

Tags: , , , , , , , , ,

Processing the Groupon API – Part 3


Concluding the series in this post, we will apply a stylesheet to transform the XML data created from our mapping of the Groupon API into HTML. Here is an example of the XML output from the data mapping we created last time: XML produced by MapForce from the Groupon API

Assign a Stylesheet to Transform XML The Component Settings dialog for the output component of the MapForce mapping allows us to assign a stylesheet created with Altova StyleVision.

Assigning a StyleVision Stylesheet to a MapForce component
Assigning a stylesheet to the data mapping output component integrates the operations of MapForce and StyleVision, and a new series of buttons appears at the bottom of the MapForce mapping window for HTML, RTF, PDF, and Microsoft Word formats. (You must have both MapForce and StyleVision installed on your computer.) MapForce ouput formats available through a stylesheet When you click any of these output format buttons, MapForce executes the data mapping exactly as we saw in the previous post. MapForce seamlessly passes the XML output to StyleVision, where it is transformed to the selected format. MapForce then displays the formatted document in the Output window. Here is the MapForce Output window for HTML, based on the StyleVision Power Stylesheet assigned above: HTML output produced by MapForce from the Groupon API The MapForce Output menu lets you save the XML data mapping output or the HTML document formatted according to the stylesheet. How to Make a Stylesheet We designed a stylesheet for the Groupon API data mapping using Altova StyleVision, based on the XML Schema for the MapForce output component. The intuitive StyleVision interface and powerful data access and manipulation features make it easy to create attractive documents in HTML, RTF, PDF, and Microsoft Word formats from XML files. The screenshot below shows the StyleVision Design View of the Extreme Groupon stylesheet. The blue numbered circles identify the location of each design feature listed following the image. StyleVision stylesheet for the MapForce Groupon API mapping Features of the SPS file

  1. User-defined html specifies the viewport meta tag for mobile devices. This lets us design one stylesheet to generate a single HTML file for computers and mobile devices
  2. Document title with customized font, size, and color
  3. An autocalc element uses the XPath count function to count the number of deals in the XML input document and inserts the total
  4. The date timestamp is placed at the top of the document even though the date element occurs at the end of the XML input data file
  5. Images from the Altova and Groupon Web sites are referenced by hyperlinks, not as inline image data
  6. Horizontal rules set off each individual deal. For HTML documents, the rules automatically fit the browser window width
  7. Customized fonts and sizes assigned to different elements
  8. A two-column table organizes each deal description
  9. URLs in the XML file are dynamically assigned as hyperlinks for embedded images, fixed text, and dynamic data

StyleVision Power Stylesheets can combine multiple .xsd files, existing .css stylesheets, database schemas, XBRL taxonomies, and more to produce richly formatted reports that can even include automatically generated charts in various styles. You can also use StyleVision to define e-forms with data entry fields, drop down menus, radio buttons and other advanced features. Previewing Stylesheet Transformations StyleVision lets you assign a working XML file to preview your output as you design the stylesheet, and the buttons along the bottom of the Design window make it convenient to display the formatted working file as you refine your design. We saved the XML output of the MapForce mapping and assigned it as our working document. When the stylesheet was complete, the HTML Preview in StyleVision was identical to the MapForce HTML Output window shown above. To view the document on a mobile device you can either deploy the HTML as a page on a Web site or email it as an attachment. HTML version of the MapForce mapped data on a mobile device In addition to the stylesheet itself and formatted versions of the working document, StyleVision lets you save generated XSLT files to transform other XML files using your stylesheet design outside the StyleVision application. Automation Next Time In the future when you want to re-run a data mapping and refresh the HTML document with up to date data, there are two ways to automate the process:

  • You can run MapForce from a command line with parameters to name the mapping definition file and even call StyleVision to create formatted output
  • You can generate royalty-free code for the mapping in XSLT, Java, C++, or C# to combine with the XSLT code from StyleVision to build your own end-to-end application

XMLSpy, MapForce, and StyleVision are all available together in the specially priced Altova MissionKit. See for yourself how easy it is to use the MissionKit to convert data from a Web API — download a free 30-day trial!
Editor’s Note: Our original series on mapping data from the Groupon API ran in three parts you can see by clicking the links here: Part 1 of Processing the Groupon API with Altova MapForce describes how to create dynamic input by collecting data from multiple URLs. Processing the Groupon API with MapForce – Part 2 describes how we filtered data from the API and defined the output to extract only the most interesting details. Processing the Groupon API – Part 3 describes formatting the output as a single HTML document optimized for desktop and mobile devices, and reviews ways to automate repeat execution.

Tags: , , , , , , , ,

Use Built-In XPath Functions


In developing one of the Altova Online Training courses, I sorted a list of books by the authors. I realized that my author field was a string of the author’s full name, so the books were sorted by the first letter of the string, or the author’s first name. It did not fit into the course to fix the sorting, but you can easily extract the last name from a string and use it for the sorting key using XPath functions. If you then use the books’ titles for a secondary sort key, you run into an issue with titles that start with “A”, “An”, or “The”. I want to use the title for the secondary sort key, but ignore a leading definite or indefinite article.Output the book list with a  sort corrected using XPath expressions Let’s take a look at how we created this XSLT code.

This article was written using XMLSpy as the platform, but the same XPath expressions can be used inside MapForce or StyleVision to achieve similar results. We can start with a simple XML book list. We have 4 books with author and title nodes. List of three books An XSLT to create a list of the books would look like this: Output the book list without a sort This will generate the following output: Unsorted Book List The books are output in the order they appear in the original data file. If we add xsl:sort to the xsl:for-each loop, we can arrange our output in other ways. Output the book list with a basic sort This will generate a sorted list, but not sorted properly. Output from XSL with Basic Sort Sorting author as a string, results in “Jules Verne” appearing ahead of “Mark Twain”. Also, “A Connecticut Yankee in King Arthur’s Court” appears ahead of “Adventures of Huckleberry Finn”. We want to ignore the indefinite article, “A”, so that “Adventures of Huckleberry Finn” appears ahead of “A Connecticut Yankee in King Arthur’s Court”. We can use XPath expressions to extract the sorting keys we want. Output the book list with a  sort corrected using XPath expressions Let’s examine the code before we look at the output. We replace “author” with “reverse(tokenize(author, ‘ ‘))[1]”. Tokenize breaks the author string into tokens using a single white space as the break point. So, “Jules Verne” is tokenized into “Jules” and “Verne”. Reverse reverses the order of the tokens to “Verne” and “Jules”. The one in square brackets chooses the first item in the list, “Verne”. This is the value that is used in for the xsl:sort function to arrange the books. This is not the perfect solution, but it works in our case. The title looks convoluted, but the logic is straightforward. The “tokenize(title,’ ‘)[1]” expression extracts the first word of the title. So, the first if test is “Is the first word of the title the word “A”? “. If it is, then we return the substring of the title that starts with its third letter, thus eliminating “A” and the space. If the first word of the title is not “A”, then we need to test it again to see if the first word of the title is “The”. If it is, we use the substring of the title starting with its fifth character, thus eliminating “The” and a space. If we fail both tests, then we just pass the title along as the sorting key. We could add another test to our code to see if the first word is “An”, but it is not needed for this data set. Executing this last XSLT, we get the following output. Output from XSL with Corrected Sort “Mark Twain” is now ahead of “Jules Verne”. “Adventures of Huckleberry Finn” appears ahead of “The Celebrated Jumping Frog of Calaveras County” and “A Connecticut Yankee in King Arthur’s Court”. The flaw in our approach to the author string is that we want “Jules Verne” to be treated as “Verne, Jules” for the sort, so that if we had a book by “Jimmy Verne”, the sort would treat them as different authors. Our code does not. Using “concat(reverse(tokenize(author, ‘ ‘))[1], reverse(tokenize(author, ‘ ‘))[2])” would sort “Jules Verne” and “Jimmy Verne” correctly, but this solution only will work with 2 word names. If an author had a suffix (“Martin Luther King, Jr.”) or multiple words (“George Herbert Walker Bush”), the code would fail. There are many exceptions to the general rules on alphabetizing names, and the code to allow for all variants goes far beyond the scope of this article. What we wanted to show was the ability to manipulate XML data on the fly using XPath expressions. We do not always have complete control on the format of our data sources, but using the power of XPath expressions, we can transform the data into the format that we need. A copy of the files used in these examples is available here.

Tags: , , , , , , , ,

Exploring Large XML/XBRL Documents with XMLSpy


Last week, while giving a demo of the new XBRL capabilities in the Altova MissionKit, we stumbled across an interesting question: What is the best way for a semi-technical SME (in this case a CPA) to navigate a large XML/XBRL document for data entry? XMLSpy, which is included in the MissionKit tool suite, has a lot of cool features and different views for XML data, including the ever-popular grid view for visualizing the hierarchical structure of an instance document in a graphical manner. The ability to easily expand and collapse containers and drag and drop to change position makes XMLSpy’s grid view a pretty good choice for the task.  XMLSpy grid view Of course let’s not forget that the XMLSpy XML editor also has a Find feature that would enable users to simply press Ctrl F or use the Find in Files window to find any element that they are looking for… but alas, in the case of XBRL, where element names are mindbogglingly verbose, this may be a challenge. Consider, for example, the US-GAAP’s aptly named <us-gaap:IncomeLossFromContinuingOperationsBeforeIncomeTaxesMinorityInterestAnd IncomeLossFromEquityMethodInvestments>. Not so much fun to type into a Find dialog… Our solution, therefore, and the winner for the easiest and most comprehensive way for even a non-technical user to find XML elements in a large document, utilizes a combination of longstanding XMLSpy features (the XPath Analyzer window) and a new feature in XMLSpy v2009, XPath auto-completion. Simply begin typing the element name in the XPath Analyzer window, and XMLSpy will show you all of the possibilities. Next, choose the one you are looking for, and XMLSpy will navigate directly to that node in the XML document.   xpath auto-completion in XMLSpy   Now that was easy! And better yet, you get to tell your friends that you know XPath. 😉 Of course, for developers, intelligent XPath auto-completion provides a lot more than the ability to find a node quickly. As you type, it provides you with valid XPath functions, as well as element and attribute names from the associated schema and XML instance(s). XMLSpy accounts for namespaces when listing options and even provides deep path suggestions when the required node is not in close proximity to the current context. XMLSpy is available standalone or as part of the award-winning MissionKit tool suite.

Tags: , , ,

What's New in XMLSpy 2009?


In addition to being tremendously useful, some of the new features in XMLSpy 2009 are just plain cool. The complete list of new functionality includes:

  • Support for XBRL 2.1 and XBRL Dimensions 1.0  
  • XBRL Taxonomy Editor
  • XPath auto-completion 
  • Native support for additional databases 
  • Support for XML fields in SQL Server
  • Extensions for identity constraints editing in Schema View 
  • Expanded source control system support
  • Support for the XSLT extension altova:evaluate  
  • Support for Apache FOP 0.95  

We’ve already blogged quite a bit about the first two items on the list: support for XBRL validation and XBRL taxonomy editing. Some more details on the other new features are below.

Intelligent XPath Auto-Completion

We’ve been delighted to receive feedback from customers who are really excited about this new feature. If you’re developing XSLT or XQuery, writing XPath expressions just got a lot easier. As you’re composing an XPath expression in Text View, Grid View, or the XPath Analyzer, XMLSpy now provides you with valid XPath functions, as well as element and attribute names from the associated schema and XML instance(s). XMLSpy’s intelligent XPath auto-completion accounts for namespaces when listing options and even provides deep path suggestions when the required node is not in close proximity to the current context. XPath auto-completion  

Native Support for Additional Databases

XMLSpy 2009 adds new native support for the latest versions of SQL Server and Oracle, and brand new support for PostgreSQL. Support for DBs in XMLSpy allows you to generate an XML Schema based on a database, import and export data based on database structures, and generate relational database structures from XML Schemas, and so on. The built-in Database Query window lets you perform queries against the database and edit the data. Here’s the complete list of databases with native support in XMLSpy:

  • Microsoft® SQL Server® 2000, 2005, 2008
  • IBM DB2® 8, 9
  • IBM DB2 for iSeries® v5.4
  • IBM DB2 for zSeries® 8, 9
  • Oracle® 9i, 10g, 11g
  • Sybase® 12
  • MySQL® 4, 5
  • PostgreSQL 8
  • Microsoft Access™ 2003, 2007

SQL Server support has also been enhanced to allow viewing and editing of XML fields that are stored in the database.

Extensions for Identity Constraint Editing in Schema View

Configuring identity constraints (i.e., key/keyref/unique values) is an important aspect of XML Schema development, especially for database users. Adding to existing support for editing these identity constraints, there are now enhanced visual cues and editing options in XMLSpy 2009. A new tab Identity Constraints tab in the Components entry helper window displays all existing constraints in a tree view and allows you to easily modify or create new relationships. Furthermore, identity constraints are now indicated by green lines, informative icons, and mouse-over messages in the Content Model View. A right-click menu allows you to easily add new relationships and specify field and selector values by typing them manually, using drop-down entry helpers, or by simply dragging and dropping the desired nodes. Schema identity constraints

Expanded Source Control System Support

Based on customer feedback, we’ve completely reworked the source control system interface in XMLSpy and also added the same level of source control support to UModel, our UML modeling tool, allowing both products to intelligently integrate with all major SCM tools. Once a project is bound to a version control system, XMLSpy automatically monitors the status of all files and prompts the you to check out a file whenever you starts to modify the document. In addition, the actual state of each file is shown through checkmarks or locks in the upper right corner of each file icon.   What do you think of these new features? What would you like to see added to the next version of XMLSpy? Let us know by commenting below.

Tags: , , , , ,