Autodesk Vault API ÀàµÄXml Serialization¹¥ÂÔ
Òë×ÔVault API°ïÖúÎĵµÖÐһƪ Doug RedmondдµÄknowledgebase article. Doug's ²©¿ÍÊÇ It's All Just Ones and Zeros
ÄãÒ²Ðí²»ÖªµÀËùÓÐVault API Àà¶¼¿ÉÒÔ XML ÐòÁл¯ - ÕâÒâζןÜÈÝÒ×°ÑAPI¶ÔÏóת»»Îª XML Îı¾£¬·´Ö®ÒàÈ»¡£
ºÜ¶àÖÖÇé¿öÏ¿ÉÒÔʹÓô˹¦ÄÜ£¬ÀýÈ磺
Ëü¿ÉÒÔ°ïÖúÄúµ÷ÊÔ´úÂë¡£Èç¹ûÄú¾ßÓдóÁ¿Êý¾ÝµÄ¶ÔÏ󣬽«¸Ã¶ÔÏó´æÎªXML¸ñʽ·½±ãÑо¿¡£
Èç¹ûÄúÏòADNÌá½»ÎÊÌ⣬¿ÉÒÔ½«XMLÐòÁл¯µÄ¶ÔÏó×÷ΪÄúµÄÎÊÌâ˵Ã÷µÄÒ»²¿·Ö¡£
´æ´¢ÐÅÏ¢¹©ÒÔºóʹÓá£Ö»Ðè¼Çס£¬´ËÐÅÏ¢ÔÚÏÂÒ»°æ±¾ÖпÉÄÜ»á¸ü¸Ä¡£
Äú¿ÉÒÔʹÓÃXMLÐòÁл¯ºóµÄÐÅÏ¢×÷Ϊ¼ì²â¶ÔÏóÊÇ·ñÒÑ·¢Éú±ä¸üµÄ²ÎÕÕÎï¡£ÀýÈçÄú±àдÁËÒ»¸öÉèÖÃÉúÃüÖÜÆÚµÄ³ÌÐò£¬ÄúÏ£ÍûÄúµÄ³ÌÐò¼ì²âµ½ÊÇ·ñÓÐÈ˸ÉÔ¤ÁËÉúÃüÖÜÆÚÉèÖá£
ÏÂÃæÊÇһЩVault API XML ÐòÁл¯µÄʾÀý´úÂ룺
C#:
private bool DidItChange(LfCycDef def)
{
// serialize the object
StringBuilder currentXML = new StringBuilder();
XmlSerializer serializer = new XmlSerializer(typeof(DocEx.LfCycDef));
using (TextWriter writer = new StringWriter(currentXML))
{
serializer.Serialize(writer, def);
}
// read in the stored XML
string originalXML = System.IO.File.ReadAllText("correct.xml");
// now all you have to do is compare the two
return (originalXML != currentXML.ToString()); }
VB:
private function DidItChange(def as LfCycDef ) as boolean
' serialize the object
dim currentXML as StringBuilder = new StringBuilder()
dim serializer as XmlSerializer = new XmlSerializer(GetType(LfCycDef))
using writer as TextWriter = new System.IO.StringWriter(currentXML)
serializer.Serialize(writer, def)
end using
' read in the stored
Ïà¹ØÎĵµ£º
JAVATMÓëXML 2010-05-14
Ò»¡¢¸ÅÄî
l ÈκÎXMLÎĵµ¶ÔÈκÎÀàÐ͵ÄÓ¦ÓÃÒÔ¼°ÕýÈ·µÄ½âÎö¶¼±ØÐë¾ßÓÐÁ¼ºÃµÄ½á¹¹well-formed
l XMLÎĵµ¿ÉÒÔÊÇÓÐЧµØ£¨valid£©£¬µ«²¢·ÇÒ»¶¨ÒªÇóÓÐЧ¡£
l PI£¨processing instruction£©¸ñʽ£º<?target instructions?>¡£XMLÖеĴ¦ÀíÖ¸ÁîÖ»ÄÜÊǽâÎöÆ÷¿ÉÒÔʶ±ðµÄXML±ê×¼´¦ÀíÃüÁ ......
ÊÇ·ñÑá¾ëÁËÓÃxmlÎļþÀ´×öMagentoµÄÒ³Ãæ²¼¾Ö£¬ÊǵϰÀ´ÊÔÊÔÏÂÃæÕâÖÖ·½Ê½£¬°Ñ²¼¾Ö´úÂëдµ½controller ÀïÃæ
public function mycoolAction()
{
/* ... Some code ...*/
$update = $this->getLayout()->getUpdate();
/* ... Some code ...*/
$this->addActionLayoutHandles();
/* ... Some code ...*/
......
ͨ¹ýµ÷ÓÃCreateDataSetfromXmlÈ¡µÃXMLÊý¾Ý
Imports System.Xml
Public Const FILE_CONFIG = "MZZ.xml"
Public Const PATH_CONFIG = "\XML\"
Dim dstXML As DataSet
Dim tblXML_DB As DataTable
Dim dtCod As New DataTable
Dim strSQL As String = ""
clsPublic ......
²Î¿¼²©ÎÄ¡¶IEÏÂÀûÓÃjQuery·ÖÎöXML¡·µØÖ·£ºhttp://www.newmediafun.com/2009/07/parsing-xml-with-jquery-in-internet-explorer/
±¾À´ÒÔΪjQuery»áºÜºÃµÄ½â¾öËùÓÐä¯ÀÀÆ÷¼æÈÝÐÔÎÊÌ⣬µ«ÊÇÕóÍöµÄIE6»¹ÊÇ»áÕÒÂé·³£¡
jQueryʹÓÃAJAXʱ£¬ÔÚIE6϶ÁÈ¡»Ø´«µ½XMLÊý¾Ý»áÓÐÎÊÌ⣬¾ßÌå¿´ÏÂÃæµÄÀý×Ó°É¡£
×¼±¸Êý¾ÝÎļþtest.xml
<Ar ......
xml£º
<?xml version="1.0" encoding="utf-8" ?>
<library>
<name>Ê×¶¼Í¼Êé¹Ý</name>
<address>³¯ÑôÇø»ªÍþÇÅÄÏ</address>
<books>
<book type="math">
<id>0000</id>
</book&g ......