|
Thanks anyway
|
|
|
|
|
how to create a xml document from a given xpath
Keshav Kamat
India
|
|
|
|
|
What do you mean? XPath is just a query. If you are talking about the resulting sequence or node set from an executed XPath query, what programming or mark-up language are you using?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I am trying to put a ":" inside the XML tags. e.g.
<cnn:data>
right now it is this way:
<cnn_x0020_data>
|
|
|
|
|
The ":" is used to add a namespace to an element, for example: <xsl:element/> , where xsl is the namespace. If you are not using ":" for this reason, it should not be embedded in an element.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I'm building a schema to define data transfer tasks, the first being an export to a flat file. I'm borrowing lightly from RDL, and in my DataExport element I have DataSources and DataSets elements. Then I have an Output element that contains Sections, and each Section element has a Record element consisting of several Field elements.
Now my issue is that I have two different type Field elements, one for input fields and one for output fields. The output fields have several extra attributes such as maxWidth, format, etc. and they need a link to an input field. I would like to define one single Field element, but use child elements to differentiate between input and output fields etc. I'm thinking of placing e.g. format data into a new Format element that I could add to a Field element when it is an output field.
Suggestions, recommendations, criticism etc. are all welcome.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
Add an attribute to your single Field element that will determine its type:
...
<io type="input">
<!-- child input elements -->
</io>
<io type="output">
<!-- child output elements -->
</io>
...
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks, I like that idea, but I've decided to go with a single collection of Field elements, all being output fields. The data source already provides input fields, so while RDL uses the extra indirection of mapping a set of report fields to data source fields, and then report elements, like textbox, to report fields, I don't need that. My 'report fields' are my output fields.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
Hi Friends,
I am working on Javascript and I have some XML data in an object. Now I want to show that data using document.writeline() as it is.
means
I want to show the XML with all its node tags.
Please give me solution.
Thanks in advance.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
You will need to display it as text. You will need to especially change "<" to "<"! Some other character combinations may give you trouble also.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi guys,
If possible do any of you know how I can pass a List<string> object to my xslt which will form part of my SQL query?
This is what I'm tryin to achevive:
First of all I will have a class being serialized and then deserialized using XML serialized in the case Client.cs.
In the class I have a List<string> property which will return a list of Client names:
public List<string> ClientNames
Now in the next step I have an xslt that will transform my deserialized class and which will use the class properties as parameters to my SQL query.
The code within the xsl are as follows:
SELECT * FROM Client
WHERE Client.ClientFirstName IN ('Test', 'Ben', 'Tom')
Now what I'm trying to achieve is to pass the List<string> object to my SQL IN clause using xslt... is that possible?
Any help will be greatly appreciated.
R
|
|
|
|
|
I find your post unclear.
1) Are you trying to generate a SQL statement using XSLT?
if YES then...
2) as your data source for some of the SQL values you are using XML serialized from an object defined in Client.cs?
|
|
|
|
|
I have an xml similar to this :
<?xml version="1.0" encoding="UTF-8"?>
<input:root xmlns:input="cross-field-validation-namespace">
<input:event>
<input:element>UserName.SWEUserName</input:element>
<input:elementtype>INPUT</input:elementtype>
<input:eventtype>deactivate</input:eventtype>
<input:value>LOGO</input:value>
</input:event>
<input:event>
...................................
..................................
</input:event>
..........................
.........................
</input:root>
I need to transform it to the following:
.......
<properties>
<property name="element" string_value="UserName.SWEUserName"/>
<property name="elementtype" string_value="INPUT" />
<property name="eventtype" string_value="deactivate" />
<property name="value" string_value="LOGO" />
</properties>
............
i.e all child nodes under the 'event' node get transformed to the attributes of the property node(node name as 'name' attribute and value as 'string_value').
Moreover , the number and name of child nodes under the different 'event' nodes can vary.
How can we write a XSL template to convert all chiild nodes under 'event' (however much there may be) into the desired format.
|
|
|
|
|
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:input="cross-field-validation-namespace">
<xsl:template match="/input:root">
<xsl:element name="{local-name()}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="input:event">
<xsl:element name="properties">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="*">
<xsl:element name="property">
<xsl:attribute name="name">
<xsl:value-of select="local-name()"/>
</xsl:attribute>
<xsl:attribute name="string_value">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I am new to MSXML. I am using xml interface to read a xml file in a C++ program. The code is
#include "fstream.h"
#include "string.h"
#import "msxml2.dll" named_guids raw_interfaces_only
using namespace MSXML2;
using namespace std;
void main()
{
IXMLDOMDocumentPtr m_pXmlDoc;
IXMLDOMNodePtr m_pProductNode;
HRESULT hr = m_pXmlDoc.CreateInstance(MSXML2::CLSID_DOMDocument);
_variant_t vtFileName("my_xml.xml");
VARIANT_BOOL vtRetVal;
m_pXmlDoc->load(vtFileName,&vtRetVal);
}
The program gives an exception when I load the file. On Debugging I found that the m_pXmlDoc is NULL. Why am I not get the instance? What is wrong in this piece of code?
|
|
|
|
|
You're not checking the return value from CreateInstance() . What is it returning?
|
|
|
|
|
I'm using .net 1.1
Now I have tried with the code:
System.Text.ASCIIEncoding encoder=new System.Text.ASCIIEncoding();
byte bytes=encoder.GetBytes(p_strXmlFrag); //Here its giving error
MemoryStream ms=new MemoryStream(bytes);
XmlWriter writer=XmlWriter.Create(ms); //Here it could not find create method
ms.Position=0;
XmlTextReader.xmlFile=new XmlTextReader(ms);
----
----
----
----
------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm also pasting the total method code to make it clear:
public static bool Validate(string p_strMmlFrag, out string p_strErr)
{
p_strErr=string.Empty;
//starting of if statement
if m_xsc==null)
{
m_xsc=new XmlSchemaCollection();
try
{
string path=AppDomain.CurrentDomain.BaseDirectory+m_strSchema;
if (!File.Exists(path))
{
path=AppDomain.CurrentDoamin.BaseDirectory+"/bin"+m_strSchema;
}
XmlTextReader xmlFile=new XmlTextReader(path);
m_ifSchema=XmlSchema.Read(xmlFile, new ValidationEventHandler (ValidationCallBack));
//Error rises in the above line as the destination file path (stored in path variable), I have just created (the file) and it's definitely empty. I tried the above mentioned solution but it's giving error!!!!!!!!
m_xsc.Add(m_ifSchema);
}
// ending of if statement
catch
{
-----
}
-------
------
-------
------
private const string m_strSchema="StructureLinkage.xsd"
private static XmlSchemaCollection=m_xsc;
private static XmlSchema m_ifSchema;
// For the first time only m_xsc in null and after that it does not need to enter into above block of code once m_xsc is instantiated.
}
|
|
|
|
|
You already got an answer for this question in the C# forum (answer[^]). Instead of simply reposting the question in another forum, you should try to understand what you were told in the answer and work with that info.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello,
First I'll state that I put this question on the XML section of the forum at www.asp.net and have not been able to get one response, perhaps someone here has run into this.
I currently have an instance XML document that validates cleanly against an XSD file. That XSD has 2 <import> tags referencing other component XSD files. All of the files are located in the same directory. The declaration and imports in the "parent" schema look like this:
<xsd:schema targetNamespace="http://www.xyz.com/ConnectResponse" xmlns:arf="http://www.xyz.com/ARFResponse" xmlns:cpu="http://www.xyz.com/CPUResponse" xmlns="http://www.xyz.com/ConnectResponse" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.401">
<xsd:import namespace="http://www.xyz.com/ARFResponse" schemaLocation="ARFXMLResponse.xsd"/>
<xsd:import namespace="http://www.xyz.com/CPUResponse" schemaLocation="BISXMLResponse.xsd"/>
The first imported schema declaration looks like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xyz.com/ARFResponse" targetNamespace="http://www.xyz.com/ARFResponse" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.5">
The second imported schema declaration looks like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xyz.com/CPUResponse" targetNamespace="http://www.xyz.com/CPUResponse" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.301">
When I run the xsd.exe tool on the "parent" schema: xsd.exe -c -l:c# -n:XMLSerializationTest ConnectResponse.xsd
I get nothing but errors....yet the instance of the actual XML document validates perfectly w/ the 3 schemas.
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.xyz.com/ARFResponse:Products' el
ement is not declared. Line 12, position 7.
Schema validation warning: The 'http://www.xyz.com/CPUResponse:Products' el
ement is not declared. Line 13, position 7.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'ConnectResponse'.
- The element 'http://www.xyz.com/ARFResponse:Products' is missing.
Is there some limitation to using this tool when multiple XSDs comprise a set for validation purposes - ie: parent schema w/ component schemas linked using either the <import> or <include>?
One last thing...I tried to reverse the process. I used xsd.exe on the instance XML itself to have it generate the XSD file. It generated 2 XSD files (one w/ an import). Then I tried to run the process again on the parent XSD that xsd.exe itself created...and again, nothing but errors and failure to generate any classes.
Any ideas would really be appreciated...this has been more than frustrating.
Thanks in advance...
|
|
|
|
|
Hey there people, I genereate xml from the datatables, but i need to group and structure the xml more correctly. could you please assist me in this matter. Here is the code what i am doing,
select
1 AS Tag,
NULL AS Parent,
NULL AS 'FORMSETXML!1!FORMSETXML',
NULL AS 'FORMSET!2!FORMSET',
NULL AS 'FORMSET!2!FRM_SET_CDE',
NULL AS 'FORMSET!2!SYS_LNG_CDE',
NULL AS 'FORMSET!2!FRM_SET_TYP',
NULL AS 'FORMSET!2!FRM_SET_CPT',
NULL AS 'FORMSET!2!EXT_STP_NME',
NULL AS 'FORMSET!2!TIMESTAMP',
NULL AS 'FORMSETDEFINITION!3!FORMSETDEFINITION',
NULL AS 'FORMSETDEFINITION!3!ENTITY',
NULL AS 'FORMSETDEFINITION!3!CTL_IDN',
NULL AS 'FORMSETATTRIBUTE!4!FORMSETATTRIBUTE',
NULL AS 'FORMSETATTRIBUTE!4!ATR_FRY_NME'
UNION ALL
SELECT
2 AS Tag,
1 AS Parent,
null,
frm_set.frm_set_cde,
frm_set.frm_set_cde,
frm_set.sys_lng_cde,
frm_set.frm_set_typ_cde,
frm_set.frm_set_cpt,
'TEST STORED PROC',
GETDATE(),
null,
frm_set_def.ent_cde,
frm_set_def.ctl_idn,
null,
frm_set_atr.atr_fry_nme
FROM mda_form_set frm_set
INNER JOIN mda_form_set_definition frm_set_def ON (frm_set.frm_set_cde = frm_set_def.frm_set_cde and frm_set.sys_lng_cde = frm_set_def.sys_lng_cde)
INNER JOIN mda_attribute frm_set_atr ON (frm_set_def.ent_cde = frm_set_atr.ent_cde and frm_set_def.atr_cde = frm_set_atr.atr_cde)
UNION ALL
SELECT
3 AS Tag,
2 AS Parent,
null,
frm_set.frm_set_cde,
frm_set.frm_set_cde,
frm_set.sys_lng_cde,
frm_set.frm_set_typ_cde,
frm_set.frm_set_cpt,
'TEST STORED PROC',
GETDATE(),
null,
frm_set_def.ent_cde,
frm_set_def.ctl_idn,
null,
frm_set_atr.atr_fry_nme
FROM mda_form_set_definition frm_set_def
INNER JOIN mda_form_set frm_set ON (frm_set.frm_set_cde = frm_set_def.frm_set_cde and frm_set.sys_lng_cde = frm_set_def.sys_lng_cde)
INNER JOIN mda_attribute frm_set_atr ON (frm_set_def.ent_cde = frm_set_atr.ent_cde and frm_set_def.atr_cde = frm_set_atr.atr_cde)
UNION ALL
SELECT
4 AS Tag,
3 AS Parent,
null,
frm_set.frm_set_cde,
frm_set.frm_set_cde,
frm_set.sys_lng_cde,
frm_set.frm_set_typ_cde,
frm_set.frm_set_cpt,
'TEST STORED PROC',
GETDATE(),
null,
frm_set_def.ent_cde,
frm_set_def.ctl_idn,
null,
frm_set_atr.atr_fry_nme
FROM mda_attribute frm_set_atr
INNER JOIN mda_form_set_definition frm_set_def ON (frm_set_def.ent_cde = frm_set_atr.ent_cde and frm_set_def.atr_cde = frm_set_atr.atr_cde)
INNER JOIN mda_form_set frm_set ON (frm_set.frm_set_cde = frm_set_def.frm_set_cde and frm_set.sys_lng_cde = frm_set_def.sys_lng_cde)
ORDER BY 'FORMSETATTRIBUTE!4!ATR_FRY_NME', 'FORMSETDEFINITION!3!CTL_IDN', 'FORMSET!2!FRM_SET_CDE',parent
FOR XML EXPLICIT
/*
Now let me give you a sample of the xml output i retrieve
*/
<formsetxml>
<formset formset="1" frm_set_cde="1" sys_lng_cde="AFR" frm_set_typ="Grid" frm_set_cpt="1" ext_stp_nme="TEST STORED PROC" timestamp="2007-08-15T10:11:22.747">
<formsetdefinition entity="spl_master" ctl_idn="cmp_trd_nmelabel3">
<formsetattribute atr_fry_nme="Comapny Trading Name:">
<formset formset="1" frm_set_cde="1" sys_lng_cde="AFR" frm_set_typ="Grid" frm_set_cpt="1" ext_stp_nme="TEST STORED PROC" timestamp="2007-08-15T10:11:22.747">
<formsetdefinition entity="spl_master" ctl_idn="cmp_trd_nmetextbox3">
<formsetattribute atr_fry_nme="Comapny Trading Name:">
<formset formset="1" frm_set_cde="1" sys_lng_cde="AFR" frm_set_typ="Grid" frm_set_cpt="1" ext_stp_nme="TEST STORED PROC" timestamp="2007-08-15T10:11:22.747">
<formsetdefinition entity="spl_master" ctl_idn="hld_cmplabel6">
<formsetattribute atr_fry_nme="Holding Company:">
<formset formset="1" frm_set_cde="1" sys_lng_cde="AFR" frm_set_typ="Grid" frm_set_cpt="1" ext_stp_nme="TEST STORED PROC" timestamp="2007-08-15T10:11:22.747">
<formsetdefinition entity="spl_master" ctl_idn="hld_cmptextbox6">
<formsetattribute atr_fry_nme="Holding Company:">
However, i would like the output to be like the following,
<formsetxml>
<formset formset="1" frm_set_cde="1" sys_lng_cde="AFR" frm_set_typ="Grid" frm_set_cpt="1" ext_stp_nme="TEST STORED PROC" timestamp="2007-08-15T10:11:22.747">
<formsetdefinition entity="spl_master" ctl_idn="cmp_trd_nmelabel3">
<formsetattribute atr_fry_nme="Comapny Trading Name:">
<formsetdefinition entity="spl_master" ctl_idn="cmp_trd_nmetextbox3">
<formsetattribute atr_fry_nme="Comapny Trading Name:">
<formsetdefinition entity="spl_master" ctl_idn="hld_cmplabel6">
<formsetattribute atr_fry_nme="Holding Company:">
<formsetdefinition entity="spl_master" ctl_idn="hld_cmptextbox6">
<formsetattribute atr_fry_nme="Holding Company:">
Please note that there are cases where there might be many '<formsetattribute>'s for a specific formset definition where this must then also happen
<formsetdefinition entity="spl_master" ctl_idn="cmp_trd_nmetextbox3">
<formsetattribute atr_fry_nme="Comapny Trading Name1:">
<formsetattribute atr_fry_nme="Comapny Trading Name2:">
Help will be greatly appreciated. Thanks
|
|
|
|
|
I am trying to convert Excel to XML.
For that I have done the 1st step of saving Excel to the dataset dsSource.
Now I am trying to convert data from the dataset dsSource to XML document and I am having problems doing that. I get an error "the name 'dsSource' does not exist in the current context"
#region private dsSource GetXml()
string Xml = dsSource.GetXml().ToString;
#endregion
Any suggestions??
|
|
|
|
|
Hi,
I have a following client side code
how to upload xml file to server programatically.
// files upload function
function btn_send.onclick()
{
// create ADO-stream Object
var ado_stream = new ActiveXObject("ADODB.Stream");
// create XML document with default header and primary node
var xml_dom = new ActiveXObject("MSXML2.DOMDocument");
xml_dom.loadXML(' ');
// specify namespaces datatypes
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
// create a new node and set binary content
var l_node1 = xml_dom.createElement("file1");
l_node1.dataType = "bin.base64";
// open stream object and read source file
ado_stream.Type = 1; // 1=adTypeBinary
ado_stream.Open();
ado_stream.LoadFromFile("c:\\tmp\\myfile.doc");
// store file content into XML node
l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll
ado_stream.Close();
xml_dom.documentElement.appendChild(l_node1);
// we can create more XML nodes for multiple file upload
// send XML documento to Web server
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST","./default.aspx",false);
xmlhttp.send(xml_dom);
// show server message in message-area
div_message.innerHTML = xmlhttp.ResponseText;
}
|
|
|
|
|
I have the following requirement for an assignment. Could u please help me in creating xml document for this. I have images stored in c drive.
. Create an xml document that models the image groups. Each grouping should include the name and location of the images within the group.
• Create a web page that allows the user to select and display a group of images.
• Use the xml file to specify the groups of images the user can select.
• Allow the user to select a group of images.
• Display the group of images when a selection is made.
seema
|
|
|
|
|
I think you should try to be a lot more specific that thsi if you wanna get some kind of a response... People are not free enuff to just solve out your whole assignments. you should tell us what progress you've made and what's the problem your getting or atmost asking for a little conceptual help!
Hope u got my point.
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
I have three image groups. I have to create an XML document that models the image groups.Each grouping should include the name and location of the images within the group.
How can I do that.
Thanks
seema
|
|
|
|
|