Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过编辑器GUI编写XML_Xml_Unity3d_Unity3d Editor - Fatal编程技术网

通过编辑器GUI编写XML

通过编辑器GUI编写XML,xml,unity3d,unity3d-editor,Xml,Unity3d,Unity3d Editor,我有一个包含以下节点的XML文件: <Products> <Product name="Test 1"> <title>Test1 Title</title> <content>Lorem ipsum....... </content> <facebook> <fb-picture>Here goes a link</

我有一个包含以下节点的XML文件:

<Products>
   <Product name="Test 1">
        <title>Test1 Title</title>
        <content>Lorem ipsum....... </content>
        <facebook>
            <fb-picture>Here goes a link</fb-picture>
            <fb-caption>This is a caption</fb-caption>
           <fb-description>This is a description</fb-description>
        </facebook>
    </Product>
<Products>

测试1标题
乱数假文。。。。。。。
这里有一个链接
这是一个标题
这是一个描述
现在我想从“产品”中复制一份,并通过EditorGUI填充所有内部文本。 因为我将在这个XML中获得很多产品,我不想通过XML文件填充所有这些文本

我有点迷路了,不知道从哪里开始。 我与Unity4.6和C#一起工作

希望有人能告诉我怎么做


谢谢

这是我的解决方案。我使用了以下示例:

首先,我创建了一个新类,在这个类中,我输入了我需要的所有字符串(或字段)

之后,我从示例链接创建了类

public class ItemsEditor (){}
我将所有项目字段名称更改为我在ProductItems类中创建的名称

这个类将创建一个编辑器窗口,我可以在其中向XML文件添加或删除项目

输出xml如下所示

<?xml version="1.0" encoding="us-ascii"?>
<ArrayOfProductItems xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <ProductItems>
   <name>This is a name</name>
   <text>This is a text</text>
   <tags>Test Tag1</tags>
   <pictureName>pictureName</pictureName>
   <pictureURL>www.pictureURL.com</pictureURL>
   <caption>Test caption</caption>
   <description>Test description</description>
   <url>www.test.de</url>
 </ProductItems>
</ArrayOfProductItems>

这是一个名字
这是一篇课文
测试标记1
图片名称
www.pictureURL.com
测试标题
测试描述
www.test.de
不过,我还有一个问题,我还不知道如何在“ProductItems”属性中添加名称字段,如下所示:

<ProductItems name="Item 1">


也许其他人确实知道这一点?

您可以从学习如何编写xml开始。谢谢,我用这个例子解决了这个问题:然后您可以回答自己的问题。请描述您为解决问题所做的工作,以及该链接如何发挥作用,以及您何时可以接受自己的答案
<ProductItems name="Item 1">