Hvordan får jeg fat i dette XML?
Som spørgsmålet lyder, så skal jeg have fat i noget XML...Bær over med mig, der er meget XML....
Har noget XML der ser sådan ud:
- <Page ElementId="92" TypeId="1031" RightToLeft="False" CodePage="utf-8" ContentType="text/xml">
- <Editions>
- <Edition EditionId="1">
<Label>Dansk</Label>
<Name>Dansk</Name>
</Edition>
- <Edition EditionId="2">
<Label>Engelsk</Label>
<Name>Engelsk</Name>
</Edition>
</Editions>
<Name>Flash</Name>
- <Created>
- <Date UtcYear="2007" UtcMonth="11" UtcDay="30" UtcHour="8" UtcMinute="26" UtcSecond="0" UtcMillisecond="303" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>fredag</Day>
<AbbreviatedDay>fr</AbbreviatedDay>
<Month>november</Month>
<AbbreviatedMonth>nov</AbbreviatedMonth>
<XmlDate>2007-11-30T08:26:00.303Z</XmlDate>
<LongDate>30. november 2007</LongDate>
<ShortDate>30-11-2007</ShortDate>
<ShortTime>09:26</ShortTime>
<LongTime>09:26:00</LongTime>
<LongDateLongTime>30. november 2007 09:26:00</LongDateLongTime>
<ShortDateLongTime>30-11-2007 09:26:00</ShortDateLongTime>
<ShortDateShortTime>30-11-2007 09:26</ShortDateShortTime>
</Date>
</Created>
- <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
- <Published>
- <Date UtcYear="2007" UtcMonth="11" UtcDay="30" UtcHour="8" UtcMinute="26" UtcSecond="0" UtcMillisecond="303" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>fredag</Day>
<AbbreviatedDay>fr</AbbreviatedDay>
<Month>november</Month>
<AbbreviatedMonth>nov</AbbreviatedMonth>
<XmlDate>2007-11-30T08:26:00.303Z</XmlDate>
<LongDate>30. november 2007</LongDate>
<ShortDate>30-11-2007</ShortDate>
<ShortTime>09:26</ShortTime>
<LongTime>09:26:00</LongTime>
<LongDateLongTime>30. november 2007 09:26:00</LongDateLongTime>
<ShortDateLongTime>30-11-2007 09:26:00</ShortDateLongTime>
<ShortDateShortTime>30-11-2007 09:26</ShortDateShortTime>
</Date>
</Published>
- <PageEdition EditionId="1" Edition="Dansk">
+ <Editions>
<Edition EditionId="1" />
</Editions>
- <TemplateEditions>
<Edition EditionId="1" />
</TemplateEditions>
- <Metadata>
<ContentMetadata />
</Metadata>
- <Created>
- <Date UtcYear="2007" UtcMonth="11" UtcDay="30" UtcHour="8" UtcMinute="26" UtcSecond="0" UtcMillisecond="350" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>fredag</Day>
<AbbreviatedDay>fr</AbbreviatedDay>
<Month>november</Month>
<AbbreviatedMonth>nov</AbbreviatedMonth>
<XmlDate>2007-11-30T08:26:00.350Z</XmlDate>
<LongDate>30. november 2007</LongDate>
<ShortDate>30-11-2007</ShortDate>
<ShortTime>09:26</ShortTime>
<LongTime>09:26:00</LongTime>
<LongDateLongTime>30. november 2007 09:26:00</LongDateLongTime>
<ShortDateLongTime>30-11-2007 09:26:00</ShortDateLongTime>
<ShortDateShortTime>30-11-2007 09:26</ShortDateShortTime>
</Date>
</Created>
- <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
- <LastEdited>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="55" UtcSecond="4" UtcMillisecond="250" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:55:04.250Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:55</ShortTime>
<LongTime>09:55:04</LongTime>
<LongDateLongTime>3. december 2007 09:55:04</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:55:04</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:55</ShortDateShortTime>
</Date>
</LastEdited>
- <LastEditedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</LastEditedBy>
<Title>Flash</Title>
<NavigationTitle>Flash</NavigationTitle>
<Parameters />
</PageEdition>
- <Layout>
- <Row Placement="1">
- <Cell Document="true" Functions="true" SimpleContent="true" ModuleElements="true" Id="1" Placement="1" TemplateContentOnly="false">
<Title>Content area</Title>
- <ContentArea>
- <Module ElementId="10" TypeId="200047">
+ <Editions>
- <Edition EditionId="1">
<Label>Dansk</Label>
<Name>Dansk</Name>
</Edition>
- <Edition EditionId="2">
<Label>Engelsk</Label>
<Name>Engelsk</Name>
</Edition>
</Editions>
<Name>Forside Flash Document List</Name>
+ <Created>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="52" UtcSecond="2" UtcMillisecond="810" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:52:02.810Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:52</ShortTime>
<LongTime>09:52:02</LongTime>
<LongDateLongTime>3. december 2007 09:52:02</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:52:02</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:52</ShortDateShortTime>
</Date>
</Created>
+ <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
+ <ModuleEdition EditionId="1" Edition="Dansk">
- <Editions>
<Edition EditionId="1" />
</Editions>
<TemplateEditions />
- <Created>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="52" UtcSecond="2" UtcMillisecond="903" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:52:02.903Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:52</ShortTime>
<LongTime>09:52:02</LongTime>
<LongDateLongTime>3. december 2007 09:52:02</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:52:02</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:52</ShortDateShortTime>
</Date>
</Created>
- <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
- <LastEdited>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="55" UtcSecond="4" UtcMillisecond="250" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:55:04.250Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:55</ShortTime>
<LongTime>09:55:04</LongTime>
<LongDateLongTime>3. december 2007 09:55:04</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:55:04</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:55</ShortDateShortTime>
</Date>
</LastEdited>
- <LastEditedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</LastEditedBy>
</ModuleEdition>
- <Layout>
- <Row Placement="1">
- <Cell Document="true" Functions="false" SimpleContent="true" ModuleElements="false" Id="1" Placement="1" TemplateContentOnly="true">
<Title>Template content</Title>
<ContentArea />
</Cell>
- <Cell Document="true" Functions="false" SimpleContent="true" ModuleElements="true" Id="2" Placement="2" TemplateContentOnly="false">
<Title>Module content</Title>
- <ContentArea>
- <ModuleElement>
- <Documents>
- <Document Id="47">
<Name>default</Name>
- <DocumentEdition>
- <Fields>
<Field Name="Heading" FieldType="SingleLineText">Plads til rummelighed</Field>
<Field Name="Id" FieldType="SingleLineText">0</Field>
+ <Field Name="Link" FieldType="Link">
+ <Link LinkType="3" OpenInNewWindow="false" LinkId="115" Broken="true">
<Destination TypeId="-1" ElementId="-1" />
<AnchorLink TypeId="-1" ElementId="-1" />
<Edition Id="-1" />
<Channel Id="-1" />
<Url />
<LinkText />
<LinkTitle />
</Link>
<Output><Link LinkType="3" OpenInNewWindow="false" LinkId="115" Broken="true"><Destination TypeId="-1" ElementId="-1" /><AnchorLink TypeId="-1" ElementId="-1" /><Edition Id="-1" /><Channel Id="-1" /><Url /><LinkText /><LinkTitle /></Link></Output>
</Field>
- <Field Name="Media" FieldType="Media">
- <FileConfiguration ElementId="51" TypeId="1024">
+ <Editions>
- <Edition EditionId="1">
<Label>Dansk</Label>
<Name>Dansk</Name>
</Edition>
- <Edition EditionId="2">
<Label>Engelsk</Label>
<Name>Engelsk</Name>
</Edition>
</Editions>
<Name>Media</Name>
+ <Created>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="50" UtcSecond="15" UtcMillisecond="107" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:50:15.107Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:50</ShortTime>
<LongTime>09:50:15</LongTime>
<LongDateLongTime>3. december 2007 09:50:15</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:50:15</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:50</ShortDateShortTime>
</Date>
</Created>
+ <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
+ <FileConfigurationEdition EditionId="1" Edition="Dansk">
- <Editions>
<Edition EditionId="1" />
</Editions>
- <Created>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="50" UtcSecond="15" UtcMillisecond="107" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:50:15.107Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:50</ShortTime>
<LongTime>09:50:15</LongTime>
<LongDateLongTime>3. december 2007 09:50:15</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:50:15</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:50</ShortDateShortTime>
</Date>
</Created>
- <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
- <LastEdited>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="50" UtcSecond="16" UtcMillisecond="250" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:50:16.250Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:50</ShortTime>
<LongTime>09:50:16</LongTime>
<LongDateLongTime>3. december 2007 09:50:16</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:50:16</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:50</ShortDateShortTime>
</Date>
</LastEdited>
- <LastEditedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</LastEditedBy>
</FileConfigurationEdition>
</FileConfiguration>
</Field>
<Field Name="Text" FieldType="TextArea">dsfio iof jhfdsjkf k sdjk f fjklsd fkljsd jkd gfg df g fsdg fdg fdg fd f g sdfg fsdg fdg fgdg</Field>
</Fields>
</DocumentEdition>
</Document>
- <Document Id="48">
<Name>jobcentre</Name>
- <DocumentEdition>
- <Fields>
<Field Name="Heading" FieldType="SingleLineText">Jobcentre har plads til rummelighed</Field>
<Field Name="Id" FieldType="SingleLineText">1</Field>
- <Field Name="Link" FieldType="Link">
- <Link LinkType="2" OpenInNewWindow="false" LinkId="116" Broken="false">
<Destination TypeId="1031" ElementId="3" />
<AnchorLink TypeId="-1" ElementId="-1" />
<Edition Id="-1" />
<Channel Id="-1" />
<Url>via3.html</Url>
<LinkText />
<LinkTitle />
</Link>
<Output><Link LinkType="2" OpenInNewWindow="false" LinkId="116" Broken="false"><Destination TypeId="1031" ElementId="3" /><AnchorLink TypeId="-1" ElementId="-1" /><Edition Id="-1" /><Channel Id="-1" /><Url>via3.html</Url><LinkText /><LinkTitle /></Link></Output>
</Field>
- <Field Name="Media" FieldType="Media">
- <FileConfiguration ElementId="52" TypeId="1024">
- <Editions>
- <Edition EditionId="1">
<Label>Dansk</Label>
<Name>Dansk</Name>
</Edition>
- <Edition EditionId="2">
<Label>Engelsk</Label>
<Name>Engelsk</Name>
</Edition>
</Editions>
<Name>Media</Name>
- <Created>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="56" UtcSecond="19" UtcMillisecond="13" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:56:19.013Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:56</ShortTime>
<LongTime>09:56:19</LongTime>
<LongDateLongTime>3. december 2007 09:56:19</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:56:19</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:56</ShortDateShortTime>
</Date>
</Created>
- <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
- <FileConfigurationEdition EditionId="1" Edition="Dansk">
- <Editions>
<Edition EditionId="1" />
</Editions>
- <Created>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="56" UtcSecond="19" UtcMillisecond="13" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:56:19.013Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:56</ShortTime>
<LongTime>09:56:19</LongTime>
<LongDateLongTime>3. december 2007 09:56:19</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:56:19</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:56</ShortDateShortTime>
</Date>
</Created>
- <CreatedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</CreatedBy>
- <LastEdited>
- <Date UtcYear="2007" UtcMonth="12" UtcDay="3" UtcHour="8" UtcMinute="56" UtcSecond="19" UtcMillisecond="357" Region="da-DK" TimeZone="RomanceStandardTime" UtcOffset="60">
<Day>mandag</Day>
<AbbreviatedDay>ma</AbbreviatedDay>
<Month>december</Month>
<AbbreviatedMonth>dec</AbbreviatedMonth>
<XmlDate>2007-12-03T08:56:19.357Z</XmlDate>
<LongDate>3. december 2007</LongDate>
<ShortDate>03-12-2007</ShortDate>
<ShortTime>09:56</ShortTime>
<LongTime>09:56:19</LongTime>
<LongDateLongTime>3. december 2007 09:56:19</LongDateLongTime>
<ShortDateLongTime>03-12-2007 09:56:19</ShortDateLongTime>
<ShortDateShortTime>03-12-2007 09:56</ShortDateShortTime>
</Date>
</LastEdited>
- <LastEditedBy>
<UserName>Johannes Findorf</UserName>
- <Properties>
<Property Name="FirstName" />
<Property Name="LastName" />
<Property Name="Initials" />
<Property Name="PrettyName" />
<Property Name="Email">jof@dynamicweb.dk</Property>
</Properties>
</LastEditedBy>
</FileConfigurationEdition>
</FileConfiguration>
</Field>
<Field Name="Text" FieldType="TextArea">fgh dgh fg h fgh gfh gfh g gd gd lkg, hdj hgl jhg hklgjgf gf gh jhj hj gh jhgj hgj hj hgj h j hj h jhf jf</Field>
</Fields>
</DocumentEdition>
</Document>
--------------------------
Der er faktisk mere, men det er irrelevant lige nu....
Anyway, det jeg skal ind i er Document, derefter skal jeg have fat i Heading, URL og Text...
Jeg prøver at gøre sådan her, men kan ikke få det til at makke ret:
function loadXML(loaded) {
//Hvis XML er Loaded/Hentet
if (loaded) {
xmlNode = this.firstChild;
xmlNode2 = this.firstChild.childNodes[5].childNodes[1].childNodes[0];
trace(xmlNode2);
//trace(xmlNode);
heading = [];
url = [];
maintext = [];
_root.total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
//trace(heading[i] = xmlNode.childNodes[i].childNodes[0].childNodes[0].firstChild.nodeValue;
trace(heading[i] = xmlNode.childNodes[i].chileNodes[0].chileNodes[3].firstChild.attributes.name);
heading[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
url[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
maintext[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
}
} else {
content = "file not loaded!";
}
}
