<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/binary/1.0">
<xsl:output omit-xml-declaration='yes' method='text' indent='yes'/>
<xsl:template match="/llrp:llrpdef">
/*
***************************************************************************
* Copyright 2007 Impinj, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
***************************************************************************
*/
/*
***************************************************************************
*
* This code is generated by Impinj LLRP .Net generator. Modification is not
* recommended.
*
***************************************************************************
*/
/*
***************************************************************************
* File Name: LLRPXmlParser.cs
*
* Version: 1.0
* Author: Impinj
* Organization: Impinj
* Date: Jan. 18, 2008
*
* Description: This file contains general XML parser for LLRP messages
***************************************************************************
*/
using System;
using System.IO;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Runtime.InteropServices;
using LLRP;
using LLRP.DataType;
public class LLRPXmlParser
{
public static void ParseXMLToLLRPMessage(string xmlstr, out object msg, out ENUM_LLRP_MSG_TYPE type)
{
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(xmlstr);
XmlNode node = (XmlNode)xdoc.DocumentElement;
switch(node.Name)
{
<xsl:for-each select="llrp:messageDefinition">
case "<xsl:value-of select="@name"/>":
msg = (object)MSG_<xsl:value-of select="@name"/>.FromString(xmlstr);
type = ENUM_LLRP_MSG_TYPE.<xsl:value-of select="@name"/>;
return;
</xsl:for-each>
default:
msg = null;
type = 0;
return;
}
}
}
</xsl:template>
</xsl:stylesheet>