Solved

XML Schema Question

Posted on 2009-07-10
4
936 Views
Last Modified: 2012-06-21
Hi, I am writing my first XML schema and (of course) I have run into a problem.  I have data in Excel similar to what is depicted in the code snippet below and I want to use this same set of data in several different places (intranet, logon scripts, and other in-house utilities ).  I figured the best way to do this was to create a single XML "master" that all the different interfaces would pull the data from so that everything is always consistent across the board.  

Anyway, what we are dealing with are drive mappings at many sites around the world.  What I would like to do is nest all the drive letters from a single site within that site in the XML data.  I tried creating my own schema and was able to successfully export to an XML file, but it is creating something similar to the following:

<site>
      <site_name>SiteA</site_name>
      <drives>
            <driveletter>F</driveletter>
            <path>\\ServerA\BD</path>
            <description>Business Development</description>
      </drives>
</site>
<site>
      <site_name>SiteA</site_name>
      <drives>
            <driveletter>G</driveletter>
            <path>\\ServerA\ACCT</path>
            <description>Accounting Data</description>
      </drives>
</site>
<site>
      <site_name>SiteA</site_name>
      <drives>
            <driveletter>G</driveletter>
            <path>\\ServerA\GIS</path>
            <description>GIS Data</description>
      </drives>
</site>

What I would like is for all three drives to be under a single site tag as I think that this would make it a little easier to parse in the future.  Is this possible?

Site	Ltr	Path		Desc
SiteA	F	\\svr-a\share1	desc1a
SiteA	G	\\svr-a\share2	desc2a
SiteA	G	\\svr-a\share3	desc3a
SiteB	H	\\svr-b\share1 	desc1b
SiteB	H	\\svr-b\share2 	desc2b
SiteB	I	\\svr-b\share3 	desc3b
SiteC	J	\\svr-c\share1 	desc1c
SiteC	L	\\svr-c\share2 	desc2c
SiteC	M	\\svr-c\share3 	desc3c

Open in new window

0
Comment
Question by:sublimnl_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
Dabas earned 250 total points
ID: 24832794
What about the snippet below?
Same information, but much simpler!

I have used attributes instead of elements, as I believe it simplifies matters, but it is just throwing another idea on how to implement it.
Also I removed <description>, leaving it as the element value. Again, its just an idea.
<site site_name="SiteA">
	<drives driveletter="F" path="\\ServerA\BD">
            Business Development
      </drives>
	<drives driveletter="G" path="\\ServerA\ACCT">
            Accounting Data
      </drives>
	<drives driveletter="G" path="\\ServerA\GIS">
            GIS Data
      </drives>
</site>

Open in new window

0
 
LVL 27

Expert Comment

by:Dabas
ID: 25051784
I believe my answer addresses the question.
My comment did not have a response.
The moderator also did not explain why my answer should not be accepted.
The question as stated mentions: "What I would like is for all three drives to be under a single site tag"

My answer has all three drives under a single site tag.

Dabas
0

Featured Post

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question