Click here to Skip to main content
15,884,986 members
Home / Discussions / C#
   

C#

 
GeneralRe: Skipping locked section already in use Pin
jschell16-May-12 9:04
jschell16-May-12 9:04 
GeneralRe: Skipping locked section already in use Pin
Pete O'Hanlon15-May-12 8:20
mvePete O'Hanlon15-May-12 8:20 
GeneralRe: Skipping locked section already in use Pin
Sentenryu15-May-12 8:39
Sentenryu15-May-12 8:39 
GeneralRe: Skipping locked section already in use Pin
jschell15-May-12 9:02
jschell15-May-12 9:02 
GeneralRe: Skipping locked section already in use Pin
Pete O'Hanlon15-May-12 21:43
mvePete O'Hanlon15-May-12 21:43 
GeneralRe: Skipping locked section already in use Pin
jschell16-May-12 9:07
jschell16-May-12 9:07 
GeneralRe: Skipping locked section already in use Pin
BobJanova16-May-12 0:39
BobJanova16-May-12 0:39 
Questioncollapsing xml elements into attributes in c# Pin
swjam15-May-12 2:26
swjam15-May-12 2:26 
Hi,

I have an 'in.xml' file which I would like to 'collapse' into an 'out.xml' file in c#. (Not necessarily asking for the code but the approach to do this ie. xslt or xmldocument add attributes) Many thanks in advance.
The files are as follows:

in.xml
<mySample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
  <Phase1>
    <startDate>2013-01-01</startDate>
    <endDate>2014-12-31</endDate>
    <capital>100000.00</capital>
    <fundings>
      <funding>
        <registrar>Genentech Pty Ltd</registrar>
        <assets>100000.00</assets>
        <miscellany>150000.00</miscellany>
      </funding>
      <funding>
        <registrar>Acme Pty Ltd</registrar>
        <assets>25000.00</assets>
        <miscellany>25000.00</miscellany>
      </funding>
    </fundings>
  </Phase1>
  <Phase2>
    <capital>150000.00</capital>
    <fundings>
      <funding>
        <registrar>Mont Blanc Associates</registrar>
        <assets>50000.00</assets>
        <miscellany>25000.00</miscellany>
      </funding>
      <funding>
        <registrar>Acme Pty Ltd</registrar>
        <assets>10000.00</assets>
        <miscellany>10000.00</miscellany>
      </funding>
      <funding>
        <registrar>Triple A Commercial</registrar>
        <assets>10000.00</assets>
        <miscellany>10000.00</miscellany>
      </funding>
    </fundings>
  </Phase2>
  <integration>
    <value>6</value>
  </integration>
  <years>
    <value>1</value>
    <value>2</value>
    <value>6</value>
    <value>3</value>
    <value>7</value>
    <value>4</value>
    <value>8</value>
    <value>5</value>
  </years>
  <bandWidths>
    <value>1</value>
    <value>2</value>
  </bandWidths>
  <regions>
    <region>
      <name>Trevae, Srt, 3241</name>
      <state>3</state>
      <zodex>3241</zodex>
    </region>
    <region>
      <name>Silua, Rev, 2940</name>
      <state>2</state>
      <zodex>2940</zodex>
    </region>
  </regions>
  <sponsors>
    <sponsor>
      <name>Genentech Pty Ltd</name>
      <spcode>7</spcode>
    </sponsor>
    <sponsor>
      <name>Acme Pty Ltd.</name>
      <spcode>15</spcode>
    </sponsor>
    <sponsor>
      <name>Triple A Commercial</name>
      <spcode>9</spcode>
    </sponsor>
    <sponsor>
      <name>Mont Blanc Associates</name>
      <spcode>1</spcode>
    </sponsor>
  </sponsors>
</mySample>


out.xml
<mySample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
  <Phase1 startDate="2013-01-01" endDate="2014-12-31" capital="100000.00">
    <fundings>
      <funding registrar="Genentech Pty Ltd" assets="100000.00" miscellany="150000.00"/>
      <funding registrar="Acme Pty Ltd" assets="25000.00" miscellany="25000.00"/>
    </fundings>
  </Phase1>
  <Phase2 capital="150000.00">
    <fundings>
      <funding registrar="Mont Blanc Associates" assets="50000.00" miscellany="25000.00"/>
      <funding registrar="Acme Pty Ltd" assets="10000.00" miscellany="10000.00"/>
      <funding registrar="Triple A Commercial" assets="10000.00" miscellany="10000.00"/>
    </fundings>
  </Phase2>
  <integration value="6"/>
  <years value="1,2,6,3,7,4,8,5"/>
  <bandWidths value="1,2"/>
  <regions>
    <region name="Trevae, Srt, 3241" state="3" zodex="3241"/>
    <region name="Silua, Rev, 2940" state="2" zodex="2940"/>
  </regions>
  <sponsors>
    <sponsor name="Genentech Pty Ltd" spcode="7"/>
    <sponsor name="Acme Pty Ltd" spcode="15"/>
    <sponsor name="Triple A Commercial" spcode="9"/>
    <sponsor name="Mont Blanc Associates" spcode="1"/>
  </sponsors>
</mySample>

----------------------------------------------------------
Lorem ipsum dolor sit amet.

AnswerRe: collapsing xml elements into attributes in c# Pin
Pete O'Hanlon15-May-12 2:31
mvePete O'Hanlon15-May-12 2:31 
GeneralRe: collapsing xml elements into attributes in c# Pin
swjam15-May-12 2:49
swjam15-May-12 2:49 
GeneralRe: collapsing xml elements into attributes in c# Pin
Pete O'Hanlon15-May-12 2:51
mvePete O'Hanlon15-May-12 2:51 
AnswerRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 3:35
mvePIEBALDconsult15-May-12 3:35 
JokeRe: collapsing xml elements into attributes in c# Pin
swjam15-May-12 4:39
swjam15-May-12 4:39 
GeneralRe: collapsing xml elements into attributes in c# Pin
Dave Kreskowiak15-May-12 5:02
mveDave Kreskowiak15-May-12 5:02 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 5:37
mvePIEBALDconsult15-May-12 5:37 
GeneralRe: collapsing xml elements into attributes in c# Pin
Dave Kreskowiak15-May-12 7:26
mveDave Kreskowiak15-May-12 7:26 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 5:38
mvePIEBALDconsult15-May-12 5:38 
GeneralRe: collapsing xml elements into attributes in c# Pin
Mycroft Holmes15-May-12 14:28
professionalMycroft Holmes15-May-12 14:28 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 14:34
mvePIEBALDconsult15-May-12 14:34 
QuestionRedirecting output from an unmanaged dll Pin
andreas0414-May-12 23:19
andreas0414-May-12 23:19 
AnswerRe: Redirecting output from an unmanaged dll Pin
BobJanova15-May-12 0:27
BobJanova15-May-12 0:27 
AnswerRe: Redirecting output from an unmanaged dll Pin
Richard MacCutchan15-May-12 1:37
mveRichard MacCutchan15-May-12 1:37 
AnswerRe: Redirecting output from an unmanaged dll Pin
Sentenryu15-May-12 5:40
Sentenryu15-May-12 5:40 
Questionproviding images as a stream Pin
VinVan8114-May-12 22:12
VinVan8114-May-12 22:12 
AnswerRe: providing images as a stream Pin
Andy41114-May-12 22:32
Andy41114-May-12 22:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.