创作了一个xml的替代格式

xml格式:

<?xml version="1.0" encoding="GB2312"?>
<Relations>    
    <Relation name="PuDian.FrontFlow.In.text" type="1" transmit="PuDian.FrontFlow.In.arr" comment="大厦前置In">
        <Agent object="PuDian.YW2.PD-YW2-4948-B4_2-1-4M214.Port-channel1.ifInBitsRate" />
        <Agent object="PuDian.YW2.PD-YW2-4948-B4_2-2-4M213.Port-channel1.ifInBitsRate" />
    </Relation>
    <Relation name="PuDian.FrontFlow.Out.text" type="1" transmit="PuDian.FrontFlow.Out.arr" comment="大厦前置Out">
        <Agent object="PuDian.YW2.PD-YW2-4948-B4_2-1-4M214.Port-channel1.ifOutBitsRate" />
        <Agent object="PuDian.YW2.PD-YW2-4948-B4_2-2-4M213.Port-channel1.ifOutBitsRate" />
    </Relation>
    <Relation name="ZhangJ.FrontFlow.In.text" type="1" transmit="ZhangJ.FrontFlow.In.arr" comment="张江前置In">
        <Agent object="ZhangJ.YW2.ZJ-YW2-4948-B4_2-1-2M108.Port-channel1.ifInBitsRate" />
        <Agent object="ZhangJ.YW2.ZJ-YW2-4948-B4_2-2-2M107.Port-channel1.ifInBitsRate" />
        <Agent text="cc">Hello</Agent>
    </Relation>
</Relations>

自创格式:

Relatios:
{
    Relation:name="PuDian.FrontFlow.In.text", type="1", transmit="PuDian.FrontFlow.In.arr", comment="大厦前置In"
    {
        Agent:object="PuDian.YW2.PD-YW2-4948-B4_2-1-4M214.Port-channel1.ifInBitsRate",
        Agent:object="PuDian.YW2.PD-YW2-4948-B4_2-2-4M213.Port-channel1.ifInBitsRate"
    },
    Relation:name="PuDian.FrontFlow.Out.text", type="1", transmit="PuDian.FrontFlow.Out.arr", comment="大厦前置Out"
    {
        Agent:object="PuDian.YW2.PD-YW2-4948-B4_2-1-4M214.Port-channel1.ifOutBitsRate",
        Agent:object="PuDian.YW2.PD-YW2-4948-B4_2-2-4M213.Port-channel1.ifOutBitsRate"
    },
    Relation:name="ZhangJ.FrontFlow.In.text", type="1", transmit="ZhangJ.FrontFlow.In.arr", comment="张江前置In"
    {
        Agent:object="ZhangJ.YW2.ZJ-YW2-4948-B4_2-1-2M108.Port-channel1.ifInBitsRate",
        Agent:object="ZhangJ.YW2.ZJ-YW2-4948-B4_2-2-2M107.Port-channel1.ifInBitsRate",
        Agent:text="cc",@text="Hello"
    }
}

其中@打头的是用来保存<tag>text</tag>中的text,后面有时间搞个解释器。

posted @ 2019-06-06 15:39  Roarsun  阅读(281)  评论(0编辑  收藏  举报