1

I want to display the XML file by taking tag from the XML_TAGS table, and attributes from theMAPPED_TAGS_ATTRIBUTES table - something like <element attributes></element>:

String sql = "SELECT Dtd_Tag,Dtd_Attribute_Name 
                FROM Xml_Tags,
                     Mapped_Tags_Attributes 
               WHERE Mapped_Tags_Attributes.Pdf_Tag = Xml_Tags.Pdf_Tag 
            ORDER BY Mapped_Tags_Attributes.Pdf_Tag 
             FOR XML AUTO"; 
2
  • i want to display xml file by taking tag from xml tags table and attributes from Mapped_tags Attributes table... something like <element attributes></element> Commented May 4, 2011 at 6:43
  • Please add the structure of the tables you want to use, some sample data and the expected output. Commented May 4, 2011 at 6:54

1 Answer 1

1

Query:

select
    c.CustomerId as "@Id",
    c.AcountNumber as "@AcountNumber"
from Customer c
for xml path('Customer'), root('Customers')

Result:

<Customers>
   <Customer Id="1" AccountNumber="X120" />
   <Customer Id="2" AccountNumber="X121" />
</Customers>
Sign up to request clarification or add additional context in comments.

3 Comments

i want the query to take the elements and attributes from database..how can i do that...
1 <Image> mediaobject 1 <b> title 1 <para id =0> para 1 <i> pubdate 1 <para id =1> simpara 1 <para id =2> titleabbrev 1 <para id =3> section 1 <para id =4> sect1 1 <para id =5> sect2 1 <para id =6> sect3 1 <para id =7> glossdef NULL NULL NULL
<Image> xlink:actuate onLoad #IMPLIED null <Image> xml:lang CDATA #IMPLIED null <Image> xml:base CDATA #IMPLIED null <Image> remap CDATA #IMPLIED null <b> xmlns CDATA #FIXED "docbook.org/ns/docbook" <b> xlink:actuate none #IMPLIED null <para id =0> revision CDATA #IMPLIED null <para id =0> vendor CDATA #IMPLIED null <para id =0> wordsize CDATA #IMPLIED null <para id =0> xlink:actuate none #IMPLIED null <i> xreflabel CDATA #IMPLIED null <i> revisionflag added #IMPLIED null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.