Archive for November, 2006
Using XMS: It really is this simple!
November 27, 2006
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);
}
}
}
}
Hello world!
November 13, 2006Hi, 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.
