Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by YikYikHeiHei · Aug 23, 2011 at 12:04 AM · javascriptxmlitemchinese

How to load this XML File?

I have a testing xml file and I want to read in the app.

But I don't know how to read this xml

 <?xml version="1.0" encoding="UTF-8" ?>
     <thisXml>
         <system systemLanguage = "English">
             <item0 imageText = "aaaaaaaaa" imageRectX = "0" imageRectY = "0" imageUrl="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2009/apple-wallpaper/320x480.jpg"/>
             <item1 imageText = "aaaaaaaaa" imageRectX = "0" imageRectY = "50" imageUrl="http://testsuites.opera.com/object-fit/support/160x240.ogv.png"/>
             <item2 imageText = "bbbbbbbbb" imageRectX = "0" imageRectY = "0" imageUrl="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2009/apple-wallpaper/320x480.jpg"/>
             <item3 imageText = "bbbbbbbbb" imageRectX = "0" imageRectY = "50" imageUrl="http://testsuites.opera.com/object-fit/support/160x240.ogv.png"/>
         </system>
         <system systemLanguage = "中文">
             <item0 imageText = "你好" imageRectX = "0" imageRectY = "0" imageUrl="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2009/apple-wallpaper/320x480.jpg"/>
             <item1 imageText = "你們" imageRectX = "0" imageRectY = "50" imageUrl="http://testsuites.opera.com/object-fit/support/160x240.ogv.png"/>
             <item2 imageText = "我很好" imageRectX = "0" imageRectY = "0" imageUrl="http://www.blog.spoongraphics.co.uk/wp-content/uploads/2009/apple-wallpaper/320x480.jpg"/>
             <item3 imageText = "我們" imageRectX = "0" imageRectY = "50" imageUrl="http://testsuites.opera.com/object-fit/support/160x240.ogv.png"/>
         </system>
     </thisXml>

Can help me? Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by DaveA · Aug 23, 2011 at 12:20 AM

You could just open it as text with System.IO functions or WWW.data and parse out what you need using standard String methods to search it. If you really want an XML parse, try http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx

something like (untested)

xml = new XmlDocument(); xml.LoadXml(text); // returned by www for example

var languageCount : int = xml.ChildNodes.Count; for (var i : int = 1; i < cnodeCount; i++) { var langNode : XmlNode = xml.ChildNodes.Item(i); var itemCount : int = langNode.ChildNodes.Count; for (var j : int = 0; j < itemCount; j++) { var itemNode : XmlNode = langNode.Item(j); var imgText : String = itemNode.Attributes["imageText"].Value; var imageRectX : int = parseInt(itemNode.Attributes["imageRectX"].Value); .. etc .. .. do something with that.. } }

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image YikYikHeiHei · Aug 23, 2011 at 12:41 AM 0
Share

Thanks! But I have know how to do it.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Declaring XML Namespace at Runtime 1 Answer

Using JSON to get tree data into JavaScript objects 3 Answers

Item/Database Error 2 Answers

Easy XML Parsing 4 Answers

Player touch item? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges