Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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ÐòÁл¯ºóµÄÐÅÏ¢×÷Ϊ¼ì²â¶ÔÏóÊÇ·ñÒÑ·¢Éú±ä¸üµÄ²ÎÕÕÎï¡£ÀýÈçÄú±àдÁËÒ»¸öÉèÖÃÉúÃüÖÜÆڵijÌÐò£¬ÄúÏ£ÍûÄúµÄ³ÌÐò¼ì²âµ½ÊÇ·ñÓÐÈ˸ÉÔ¤ÁËÉúÃüÖÜÆÚÉèÖá£
ÏÂÃæÊÇһЩ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


Ïà¹ØÎĵµ£º

JAVAÓëXML_¶ÁÊé±Ê¼Ç_2010 05 14

JAVATMÓëXML 2010-05-14
Ò»¡¢¸ÅÄî
l  ÈκÎXMLÎĵµ¶ÔÈκÎÀàÐ͵ÄÓ¦ÓÃÒÔ¼°ÕýÈ·µÄ½âÎö¶¼±ØÐë¾ßÓÐÁ¼ºÃµÄ½á¹¹well-formed
l  XMLÎĵµ¿ÉÒÔÊÇÓÐЧµØ£¨valid£©£¬µ«²¢·ÇÒ»¶¨ÒªÇóÓÐЧ¡£
l  PI£¨processing instruction£©¸ñʽ£º<?target instructions?>¡£XMLÖеĴ¦ÀíÖ¸ÁîÖ»ÄÜÊǽâÎöÆ÷¿ÉÒÔʶ±ðµÄXML±ê×¼´¦ÀíÃüÁ ......

c# xml²Ù×÷

ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="fantasy" ISBN="2-3631-4">
    <title>Oberon's Legacy</title>
    <author>Corets, Eva</author>
  &nb ......

JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ

ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
 <book>
  <name>¹þÀï²¨Ì ......

c#:Dataset¶ÁÈ¡XMLÎļþ¶¯Ì¬Éú³É²Ëµ¥

Step 1£ºForm1 ÉÏÌí¼ÓÒ»¸öToolStripContainer¿Ø¼þ
Step2£ºÊµÏÖ´úÂë
private void Form2_Load(object sender, EventArgs e)
{
    CMenuEx menu = new CMenuEx();
    string sPath = "D:\\Menu.xml";//xmlµÄÄÚÈÝ
     if (menu.FileExit())
  &nb ......

microsoft.xmldom(Ò») xmlÎĵµ±éÀújs

xml:
<?xml version="1.0" encoding="utf-8" ?>
<library>
 <name>Ê׶¼Í¼Êé¹Ý</name>
 <address>³¯ÑôÇø»ªÍþÇÅÄÏ</address>
 <books>
  <book>
   <id>0000</id>
  </book>
  < ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