21 Replies Latest reply on Jan 8, 2009 12:57 AM by Newsgroup_User

    linking to a database using xml

    Level 7


      Hello,
      I am trying to create a dynamic sitemap xml page. I use the code below but I
      get an error, can any one advise as to what I can do to get this correct and
      show <=100 records


      the error is as

      XML Parsing Error: not well-formed

      <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
      -^

      regards

      k


      <?xml version="1.0" encoding="UTF-8"?><%@LANGUAGE="VBSCRIPT"
      CODEPAGE="65001"%><!--#include file="Connections/consoggy.asp" --><%Dim
      RectopofsomethingDim Rectopofsomething_cmdDim Rectopofsomething_numRows Set
      Rectopofsomething_cmd = Server.CreateObject
      ("ADODB.Command")Rectopofsomething_cmd.ActiveConnection =
      MM_consoggy_STRINGRectopofsomething_cmd.CommandText = "SELECT nav_list_pk
      FROM topofmountain.cs_nav_list where _rowid >=1 and _rowid <=100"
      Rectopofsomething_cmd.Prepared = true Set Rectopofsomething =
      Rectopofsomething_cmd.ExecuteRectopofsomething_numRows = 0%><%Dim
      Repeat1__numRowsDim Repeat1__index Repeat1__numRows = 100Repeat1__index =
      0Rectopofsomething_numRows = Rectopofsomething_numRows + Repeat1__numRows%>
      <% While ((Repeat1__numRows <> 0) AND (NOT Rectopofsomething.EOF)) %><urlset
      xmlns=" http://www.sitemaps.org/schemas/sitemap/0.9"> <url>
      <loc> http://www.mysite.com/master.asp?see=<%=(Rectopofsomething.Fields.Item("nav_list_pk").Valu e)%></loc>
      <lastmod>2009-01-07</lastmod> <changefreq>weekly</changefreq>
      <priority>0.9</priority> </url></urlset> <%
      Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1
      Rectopofsomething.MoveNext()Wend%> <%Rectopofsomething.Close()Set
      Rectopofsomething = Nothing%


        • 1. Re: linking to a database using xml
          Level 7
          You are actually linking to the database using ASP/VBScript which is writing
          an XML file. Try removing this from the top of this markup -

          <?xml version="1.0" encoding="UTF-8"?>

          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          ==================


          "Twocans" <aa@bb.com> wrote in message
          news:gk2941$m59$1@forums.macromedia.com...
          >
          >
          > Hello,
          > I am trying to create a dynamic sitemap xml page. I use the code below but
          > I get an error, can any one advise as to what I can do to get this correct
          > and show <=100 records
          >
          >
          > the error is as
          >
          > XML Parsing Error: not well-formed
          >
          > <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
          > -^
          >
          > regards
          >
          > k
          >
          >
          > <?xml version="1.0" encoding="UTF-8"?><%@LANGUAGE="VBSCRIPT"
          > CODEPAGE="65001"%><!--#include file="Connections/consoggy.asp" --><%Dim
          > RectopofsomethingDim Rectopofsomething_cmdDim Rectopofsomething_numRows
          > Set Rectopofsomething_cmd = Server.CreateObject
          > ("ADODB.Command")Rectopofsomething_cmd.ActiveConnection =
          > MM_consoggy_STRINGRectopofsomething_cmd.CommandText = "SELECT nav_list_pk
          > FROM topofmountain.cs_nav_list where _rowid >=1 and _rowid <=100"
          > Rectopofsomething_cmd.Prepared = true Set Rectopofsomething =
          > Rectopofsomething_cmd.ExecuteRectopofsomething_numRows = 0%><%Dim
          > Repeat1__numRowsDim Repeat1__index Repeat1__numRows = 100Repeat1__index =
          > 0Rectopofsomething_numRows = Rectopofsomething_numRows +
          > Repeat1__numRows%> <% While ((Repeat1__numRows <> 0) AND (NOT
          > Rectopofsomething.EOF)) %><urlset
          > xmlns=" http://www.sitemaps.org/schemas/sitemap/0.9"> <url>
          > <loc> http://www.mysite.com/master.asp?see=<%=(Rectopofsomething.Fields.Item("nav_list_pk").Valu e)%></loc>
          > <lastmod>2009-01-07</lastmod> <changefreq>weekly</changefreq>
          > <priority>0.9</priority> </url></urlset> <%
          > Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1
          > Rectopofsomething.MoveNext()Wend%> <%Rectopofsomething.Close()Set
          > Rectopofsomething = Nothing%
          >

          • 2. Re: linking to a database using xml
            Level 7
            Twocans wrote:
            > Hello,
            > I am trying to create a dynamic sitemap xml page. I use the code below but I
            > get an error, can any one advise as to what I can do to get this correct and
            > show <=100 records
            >
            >
            > the error is as
            >
            > XML Parsing Error: not well-formed
            >
            > <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
            > -^

            have you tried removing that line?

            Dooza

            > regards
            >
            > k
            >
            >
            > <?xml version="1.0" encoding="UTF-8"?><%@LANGUAGE="VBSCRIPT"
            > CODEPAGE="65001"%><!--#include file="Connections/consoggy.asp" --><%Dim
            > RectopofsomethingDim Rectopofsomething_cmdDim Rectopofsomething_numRows Set
            > Rectopofsomething_cmd = Server.CreateObject
            > ("ADODB.Command")Rectopofsomething_cmd.ActiveConnection =
            > MM_consoggy_STRINGRectopofsomething_cmd.CommandText = "SELECT nav_list_pk
            > FROM topofmountain.cs_nav_list where _rowid >=1 and _rowid <=100"
            > Rectopofsomething_cmd.Prepared = true Set Rectopofsomething =
            > Rectopofsomething_cmd.ExecuteRectopofsomething_numRows = 0%><%Dim
            > Repeat1__numRowsDim Repeat1__index Repeat1__numRows = 100Repeat1__index =
            > 0Rectopofsomething_numRows = Rectopofsomething_numRows + Repeat1__numRows%>
            > <% While ((Repeat1__numRows <> 0) AND (NOT Rectopofsomething.EOF)) %><urlset
            > xmlns=" http://www.sitemaps.org/schemas/sitemap/0.9"> <url>
            > <loc> http://www.mysite.com/master.asp?see=<%=(Rectopofsomething.Fields.Item("nav_list_pk").Valu e)%></loc>
            > <lastmod>2009-01-07</lastmod> <changefreq>weekly</changefreq>
            > <priority>0.9</priority> </url></urlset> <%
            > Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1
            > Rectopofsomething.MoveNext()Wend%> <%Rectopofsomething.Close()Set
            > Rectopofsomething = Nothing%
            >
            >
            • 3. Re: linking to a database using xml
              Level 7
              Thank you both,

              yea dooza I remopved it but then I get the error


              XML Parsing Error: not well-formed
              Location: http://www.mysite.com/sitemap_a1.xml
              Line Number 3, Column 2:<%
              -^

              i am confused as to how to do a repeat region in the xml


              k


              • 4. Re: linking to a database using xml
                Level 7
                You are not doing a repeat region in XML. You are doing it in ASP/VBScript.

                --
                Murray --- ICQ 71997575
                Adobe Community Expert
                (If you *MUST* email me, don't LAUGH when you do so!)
                ==================
                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                ==================


                "Twocans" <aa@bb.com> wrote in message
                news:gk2blp$pbv$1@forums.macromedia.com...
                > Thank you both,
                >
                > yea dooza I remopved it but then I get the error
                >
                >
                > XML Parsing Error: not well-formed
                > Location: http://www.mysite.com/sitemap_a1.xml
                > Line Number 3, Column 2:<%
                > -^
                >
                > i am confused as to how to do a repeat region in the xml
                >
                >
                > k
                >

                • 5. Re: linking to a database using xml
                  Level 7
                  wowa so i take it there is a fifferent way of doing it xml

                  is there a different way of connecting to a database in xml too.

                  lol

                  thanks any way

                  k


                  • 6. Re: linking to a database using xml
                    Level 7
                    Twocans wrote:
                    > wowa so i take it there is a fifferent way of doing it xml
                    >
                    > is there a different way of connecting to a database in xml too.
                    >
                    > lol
                    >
                    > thanks any way

                    No, your almost there, try this:
                    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
                    <!--#include file="Connections/consoggy.asp" -->
                    <%
                    Dim Rectopofsomething
                    Dim Rectopofsomething_cmd
                    Dim Rectopofsomething_numRows
                    Set Rectopofsomething_cmd = Server.CreateObject ("ADODB.Command")
                    Rectopofsomething_cmd.ActiveConnection =
                    MM_consoggy_STRINGRectopofsomething_cmd.CommandText = "SELECT
                    nav_list_pk FROM topofmountain.cs_nav_list where _rowid >=1 and _rowid
                    <=100"
                    Rectopofsomething_cmd.Prepared = true
                    Set Rectopofsomething =
                    Rectopofsomething_cmd.ExecuteRectopofsomething_numRows = 0
                    %>
                    <%
                    Dim Repeat1__numRows
                    Dim Repeat1__index
                    Repeat1__numRows = 100
                    Repeat1__index = 0
                    Rectopofsomething_numRows = Rectopofsomething_numRows + Repeat1__numRows %>
                    <?xml version="1.0" encoding="UTF-8"?>
                    <% While ((Repeat1__numRows <> 0) AND (NOT Rectopofsomething.EOF)) %>
                    <urlset
                    xmlns=" http://www.sitemaps.org/schemas/sitemap/0.9">
                    <url>
                    <loc> http://www.mysite.com/master.asp?see=<%=(Rectopofsomething.Fields.Item("nav_list_pk").Valu e)%></loc>

                    <lastmod>2009-01-07</lastmod>
                    <changefreq>weekly</changefreq>
                    <priority>0.9</priority>
                    </url>
                    </urlset>
                    <%
                    Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1
                    Rectopofsomething.MoveNext()Wend%>
                    <%Rectopofsomething.Close()
                    Set Rectopofsomething = Nothing%>
                    • 7. Re: linking to a database using xml
                      Level 7
                      Dooza wrote:
                      > Twocans wrote:
                      >> wowa so i take it there is a fifferent way of doing it xml
                      >>
                      >> is there a different way of connecting to a database in xml too.

                      If that didn't work, email me and I will email you the source to an
                      recordset to xml asp page that I already have working, its not the same
                      as the way you have done it, but should give you a clue. The page is
                      http://www.acspecialprojects.com/feed.asp so you can see it working.

                      I built it using RobGT's RSS feed creator extension that is no longer
                      available. I had to hack it loads to do what I wanted, but its very
                      straight forward.

                      Dooza
                      • 8. Re: linking to a database using xml
                        Level 7
                        > wowa so i take it there is a fifferent way of doing it xml

                        You are NOT doing it in XML.

                        XML doesn't do stuff like this.

                        --
                        Murray --- ICQ 71997575
                        Adobe Community Expert
                        (If you *MUST* email me, don't LAUGH when you do so!)
                        ==================
                        http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                        http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                        ==================


                        "Twocans" <aa@bb.com> wrote in message
                        news:gk2c2a$prk$1@forums.macromedia.com...
                        > wowa so i take it there is a fifferent way of doing it xml
                        >
                        > is there a different way of connecting to a database in xml too.
                        >
                        > lol
                        >
                        > thanks any way
                        >
                        > k
                        >

                        • 9. Re: linking to a database using xml
                          Level 7
                          Murray *ACE* wrote:
                          >> wowa so i take it there is a fifferent way of doing it xml
                          >
                          > You are NOT doing it in XML.
                          >
                          > XML doesn't do stuff like this.

                          No, XML can't, but he is trying to use ASP to output XML, which it can
                          do if the correct headers are sent first.

                          Dooza
                          • 10. Re: linking to a database using xml
                            Level 7
                            Certainly, but the XML stuff is not sent as a header, nor is it even
                            'executed' at all. It would be output as response.write commands. Thus the
                            XML prolog is not necessary and actually problematic for this page.

                            --
                            Murray --- ICQ 71997575
                            Adobe Community Expert
                            (If you *MUST* email me, don't LAUGH when you do so!)
                            ==================
                            http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                            http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                            ==================


                            "Dooza" <doozadooza@gmail.com> wrote in message
                            news:gk2fn9$152$1@forums.macromedia.com...
                            > Murray *ACE* wrote:
                            >>> wowa so i take it there is a fifferent way of doing it xml
                            >>
                            >> You are NOT doing it in XML.
                            >>
                            >> XML doesn't do stuff like this.
                            >
                            > No, XML can't, but he is trying to use ASP to output XML, which it can do
                            > if the correct headers are sent first.
                            >
                            > Dooza

                            • 11. Re: linking to a database using xml
                              Level 7
                              Dooza wrote:
                              > Murray *ACE* wrote:
                              >>> wowa so i take it there is a fifferent way of doing it xml
                              >>
                              >> You are NOT doing it in XML.
                              >>
                              >> XML doesn't do stuff like this.
                              >
                              > No, XML can't, but he is trying to use ASP to output XML, which it can
                              > do if the correct headers are sent first.
                              >
                              > Dooza

                              eg.

                              ' XML content
                              Response.ContentType = "text/xml"

                              ' Header
                              Response.Write("<?xml version=""1.0"" encoding=""iso-8859-1""?>") & vbCrLf
                              Response.Write(" <rss version=""2.0"">") & vbCrLf
                              Response.Write(" <channel>") & vbCrLf
                              Response.Write(" <title>" & swapChars(varFeedTitle) & "</title>") &
                              vbCrLf
                              Response.Write(" <description>" & swapChars(varFeedDescription) &
                              "</description>") & vbCrLf
                              Response.Write(" <link>" & swapChars(varFeedOverviewLink) &
                              "</link>") & vbCrLf
                              Response.Write(" <language>en-gb</language>") & vbCrLf

                              etc

                              Dooza
                              • 12. Re: linking to a database using xml
                                Level 7
                                Murray *ACE* wrote:
                                > Certainly, but the XML stuff is not sent as a header, nor is it even
                                > 'executed' at all. It would be output as response.write commands. Thus
                                > the XML prolog is not necessary and actually problematic for this page.

                                Yes you are correct, once I looked at my working page I noticed
                                everything was written out using response.write.

                                Dooza
                                • 13. Re: linking to a database using xml
                                  Level 7
                                  see if this helps:

                                  http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html

                                  --
                                  Ken Ford
                                  Adobe Community Expert Dreamweaver/ColdFusion
                                  Adobe Certified Expert - Dreamweaver CS3
                                  Adobe Certified Expert - ColdFusion 8
                                  Fordwebs, LLC
                                  http://www.fordwebs.com
                                  http://www.cfnoob.com


                                  "Twocans" <aa@bb.com> wrote in message news:gk2941$m59$1@forums.macromedia.com...
                                  >
                                  >
                                  > Hello,
                                  > I am trying to create a dynamic sitemap xml page. I use the code below but I
                                  > get an error, can any one advise as to what I can do to get this correct and
                                  > show <=100 records
                                  >
                                  >
                                  > the error is as
                                  >
                                  > XML Parsing Error: not well-formed
                                  >
                                  > <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
                                  > -^
                                  >
                                  > regards
                                  >
                                  > k
                                  >
                                  >
                                  > <?xml version="1.0" encoding="UTF-8"?><%@LANGUAGE="VBSCRIPT"
                                  > CODEPAGE="65001"%><!--#include file="Connections/consoggy.asp" --><%Dim
                                  > RectopofsomethingDim Rectopofsomething_cmdDim Rectopofsomething_numRows Set
                                  > Rectopofsomething_cmd = Server.CreateObject
                                  > ("ADODB.Command")Rectopofsomething_cmd.ActiveConnection =
                                  > MM_consoggy_STRINGRectopofsomething_cmd.CommandText = "SELECT nav_list_pk
                                  > FROM topofmountain.cs_nav_list where _rowid >=1 and _rowid <=100"
                                  > Rectopofsomething_cmd.Prepared = true Set Rectopofsomething =
                                  > Rectopofsomething_cmd.ExecuteRectopofsomething_numRows = 0%><%Dim
                                  > Repeat1__numRowsDim Repeat1__index Repeat1__numRows = 100Repeat1__index =
                                  > 0Rectopofsomething_numRows = Rectopofsomething_numRows + Repeat1__numRows%>
                                  > <% While ((Repeat1__numRows <> 0) AND (NOT Rectopofsomething.EOF)) %><urlset
                                  > xmlns=" http://www.sitemaps.org/schemas/sitemap/0.9"> <url>
                                  > <loc> http://www.mysite.com/master.asp?see=<%=(Rectopofsomething.Fields.Item("nav_list_pk").Valu e)%></loc>
                                  > <lastmod>2009-01-07</lastmod> <changefreq>weekly</changefreq>
                                  > <priority>0.9</priority> </url></urlset> <%
                                  > Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1
                                  > Rectopofsomething.MoveNext()Wend%> <%Rectopofsomething.Close()Set
                                  > Rectopofsomething = Nothing%
                                  >
                                  >
                                  • 14. Re: linking to a database using xml
                                    Level 7
                                    Ken Ford - *ACE* wrote:
                                    > see if this helps:
                                    >
                                    > http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html

                                    So he was almost there, he just needs to add the header information and
                                    it should be close to working.

                                    Dooza
                                    • 15. Re: linking to a database using xml
                                      Level 7
                                      Thanks Ken,
                                      I will give that a rattle and see if I can get my head around it.

                                      K


                                      • 16. Re: linking to a database using xml
                                        Level 7
                                        the asp examples all ahve this in the ehad which means I have to save the
                                        file as an asp for it to work.


                                        %@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%I wanted an .xml file that had a loop
                                        to call the records from the database.i will kept trying if I find a
                                        solution I will write back, I am open to suggestions thought lolk


                                        • 17. Re: linking to a database using xml
                                          Level 7
                                          Twocans wrote:
                                          > the asp examples all ahve this in the ehad which means I have to save the
                                          > file as an asp for it to work.
                                          >
                                          >
                                          > %@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%I wanted an .xml file that had a loop
                                          > to call the records from the database.i will kept trying if I find a
                                          > solution I will write back, I am open to suggestions thought lolk

                                          Your misunderstanding what is going on. When you use asp to send
                                          different headers, the server streams the data to the browser in the xml
                                          format, your browser reads that as xml, and does whatever the default
                                          behaviour is for xml.

                                          For instance, when you view this:
                                          http://www.acspecialprojects.com/feed.asp your browser thinks its xml,
                                          because it is, but is generated by an asp page.

                                          You can do the same with PDFs if you have a component that creates them
                                          on the fly, like asppdf.com. For example, this page:
                                          http://www.ac-et.com/prices/generator/vendor.asp?manID=46&div=1 creates
                                          a PDF for Pulsar, yes give it different parameter values and it creates
                                          one for a different manufacturer:
                                          http://www.ac-et.com/prices/generator/vendor.asp?manID=161&div=1

                                          The ASP page just creates the data in the format you want, normally its
                                          HTML that is generated, but you can make it output whatever you want.

                                          Dooza
                                          • 18. Re: linking to a database using xml
                                            Level 7
                                            thank you for the indept reply.

                                            a quick note though, will google see it as an xml. Google requires sitemaps
                                            to be an xml file not asp. that is what has me all confused.

                                            k


                                            • 19. Re: linking to a database using xml
                                              Level 7
                                              I got the code to work by the way, when i do f12 and view in my browser i
                                              see all the xml.

                                              but

                                              one small problem

                                              I also see this on the top of my browser

                                              This XML file does not appear to have any style information associated with
                                              it. The document tree is shown below.


                                              what will google think of that.


                                              regards

                                              K


                                              • 20. Re: linking to a database using xml
                                                Level 7
                                                this answers the question of

                                                "This XML file does not appear to have any style information associated with
                                                it. The document tree is shown below. "


                                                If you see the message: "This XML file does not appear to have any style
                                                information associated with it. The document tree is shown below.", don't
                                                panic! This is being generated by the browser (most likely Firefox) and
                                                relates to 'how' the information is being displayed in your browser and does
                                                not affect what the search engines 'see'.


                                                • 21. Re: linking to a database using xml
                                                  Level 7
                                                  Twocans wrote:
                                                  > this answers the question of
                                                  >
                                                  > "This XML file does not appear to have any style information associated with
                                                  > it. The document tree is shown below. "
                                                  >
                                                  >
                                                  > If you see the message: "This XML file does not appear to have any style
                                                  > information associated with it. The document tree is shown below.", don't
                                                  > panic! This is being generated by the browser (most likely Firefox) and
                                                  > relates to 'how' the information is being displayed in your browser and does
                                                  > not affect what the search engines 'see'.

                                                  Thats right, XML doesn't contain style information, thats what an XSL
                                                  file can do if you need it to. When you view the XML in a browser it
                                                  does whatever its default behaviour is, Firefox shows it nicely
                                                  formatted, but IE will just show the tree view.

                                                  In regards to Google seeing it, well, if you add the sitemap.asp file to
                                                  Google webmaster tools then I think it will see it just fine, best thing
                                                  to do is give it ago.

                                                  Try it with this if you want:
                                                  http://www.xml-sitemaps.com/validate-xml-sitemap.html

                                                  I am glad you got it work in the end :)

                                                  Dooza