Re: Restructure XML
- From: "Matt" <mdframe@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 May 2005 20:30:51 -0400
Robbe,
I am working with documents that have over 425 nodes in them and I do this
with more than 3000 customers. I am trying to find a way to work with their
XML documents more generically in our processes.
I have actually been working with XML for about 7 years now and that is why
I was probably making the sample XML too generic and simple. I understand
XPath quite well and know XQuery as well. I am trying to figure out how to
reformat our customers XML into a generic form to simply our processes. I
could easily do this if I received the same data from all 3000 customers but
I do not.
If you would like to work with one of my 100mb XML documents I would gladly
send it to you if you would like to see something much more complex. Let me
know if you would like to help out.
Matt
"Robbe Morris [C# MVP]" <info@xxxxxxxxxxxxxxx> wrote in message
news:ebonavOVFHA.928@xxxxxxxxxxxxxxxxxxxxxxx
I'm not sure why you would bother. You could easily get a list of all the
people nodes or all the shift nodes by using the .SelectNodes method and
work with them as needed. What would putting them under a parent node
call collection do for you?
I'm guessing you don't have a lot of familiarity with XPath queries.
Perhaps you should take a look at this set of basic syntax samples.
It is a COM sample, not .NET, but the XPath queries are still applicable.
http://www.eggheadcafe.com/articles/20030627d.asp
But, to answer your question specifically, yes you can certainly do
what you are asking.
--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net
"Matt" <mdframe@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OmnS3gMVFHA.3840@xxxxxxxxxxxxxxxxxxxxxxx
I would like to restructure my xml with a generic style *** to perform
the following. I want to be able to inspect a group of nodes then place
them into a collection node if there are more than one at the same level
with the same name. This should occur as well if sub-levels have
consecutive node names. Is this possible? I have worked on it for a while
and have not come up with a method to generically do this. If anyone has
any thoughts or ideas I'm listening.
SOURCE
<root>
<job>
<janitor/>
<programmer/>
<administrator/>
</job>
<person name="Matt"/>
<person name="Bob"/>
<person name="Larry"/>
<shift>day</shift>
<shift>night</shift>
</root>
Now I run through the generic style*** and what I want to now have is:
DESTINATION
<root>
<job>
<janitor/>
<programmer/>
<administrator/>
</job>
<collection>
<person name="Matt"/>
<person name="Bob"/>
<person name="Larry"/>
</collection>
<collection>
<shift>day</shift>
<shift>night</shift>
</collection>
</root>
Thanks,
Matt
.
- References:
- Restructure XML
- From: Matt
- Re: Restructure XML
- From: Robbe Morris [C# MVP]
- Restructure XML
- Prev by Date: Re: Restructure XML
- Next by Date: Ignoring Elements in XSD
- Previous by thread: Re: Restructure XML
- Next by thread: Re: Restructure XML
- Index(es):