[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/17/2002 at 03:05PM PDT, ID: 20359858
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

Help with FOR XML EXPLICIT

Asked by raizon in MS SQL Server, Extensible HTML (XHTML)

Having a problem with this sql script.

I keep getting the error Parent ID 4 is Not Opened etc...

Could use some pointers.

SQL Script.

SELECT  1 As Tag,
     Null As Parent,
     vehicle_info.aic_id As [vehicle!1!aic_id],
     vehicle_info.vehicle_division_name As [vehicle!1!make!element],
     vehicle_info.vehicle_year As [vehicle!1!year!element],
     vehicle_info.vehicle_model_name As [vehicle!1!model!element],
     vehicle_info.vehicle_body_style As [vehicle!1!style!element],
     vehicle_info.vehicle_image As [vehicle!1!image!element],
     NULL As [headers!2!!element],
     NULL As [header!3!bmw_heading_name],
     NULL As [rows!4!!element],
     NULL As [row!5!bmw_row_name],
     NULL As [row!5!!cdata]
FROM vehicle_info

UNION ALL

SELECT 2 As Tag,
     1 As Parent,
     vehicle_info.aic_id As [vehicle!1!aic_id],
     NULL As [vehicle!1!make!element],
     NULL As [vehicle!1!year!element],
     NULL As [vehicle!1!model!element],
     NULL As [vehicle!1!style!element],
     NULL As [vehicle!1!image!element],
     NULL As [headers!2!!element],
     NULL As [header!3!bmw_heading_name],
     NULL As [rows!4!!element],
     NULL As [row!5!bmw_row_name],
     NULL As [row!5!!cdata]
FROM vehicle_info

UNION ALL

SELECT 3 As Tag,
     2 As Parent,
     NULL As [vehicle!1!aic_id],
     NULL As [vehicle!1!make!element],
     NULL As [vehicle!1!year!element],
     NULL As [vehicle!1!model!element],
     NULL As [vehicle!1!style!element],
     NULL As [vehicle!1!image!element],
     NULL As [headers!2!!element],
     vehicle_data.bmw_heading_name As [header!3!bmw_heading_name],
     NULL As [rows!4!!element],
     NULL As [row!5!bmw_row_name],
     NULL As [row!5!!cdata]
FROM vehicle_info
JOIN vehicle_data on vehicle_info.aic_id = vehicle_data.aic_id

UNION ALL

SELECT 4 As Tag,
     3 As Parent,
     NULL As [vehicle!1!aic_id],
     NULL As [vehicle!1!make!element],
     NULL As [vehicle!1!year!element],
     NULL As [vehicle!1!model!element],
     NULL As [vehicle!1!style!element],
     NULL As [vehicle!1!image!element],
     NULL As [headers!2!!element],
     vehicle_data.bmw_heading_name As [header!3!bmw_heading_name],
     NULL As [rows!4!!element],
     NULL As [row!5!bmw_row_name],
     NULL As [row!5!!cdata]
FROM vehicle_info
JOIN vehicle_data on vehicle_info.aic_id = vehicle_data.aic_id

UNION ALL

SELECT 5 As Tag,
     4 As Parent,
     NULL As [vehicle!1!aic_id],
     NULL As [vehicle!1!make!element],
     NULL As [vehicle!1!year!element],
     NULL As [vehicle!1!model!element],
     NULL As [vehicle!1!style!element],
     NULL As [vehicle!1!image!element],
     NULL As [headers!2!!element],
     NULL As [header!3!bmw_heading_name],
     NULL As [rows!4!!element],
     vehicle_data.bmw_row_name As [row!5!bmw_row_name],
     vehicle_data.row_data As [row!5!!cdata]
FROM vehicle_info
JOIN vehicle_data on vehicle_info.aic_id = vehicle_data.aic_id

ORDER BY [vehicle!1!aic_id], [headers!2!!element], [header!3!bmw_heading_name],[rows!4!!element],[row!5!bmw_row_name]
FOR XML EXPLICIT



xml its supposed to generate.

<vehicle aic_id="1388">
     <make>BMW</make>
     <year>2002</year>
     <model>325i</model>
     <style>Sedan</style>
     <image>3282UI.GIF</image>
     <headers>
          <header name="Misc">
               <rows>
                    <row name="MSRP Base Price">$10,000</row>
                    <row name="Cup Holder"><![CDATA[2" diameter]]></row>
               </rows>
          </header>
          <header name="Safety">
               <rows>
                    <row name="Seatbelt">Standard</row>
                    <row name="ABS">Optional</row>
                    <row name="Wipers">Need replace</row>
               </rows>
          </header>
     </headers>
</vehicle>


any and all help is appreciated.

[+][-]09/17/02 03:17 PM, ID: 7286859

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, Extensible HTML (XHTML)
Sign Up Now!
Solution Provided By: acperkins
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09/17/02 03:24 PM, ID: 7286875

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/02 03:25 PM, ID: 7286878

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/17/02 05:41 PM, ID: 7287060

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/18/02 06:55 AM, ID: 7288259

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91