|
Hey howzit?
All i wanna do is put some XML in a node and return it thats it. How do I achieve this? Could you provide an example?
-- modified at 7:29 Tuesday 28th March, 2006
|
|
|
|
|
You need to specify a programming language.
-- modified at 23:36 Wednesday 29th March, 2006
|
|
|
|
|
Oh sorry mate, so used to posting on C# forum. I wanna do it in C# please
|
|
|
|
|
XmlDocument xDoc = new XmlDocument();<br />
XmlElement el = xDoc.CreateElement("Root");<br />
el.InnerXml= retXml;
xDoc.AppendChild(el);<br />
return xDoc;
sathy
|
|
|
|
|
Can the < and > characters be used in XML data?
If so how are they written to not be confused as tags?
Thanks
Eric
|
|
|
|
|
You use: &lt; and &gt;
-- modified at 16:36 Tuesday 28th March, 2006
|
|
|
|
|
|
Hi Friends,
I am using XML as database in my application and for datadefinition in xml file I create .xsd file (schema file) and set the target schema property to the .xsd file.
Till that every thing is working fine.
NOw I am trying to export the xml file to msexcel worksheet. and for that I have created an .xslt file which formats data of xml file.
The problem is that the stylesheets works properly only if the xml file is not bind to the schema file. If I bind the xml file to the schema file it give nothing as output and without schema data validation is not possible.
Is there any way to bind schema and stylesheet together?
if any one is having this idea plz let me know.
Thank u all in advance.
Thanks and regards,
Chetan Ranpariya.
|
|
|
|
|
Since your XML file uses a Schema, it has a default namespace. I believe you have to have your XSLT recognize the namespace of the nodes it is transforming.
|
|
|
|
|
Hi George,
Thank you for the reply.
The way u suggest it right but I dont know how to do that?
The xslt file that I had made is like this.
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8"></xsl:output>
<xsl:template match="/">
<xsl:param name="CompCode"/>
<html>
<body>
<h2>Activities</h2>
<table border="1" cellpadding ="2">
<tr bgcolor="#9acd32">
<th>Sequence Number</th>
<th>Details</th>
</tr>
<xsl:for-each select="CompsAndRels/RelationshipMaster[ProjectCode=$CompCode]">
<xsl:sort select="SequenceNumber" data-type="number"></xsl:sort>
<xsl:variable name="recursive_result"> <xsl:value-of select="RelCode"></xsl:value-of></xsl:variable>
<tr>
<td colspan="2">
<b>
<xsl:value-of select="SequenceNumber"></xsl:value-of>.
<xsl:value-of select="RelDescription"></xsl:value-of></b>
</td>
</tr>
<xsl:for-each select="../ActivityMaster[ActivityRelCode=$recursive_result]">
<xsl:sort select="ActivitySeqNo" data-type="number"></xsl:sort>
<tr>
<td bgcolor="#ffffcc">
<xsl:value-of select="ActivitySeqNo"></xsl:value-of>
</td>
<td bgcolor="#ffffcc">
<xsl:value-of select="ActivityDetail"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
and My XML file is as following.
<CompsAndRels xmlns="http://tempuri.org/ComponentsAndRelationships.xsd">
<ComponentMaster>
<ComponentCode>35476350</ComponentCode>
<ComponentName>BRUSH</ComponentName>
<ComponentDescription>fa;sl asd.fas dlf;as f.sdf aslj</ComponentDescription>
<ComponentParent>0</ComponentParent>
<ComponentCost>500</ComponentCost>
<CompnentWorth>500</CompnentWorth>
<UserID>mrchetanrana</UserID>
<ProjectCode>5847</ProjectCode>
<ComponentColor>ffffff</ComponentColor>
<ComponentCategory>1220</ComponentCategory>
<EquivalentParent>0</EquivalentParent>
</ComponentMaster>
<RelationshipMaster>
<RelCode>1439936424</RelCode>
<RelTitle>Admin is one type of user</RelTitle>
<RelDescription>User can have role of Admin.</RelDescription>
<RelCompFrom>538826428</RelCompFrom>
<RelCompTo>1616367881</RelCompTo>
<RelType>Initial</RelType>
<CompFunctionCode>321460854</CompFunctionCode>
<UserID>mrchetanrana</UserID>
<ProjectCode>918894685</ProjectCode>
<SequenceNumber>60</SequenceNumber>
</RelationshipMaster>
<ActivityMaster>
<ActivityCode>120787135</ActivityCode>
<ActivitySeqNo>1</ActivitySeqNo>
<ActivityDetail>Enter the Login ID</ActivityDetail>
<ActivityRelCode>889049886</ActivityRelCode>
</ActivityMaster>
</CompsAndRels>
The schema file name is ComponentsAndRelationships.xsd that i have attached with xml file for datavalidation.
Can u suggest me how to put namesapce of this xml file in xslt file?
Thanks again
Chetan Ranpariya.
-- modified at 23:04 Monday 27th March, 2006
|
|
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:car="http://tempuri.org/ComponentsAndRelationships.xsd">
...
Any references to your document (CompsAndRels) must be made through the "car" namespace (car:CompsAndRels).
-- modified at 16:33 Tuesday 28th March, 2006
|
|
|
|
|
Hi All,
In my web application I am using XML as a database. I am using XML schema for data definition. I am using dataset and dataview to retrive datafrom and XML file.
I am doing like following.
Dataset dstDemo = new Dataset();
dstDemo.ReadXMLSchema(MapPath("../Database/File.xsd"));
dstDemo.ReadXML(MapPath("../Database/File.xml"));
DataView dvCustomers = new DataView(dstDemo.Tables["Customers"]);
DataView dvOrders = new DataView(dstDemo.Tables["Orders"]);
Here Tables "Customers" and "Orders" are the two tables at the same level in xml file and both contain "CustomerID" column.
This way I can fetch whole the table from DataSet to DataView and to select some rows from the dataview I am using RowFilter Property of dataview.
dvCustomers.RowFilter = "CustomerCity = 'Bangalore';
dvOrders.RowFilter = "OrderDate = '03/02/2006';
But what if I want only few records from "Orders" Table depending upon "CusotmerIDs" got from the "Customers" table.
I mean how can I use Queries like in SQL with XML files.
Do any one have any idea.
Any type of help will be appriciated.
Thank u all in advance.
Chetan Ranpariya.
|
|
|
|
|
How do i copy a file into another folder in same directory by using XML command. can i replace the latest file into that folder also??
angela
|
|
|
|
|
Just change the pathname to point to the sub-folder. Anyway, what is the run-time context? Are you using ASP.NET, Windows Forms, console, etc.?
|
|
|
|
|
act i using ASP.NET Web form....
i use another method to solve my problem without copy file. but i hav another problem is how can i use xml to select my sql statement and get database from sql server to get data and display in my crystal report... what should i write in XML?? I no familiar with XML..
angela
|
|
|
|
|
One way is to create a typed dataset and use that as a data-source for the Crystal report document so you can format your output and any other required functions. In your program, using a DataAdapter, fill the dataset with data using a standard SQL statement. Now, you set up the Crystal Report Object to use your dataset data.
The above information is just a rough summary of how you can sucessfully use Crystal Reports. Search the Code Project or Business Object web sites for examples.
|
|
|
|
|
ok, thanks a lot for ur guideline;)
angela
|
|
|
|
|
I want to know how to use XML digital signatures for signing and verifying an XML document ?
chen
|
|
|
|
|
How do I write this XML doc to a string rather than a file?
Dim xmlr As System.Xml.XmlTextWriter
xmlr = New System.Xml.XmlTextWriter("C:\test.xml", Text.Encoding.UTF8)
' add elements, etc....
m_xmlr.Close()
|
|
|
|
|
How about "System.IO.StringWriter"
|
|
|
|
|
Hi All,
I have a xml and a xsl file all done...
the xsl file displays the names of my staff members and the names of the categories of the serviceses and the brands and the amount of each sold.
       StaffA  StaffB  StaffC  Total
