Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 AaronG · Jul 29, 2011 at 09:14 PM · c#xml

How do I use this XML reader?

I found a lightweight XML reader here which I would like to use over TinyXMLReader as it has the ability to parse attributes. The problem is that I have literally no idea how to use this parser. TinyXMLReader provided a working example but this doesn't provide anything.

So does anyone here have any experience with this particular script? If you do, please provide a simple example of how to use and I'm sure I'll quickly come to grasps with it.

Thanks.

Comment
Add comment · Show 2
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 Graham-Dunnett ♦♦ · Jul 29, 2011 at 09:41 PM 0
Share

What's wrong with using the usage example Cameron presents on the forum post you link to? It just loads an X$$anonymous$$L file from the Resources folder, parses it, and then dumps the xml out from the data returned by the parsing.

avatar image AaronG · Jul 29, 2011 at 10:16 PM 0
Share

With TinyX$$anonymous$$LReader I can execute code base on the currently open tag such as...

if (reader.tagName == "$$anonymous$$yTag") { num$$anonymous$$yTag++ }

But I don't understand how, using this parser, I can store information between tags into variables.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Waz · Jul 29, 2011 at 10:48 PM

There are two basic types of XML parser: those that traverse the logical tree as they parse and those that build a tree which you then traverse at your leisure. This is of the latter kind. Generally this is easier and more powerful too. It's a DOM tree (sort of).

Comment
Add comment · Show 5 · 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 AaronG · Jul 30, 2011 at 11:51 AM 0
Share

But how would I then traverse the tree? :P

avatar image Waz · Jul 30, 2011 at 12:11 PM 0
Share

See the example at that link - it traverses the tree in order to write it back out as X$$anonymous$$L - quite a good test and example, I think. Once you've used the DO$$anonymous$$-style, you'll never want to go back.

avatar image AaronG · Jul 30, 2011 at 01:36 PM 0
Share

It will output the entire X$$anonymous$$L to the console but how is that of use to me? Please provide a more contextual example. :(

For example, I have $$anonymous$$yNameIsBob in an X$$anonymous$$L file between a tags called 'Name'. I load it up via the parser and want to store the value between those tags in a string variable.

How would I do this?

avatar image Waz · Jul 30, 2011 at 08:40 PM 0
Share

Perhaps you should stick with the reader you understand.

avatar image Waz · Jul 30, 2011 at 08:43 PM 0
Share

Traversing a tree is a basic program$$anonymous$$g concept. You walk from node to node, look at each node to decide wether to go into it's substructure. In your case, you look for the Name node.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Getting the position of all game objects with the same tag 1 Answer

Renderer on object disabled after level reload 1 Answer

Flip over an object (smooth transition) 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