Xpriori has updated it’s web site! Check it out here -> Xpriori
To download version 4 of XMS look for the Developers label on the home page and the “Download XMS” link.
Xpriori has updated it’s web site! Check it out here -> Xpriori
To download version 4 of XMS look for the Developers label on the home page and the “Download XMS” link.
XMS makes it easy to search for a sub-string within a node.
By adding asterisks around an XPath search string, XMS will look
through the entire node looking to match the sub-string.
For example using the XML nodes below, the XPath expression:
/ND/Catalog/CD[Company=*'Records'*]
will return both the first and last nodes.
Happy Searching!
Retrieval of XML data using XMS
As in the storage example, the retrieval of XML data is centered
Around these three lines of code
// create and execute XML Query command
thisXMSCmd = new XmsCommand(“query”, thisXMSCon);
thisXMSCmd.Parameters.Add(“query”, mySB.ToString());
thisXMSCmd.ExecuteNonQuery();
where mySB contains an XPath query. In this instance
the XPath query is
/ND/StaffingOrganization[Organization/OrganizationId/IdValue='333-99-1234']
and will work with the XML store in the ‘Using XMS: It really is this simple’
Here’s all the code, Have Fun!
using System;
using System.Text;
using System.Data;
using Xpriori.XmsDataProvider;
namespace RetrieveXMLConApp.cs
{
/// <summary>
/// Summary description for RetrieveXMLCon.
/// </summary>
public class RetrieveXMLCon
{
static XmsConnection thisXMSCon;
static XmsCommand thisXMSCmd = null;
static void Main(string[] args)
{
try
{
// get a connection to XMS at “localhost” on default port 7700
thisXMSCon = new XmsConnection(“localhost;7700;” + “Administrator” + “;” + “password”);
if ( thisXMSCon != null )
{
thisXMSCon.Open();
if( thisXMSCon.State == ConnectionState.Open )
{
// create an XML String to store
StringBuilder mySB = new StringBuilder(“”);
mySB.Append(“/ND/StaffingOrganization[Organization/OrganizationId/IdValue='333-99-1234']“);
// create and execute XML Query command
thisXMSCmd = new XmsCommand(“query”, thisXMSCon);
thisXMSCmd.Parameters.Add(“query”, mySB.ToString());
thisXMSCmd.ExecuteNonQuery();
// output results to console
Console.WriteLine(thisXMSCmd.Results);
Console.WriteLine(“”);
// close the XMS connection
thisXMSCon.Close();
}
}
else
{
Console.WriteLine(“Invalid UserName or Password or XMS is not started”);
}
Console.WriteLine(“Application Exiting”);
Console.WriteLine(“”);
}
catch (ApplicationException ex)
{
String msg = “Application error:” + ex.Message;
Console.WriteLine(msg);
}
}
}
}
Storage of XML data using XMS.
XMS is able to receive any well-formed XML document you want to throw at it, at any time. The following code example demonstrates this capability. The center of the example is three lines of code.
thisXMSCmd = new XmsCommand(“storestring”, thisXMSCon);
thisXMSCmd.Parameters.Add(“xml”, mySB.ToString());
thisXMSCmd.ExecuteNonQuery();
First, ‘XmsCommand’ creates an XMS command to store a string formatted with XML data. Next, ‘Parameters.Add’ attaches the XML string to the XmsCommand. And finally, ‘ExexuteNonQuery’ sends the XML data into the XMS database.
The key here is that XMS takes advantage of the XML’s self describing nature to store the XML with out first having to construct a database table or define the table’s columns.
To run this example, download XMS
and the XMS.NET API 2
Be sure to create a reference to the XMSDataProvider located at:
“C:\Program Files\Xpriori\XMS.NET API V2.0\XMSCSharpTestApplication\XmsDataAdapter.dll”
and change “YourAdminPassword” to the Administrators Password.
If you have any question don’t hesitate to Email me at dspalding@xpriori.com
The example is from HR-XML StaffingOrganization.xml
XMS Store XML Example
using System;
using System.Text;
using System.Data;
using Xpriori.XmsDataProvider;
namespace StoreXMLConApp
{
/// <summary>
/// Summary description for StoreXMLCon.
/// </summary>
public class StoreXMLCon
{
static XmsConnection thisXMSCon;
static XmsCommand thisXMSCmd = null;
static void Main(string[] args)
{
try
{
// get a connection to XMS at “localhost” on default port 7700
thisXMSCon = new XmsConnection(“localhost;7700;” + “Administrator” + “;” + “yourAdminPassword”);
if ( thisXMSCon != null )
{
thisXMSCon.Open();
if( thisXMSCon.State == ConnectionState.Open )
{
// create an XML String to store
StringBuilder mySB = new StringBuilder(“”);
mySB.Append(“<StaffingOrganization typeOfOrganization=’Customer’ xml:lang=’en-us’>”);
mySB.Append(“ <Organization>”);
mySB.Append(“ <OrganizationName>Joe Ricci Restaurant</OrganizationName>”);
mySB.Append(“ <OrganizationId>”);
mySB.Append(“ <IdValue>333-99-1234</IdValue>”);
mySB.Append(“ </OrganizationId>”);
mySB.Append(“ </Organization>”);
mySB.Append(“</StaffingOrganization>”);
// create and execute XML storestring command
thisXMSCmd = new XmsCommand(“storestring”, thisXMSCon);
thisXMSCmd.Parameters.Add(“xml”, mySB.ToString());
thisXMSCmd.ExecuteNonQuery();
// output results to console
Console.WriteLine(thisXMSCmd.Results);
Console.WriteLine(“”);
// close the XMS connection
thisXMSCon.Close();
}
}
else
{
Console.WriteLine(“Invalid UserName or Password or XMS is not started”);
}
Console.WriteLine(“Application Exiting”);
Console.WriteLine(“”);
}
catch (ApplicationException ex)
{
String msg = “Application error:” + ex.Message;
Console.WriteLine(msg);
}
}
}
}
Hi, my name is Dan Spalding and I have recently joined the team at Xpriori. This is a product blog focused on Xpriori’s XMS, a fully functional native XML database. As a product blog its purpose is as follows (as summarized by betterbusinessblogging):
· continuously gather customer feedback;
· make it a point to share knowledge freely;
· expertly build word of mouth networks;
· encourage communities of customers to meet and share;
· devise specialized, smaller offerings to get customers to bite;
· focus on making the world, or your industry, better.
Please join me in this effort to extend the power and potential of XML by effectively using a fully supported and continuously evolving native XML database.