CatA        9        8         7     24
CatB        8        2         0     10
CatC        0        2         0      2
Total      17       12        7     26
BrandA      7       6       2       15
BrandB      2       1       4         7
BrandC      2       1       2        5
Total       11       8       8       27
Now the problem is. I need to print this... BUT if there are more than say 5 Staff members, some of the info does't show up on the printed page. Is it possible to make the xsl and xml files create a table and if there are more than 5 staff members start a new table containing the rest of the staff members and their info.
Example:
       StaffA  StaffB  StaffC  StaffD  StaffE  Total
CatA        1       0         0        0        3         4
CatB        0       1         1        0        0         2
Total       1       1         1        0        3         6
BrandA     2       2        1          1        0         6
BrandB     1       1        1          3        1         7
Total       3       3        2          4        1         13
StaffF StaffG Total
CatA 0 8 8
CatB 2 2 4
Total 2 10 12
BrandA 1 2 3
BrandB 2 2 4
Total 3 4 7
|
|
|
|
|
Hi
I using xml schema to validate xml.
My xml is looking like this:
<some_name>
... some integer and string elements
<xmlData>
... random xml data, like : <a>asd</a><b>dsds</b>
</xmlData>
</some_name>
I have no problem with integer and string data, but I don't know to which type to set xmlData element.
xmlData can contain random xml which structure is unknown. I just want to know that xmlData element is presenting and have some elements
Any suggestions?
10x in advance.
|
|
|
|
|
I think the type is 'anyType'
Denevers
|
|
|
|
|
Hmm and how to use it?
I try this schema:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="MyID" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstElement" type="xs:string"/>
<xs:element name="XMLElement" type="xs:anyType" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
for this xml:
<Root>
<FirstElement>sdsdd</FirstElement>
<XMLElement>1</XMLElement>
</Root>
and it works whenever XMLElement is string or integer, but if I add an element in XMLElement, like here:
<Root>
<FirstElement>dsds</FirstElement>
<XMLElement><a>sdsd</a></XMLElement>
</Root>
an error appear - The 'a' element is not declared. An error occurred at , (3, 15)
|
|
|
|
|
Sorry about this.. I just answered from the top of my head, which ended up being empty.
you must use xs:any and provide a processContents instruction, lax = will try to apply a schema, but won't complain if it does not find any. processContent = "skip" will tell the validator to skip validation.
<xs:element name="MyContainer">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstElement" type="xs:string"/>
<xs:element name="XMLElement">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
see http://www.w3schools.com/schema/el_any.asp for details
Denevers
-- modified at 8:27 Monday 3rd April, 2006
|
|
|
|