Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4266936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:49:45+00:00 2026-05-21T06:49:45+00:00

Im trying to link a JS library into a php dynaimcally generated xml document.

  • 0

Im trying to link a JS library into a php dynaimcally generated xml document. except it keeps returning an error in the header? and I am having a problem with the link due to the “”, which is normally used for a string in php. Any thoughts?

$id = '1232';
$name = 'Christopher';

// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";

echo "<xml>";

echo "<id>";
echo "<name>";  
echo "</name>"; 
echo "</id>";

echo "</xml>";

I’m trying to add in a link to a js however I am unsure how to generate the code with php??

The link would look like
<script src="processing.js"></script>

Is there a way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:49:45+00:00Added an answer on May 21, 2026 at 6:49 am

    I’m not exactly sure what your trying to do with jaavascript because I don’t think you can have javascript in an xml file but if you wanted to output the js with the xml here is what your could should look like

     $id = '1232';
     $name = 'Christopher';
    
    
    header('Content-type: text/xml');
    header('Pragma: public');
    header('Cache-control: private');
    header('Expires: -1');
    
    echo '<?xml version="1.0" encoding="utf-8"?>';
    echo "\n<xml>\n";
    
    echo "<id>$id</id>\n";
    echo "<name>$name</name>\n";    ;
    echo "</xml>";
    
    echo '<script src="processing.js"></script>';
    

    since you are outputing xml you don’t want break elements in your xml instead you want new line characters to make it readable by source.

    I think what your really want for the js is to just give the link location in the xml but i’m not 100% on that I’m a little fuzzy on what your trying to do

    ohh and you don’t need breaks in the header

    ** To answer your questions **

    again I’m still not sure if your trying to execute javascript in xml or if you are simply trying to provided full link or relative line in the xml

    so if you wanted to have a relative link adding

    <jslink>processing.js</jslink>
    

    for a full link

     <jslink>http://example.com/processing.js</jslink>
    

    and if you want to execute the js

    I think you want to put this in the xml

     <xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml"
                src="processing.js"
                type="application/javascript"/>
    

    however I believe that will only work in firefox

    pleas see this blog for more detailson that

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to link a static library [1] into another static library [2]
I am trying to link a user space library into a windows kernel driver.
I am trying to link the cspec library into my C project. This is
Im trying to link my program to the shared library. Im using a makefile
I'm trying to link my mac application to the wonderful libancillary library. However, I
I'm trying to link to a static library and I keep getting linker errors.
I am trying to compile my source code into a library but i get
I'm trying to link to the sencha touch library from a FDT Haxe project.
I'm trying to link to a shared library with a template class, but it
I am trying to link against the libconfig++ library using cmake. I installed the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.