|
-
Aug 17th, 2014, 05:46 PM
#1
Thread Starter
Member
XML format change
I have an XML file that I am making good progress in adding, creating and changing data / nodes / elements.
There are about 130 children under a parent where there is a node named "//WorkspaceSettings"
I am unable to get values from any of its children. I created a nodelist that satisfies the requirements but it is not included in the node list.
If I create a node list using "//WorkspaceSettings/child::*" , I get 2 items. But Nodelist.item(0).nodeName errors, however, nodelist.item(0).Nodtype returns "1" This is the type I get for other nodes where I do get nodename, etc......
I know that the nodes are there because using a file compare program (Beyond Compare) seems to understand the format and shows these nodes. But using "XML Viewer" shows this data a gobly goop.
This is a cut of the beginning of the node:
Code:
WorkspaceSettings ObjectID="254" ClassID="c4372273-e1aa-4683-98aa-a2ceadf3066c" Version="1">
<WorkspaceName>09-26-13C</WorkspaceName>
<WorkspaceDefinition><?xml version='1.0'?> <prop.map version='4'> <prop.list> <prop.pair> <key>DVA_Wrkspce</key> <string>1.2</string> </prop.pair> <prop.pair> <key>MonitorInfo</key> <prop.list> <prop.pair> <key>Monitor-0</key> <array> <array.type><int type='signed' size='32'/></array.type> <int type='signed' size='32'>0</int> <int type='signed' size='32'>22</int> <int type='signed' size='32'>2560</int> <int type='signed' size='32'>1418</int> </array> </prop.pair> <prop.pair> <key>Monitor-1</key> <array> <array.type><int type='signed' size='32'/></array.type> <int type='signed' size='32'>-1276</int> <int type='signed' size='32'>416</int> <int type='signed' size='32'>1276</int> <int type='signed' size='32'>1024</int>
Thanks millions for your solution
-
Aug 18th, 2014, 06:38 AM
#2
Re: XML format change
The XPath "child:: *" will return all types of XmlNode, including things like XmlText, which represents the whitespace between elements. That space, including line breaks, is just syntactic sugar for you and I; Xml certainly doesn't need it!
XmlText is a different Type of node and you can't do half as much with it as you can with a "regular" XmlNode.
I'd suggest using "child:: node()" instead, which only returns XmlNodes.
Regards, Phill W.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|