Author Topic: PackageContents.xml: problem with register of attribute/element names  (Read 1367 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
I use LINQ to XML for working with PackageContents.xml file, created by Autodesk company. Company has defined the structure of this XML file here, but without XSD schema.

I have a problem: This company breaks his the rules... Often registers of elements and attributes is invalid. For example, instead of the "URL" attribute the "Url" attribute can be defined (different registers) - look the PackageContents.xml of FusionPlugin2013.bundle.

But register is important for XML:
Quote from: MSDN
Like element names, attribute names are case-sensitive and must start with a letter or underscore.

The "URL" is not equals "Url" - such attribute will not found. Can I solve this problem through LINQ to XML (or other), or I can't?

P.S. I have a hope, official documentation contains the invalid  element\attribute names.... It is "better", than a register independent variant...
« Last Edit: November 23, 2012, 04:58:13 AM by Andrey »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: PackageContents.xml: problem with register of attribute/element names
« Reply #1 on: November 23, 2012, 05:10:57 AM »
If it is not mistakes in official documentation, and Autodesk really used case-independent XML parser, then I will must use such code in many places:
Code - C#: [Select]
  1. var attribute = x.Attributes().SingleOrDefault(xa => string.Equals(xa.Name.LocalName, "Url", StringComparison.InvariantCultureIgnoreCase));

Long ago I talk to myself at this forum. :(

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: PackageContents.xml: problem with register of attribute/element names
« Reply #2 on: November 23, 2012, 05:51:54 AM »
< .. >

Long ago I talk to myself at this forum. :(

Andrey, at least you're talking to someone who is smart :)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.