|
I have a large xml document and I am extracting out individual nodes from it. I don't want any manipulation.
its like
start-large
start-small
.
.
close-small
start-small
.
.
close-small
and so on.
It works fine if I do.
XmlDocument xmlDoc= new XmlDocument();
xmlDoc.Load(xr.ReadSubtree());
xmlDoc.Save("c:\\one.xml");
But for the following the XMl document I get it messed up.
XmlTextWriter xw = new XmlTextWriter("C:\\two.xml", null);
xw.WriteNode(xr.ReadSubtree(), true);
I get errors like "end element missing" or "not properly closed".
What am I doing wrong in case of text writer? xr is the xmltextReader which is reading the large file.
Your help is appreciated.
|
|
|
|
|
Dear Friend,
Thanks for being her for help us....
I am in big trouble now, as i have to create a webservice for one of my client for some travel related web site, the requirement is to receive soap request from one of the client and send response...., i don't know how to work on SOAP just have knowledge of WebService but don't know how to use SOAP in that....
the requirement specification is as follows
WebServices Interfacing with Customer should support the following HTTP
Headers
Accept: text/html
Accept: multipart/*
Content-Length: <some arbitrary size>
Content-Type: text/xml; charset=utf-8
SAMPLE REQUEST
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAPENV="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns2:ShowHotelDetail xmlns:ns2="http://ws">
<username xsi:type="xsd:string">xyz</username>
<password xsi:type="xsd:string">abc@123</password>
<hotelrefno xsi:type="xsd:string">APQR1234</refno>
<sessionId xsi:type="xsd:string">12379975773148QM750WP9R</sessionId>
</ns2:ShowRemittanceDetail>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SAMPLE RESPONSE
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:ShowHotelDetailResponse xmlns:ns2="http://ws">
<ShowHotelDetailReturn>12379975773148QM750WP9R|HOTEL XYZ|0|10000.78|pascalachenita|
carmen|||||street santander, number 12, no 78-90 street,Mumbai|+12121212121</ShowHotelDetailReturn>
</ns2:ShowHotelDetailResponse>
</S:Body>
</S:Envelope>
Please Help me the process is we have the list of Inforamtion about the hotels they send us request for selected hotel we will send them response with "|" delimeter text string as ShowHotelDetailReturn in dataset..
Me created this web service usting .Net Technology and C# language..
but at custoemr end its giving error as followed.
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unable to handle request without a valid action parameter. Please supply a valid soap action.</faultstring><detail /></soap:Fault>
</soap:Body></soap:Envelope>
when i ask them for the error they told me that "Your application is expecting a SOAPAction parameter in the header part".
please help me for the same as it's really difficult for me to work on this without any idea....
please send me some code, link or article regarding the same
Thanks and regards,
Sasmi
|
|
|
|
|
Hi every one!!
my question is i have tree structure data, so now i want to createxml file according to tree structure
and its xml file should like a middle storage file and USING THIS XML FILE all database servers like sql server2005,oracle,pervesive server and so. should use
tell me how should i do this bro's and sis's
this is my tree structure.
+user
......-user1
......-user2
.
.
......-usern
+Policies
.......+Adminstrator
............ -adminUser1
............ -Adminuser2
............ -adminuser..n
.......+supports
............ -supportuser1
............ -supportuser2
............ -supportuser..n
+companies
.......+Company1
...........+adminstrator
..................-adminuser1
..................-adminuser2
..................-adminuser..n
.......+company2
+adminstrator
..................-adminuser1
..................-adminuser2
..................-adminuser..n
.......+company3
...........+adminstrator
..................-adminuser1
..................-adminuser2
..................-adminuser..n
...........+support
..................-supportuser1
..................-supportuser2
..................-supportuser.n
+menus
.......+Transaction
...........+payroll
..................-Add Employee
...........+batches
..................-New batch
.......+Enquiry
...........+batches
..................-New batch
...........+Invoice
..................-new invoice
.......+LOgout
This is my tree structure PLzz can u tell me how ll do in Xml format
Some Thing need 2 do NEW
modified on Monday, July 27, 2009 10:50 AM
|
|
|
|
|
Good Day all
I have an SP that is defined like this
ALTER PROCEDURE [dbo].[sp_Constraints_Update] @xml ntext,
@TTBLType varchar(5)
AS
set nocount on
DECLARE @xmldoc int
DECLARE @sql varchar(8000)
-- In one long sql string do all of the following
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @xmldoc OUTPUT, @xml
if exists (select * from [tempdb].[dbo].sysobjects where id = object_id(N'[tempdb].[dbo].[#Constraints]'))
drop table [#Constraints]
-- turn the xml into a table with characteristics of the given table
SELECT *
INTO #Constraints
FROM OPENXML ( @xmldoc , '/Root/Row' , 2)
WITH (
[ID] int, -- ID of the activitiy or contact (XM) to update
DayOp char(7) 'Day_Action',
[Day] int 'Day',
SessOp char(7) 'Period_Action',
Sess int 'Period'
)
EXEC sp_xml_removedocument @xmldoc
--select * from #Constraints
update #Constraints set [Day] = null where [Day] = 0 -- can't have [Day] <, = or > 0
update #Constraints set [Sess] = null where [Sess] = 0 -- can't have [Day] <, = or > 0
-- todo make this generic for class or exam
update tbl_actv
set [Day] = #Constraints.[Day],
DayOp = case(#Constraints.[DayOp])
when 'on' then '='
when 'before' then '<'
when 'after' then '>'
end,
Session = #Constraints.Sess,
SessOp = case(#Constraints.[SessOp])
when 'on' then '='
when 'before' then '<'
when 'after' then '>'
end
from #Constraints
where #Constraints.ID = tbl_actv.ID
and i have have tried to execute it like this
exec sp_Constraints_Update 'EXAM','<Root><Row><ID>3</ID><Activity>ACC121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>15</Day><Period_Action>on</Period_Action><Period>15</Period></Row><Row><ID>9</ID><Activity>ADM121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>4</Day><Period_Action>on</Period_Action><Period>4</Period></Row><Row><ID>13</ID><Activity>ADM122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>7</Period></Row><Row><ID>50</ID><Activity>BEC122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>12</Day><Period_Action>on</Period_Action><Period>143</Period></Row><Row><ID>44</ID><Activity>BEC121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>12</Day><Period_Action>on</Period_Action><Period>12</Period></Row><Row><ID>126</ID><Activity>MRK122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>4</Period></Row><Row><ID>287</ID><Activity>ENGL321 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>21</Period></Row><Row><ID>288</ID><Activity>ENTR_E_221 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>289</ID><Activity>FRAN111 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>290</ID><Activity>GRMN111 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>291</ID><Activity>LATN111 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>292</ID><Activity>LATN211 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>293</ID><Activity>LATN311 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>294</ID><Activity>LATN321 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>295</ID><Activity>LEER_E_111 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>296</ID><Activity>LEER_R_111 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>297</ID><Activity>LLBR111 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>298</ID><Activity>LLBR113 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>299</ID><Activity>LLBR114 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row><Row><ID>300</ID><Activity>LLBR211 T1 [1]</Activity><Day_Action>on</Day_Action><Day></Day><Period_Action>on</Period_Action><Period></Period></Row></Root>'
and i got the Following Error
The XML parse error 0xc00ce556 occurred on line number 1, near the XML text "EXAM".
Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
The error description is 'Invalid at the top level of the document.'.
Msg 8179, Level 16, State 5, Procedure sp_Constraints_Update, Line 24
Could not find prepared statement with handle 0.
The statement has been terminated.
Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
Msg 208, Level 16, State 0, Procedure sp_Constraints_Update, Line 40
Invalid object name '#Constraints'.
I thought the Problem was on C# side , while troubleshooting i came to the SP and found that the execution of the sp is a problem.
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I might be missing something but you appear to have your parameters the wrong way around, 'EXAM' should be after the XML string not before.
|
|
|
|
|
Am Sorry its one of the days.
Thanks its working
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I want to write a web application (application A) containing XML file .
This web application will be invoked from an HTTP request (from another application - application B) .
Application A should then send the XML file to Application B and return back to Application A with returned data .
My first task is how do I create the XML - But I'm not sure how I go about doing it ???
using ASP.net???
|
|
|
|
|
I am not clear. You are asking about creating XML but you didn't told what sort of data actually XML file will contain. I mean this is this file will be some serialized form of an object used for message passing or it could contain any data that you want to upload. Any how if you do have the XML file and want to post it webapplication you will need to make use of HttpWebRequest and HttpWebResponse. First create some generic handler in you web app and then create and post XML file contents via HttpWebRequest. Process contents in handler and return some suitable desired response. For example codes try googling or use code project search for "Posting Data via HttpWebRequest" keyword.
|
|
|
|
|
A little more context would help.
Are you familiar with XML? Have you worked with XML before?
|
|
|
|
|
Hi All,
I have an simple xml file for which I generated an xsd file using Altova XMLSpy tool.
As I wanted the end user who makes the xml entry to enter an unique ID which is an attribute of one of the elements. I modified the generated xsd file to accomodate this rule by including "xs:unique" node and entered valid values(i believe)but to no avail.
Below is my xml file.
<?xml version="1.0"?>
<wwdfdb:DDB xmlns:wwdfdb="http://www.xybec.com/ns/wwdfdb" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xybec.com/ns/wwdfdb Sample.xsd">
<wwdfdb:MyList>
<wwdfdb:Num id="3020">
<wwdfdb:Ver>1.0.0.1</wwdfdb:Ver>
<wwdfdb:Status>InUse</wwdfdb:Status>
</wwdfdb:Num>
<wwdfdb:Num id="3021">
<wwdfdb:Ver>1.0.0.1</wwdfdb:Ver>
<wwdfdb:Status>InUse</wwdfdb:Status>
</wwdfdb:Num>
</wwdfdb:MyList>
</wwdfdb:DDB>
Below is the xsd file for the xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2009 sp1 (http:
<xs:schema xmlns="http://www.xybec.com/ns/wwdfdb" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.xybec.com/ns/wwdfdb">
<xs:element name="Ver">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="1.0.0.1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Status">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="InUse"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Num">
<xs:complexType>
<xs:sequence>
<xs:element ref="Ver"/>
<xs:element ref="Status"/>
</xs:sequence>
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:short">
<!--<xs:enumeration value="3020"/>
<xs:enumeration value="3021"/>-->
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="MyList">
<xs:complexType>
<xs:sequence>
<xs:element ref="Num" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!--added below lines to achieve uniqueness for attribute 'id' but to no avail-->
<xs:unique name="MyUniqueID">
<xs:selector xpath="Num"/>
<xs:field xpath="@id"/>
</xs:unique>
</xs:element>
<xs:element name="DDB">
<xs:complexType>
<xs:sequence>
<xs:element ref="MyList"/>
</xs:sequence>
<xs:attribute name="version" use="required">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:enumeration value="1.0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
Plese note that I have included the 'xs:unique' element in the xsd file above to enforce the rule above but to no avail.
Could somebody correct me and guide such that I can enforce an rule in xsd such that any new block added in the xml file should have an unqiue id.
|
|
|
|
|
In xmllint (libxml2's standalone app), I needed to add an explicit namespace specification for the elements in the unique spec:
<xs:unique name="MyUniqueID" xmlns:wwdfdb="http://www.xybec.com/ns/wwdfdb" >
<xs:selector xpath="wwdfdb:Num"/>
<xs:field xpath="@id"/>
</xs:unique>
That did the right thing (validating uniqueness, rejecting sameness) in the limited testing I did!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
It works.
Thanks a lot Stuart for the solution.
|
|
|
|
|
Hello, i have a semi-weird xml file to parse with xsl. The xml has an extra tag which defines what the data is below , how do i go about disregarding anything with ColName in my xsl ?
XML
<br />
<?xml version="1.0" encoding="ISO-8859-1"?><br />
<br />
<Report><br />
<br />
<ColName> DateTime </ColName><br />
<ColName> PointName </ColName><br />
<ColName> PointValue </ColName><br />
<br />
<Record><br />
<Date> data </Date><br />
<Name> data </Name><br />
<Value> data </Value><br />
</Record><br />
<br />
<Report><br />
<br />
<ColName> DateTime </ColName><br />
<ColName> PointName </ColName><br />
<ColName> PointValue </ColName><br />
<br />
<Record><br />
<Date> data </Date><br />
<Name> data </Name><br />
<Value> data </Value><br />
</Record><br />
<br />
<Record><br />
<Date> data </Date><br />
<Name> data </Name><br />
<Value> data </Value><br />
</Record><br />
<br />
<br />
<br />
</Report><br />
<br />
<code><br />
<br />
<br />
XSL<br />
<br />
<code><?xml version="1.0"?><br />
<xsl:stylesheet version = "1.0"<br />
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"><br />
<xsl:output method="text"/><br />
<xsl:strip-space elements = "Report"/><br />
<xsl:template match="Record"><br />
<text>
</text><br />
<xsl:text/><xsl:value-of select="normalize-space(Record)"/><xsl:text/><br />
<xsl:value-of select="normalize-space(DateTime)"/>,<xsl:text/><br />
<xsl:value-of select="normalize-space(PointName)"/>,<xsl:text/><br />
<xsl:value-of select="normalize-space(PointValue)"/>,<xsl:text/><br />
<text>
</text><br />
<xsl:text disable-output-escaping = "yes" ><br />
</xsl:text><br />
</xsl:template><br />
</xsl:stylesheet>
Thanks
Matt
|
|
|
|
|
matty2desmara wrote: how do i go about disregarding anything with ColName in my xsl ?
I suspect you're running foul of the default behaviour of XSL, which passes through all tags unchanged unless you say otherwise. Add a root element template that just processes what you want, like I've put in here?
<?xml version="1.0"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:strip-space elements = "Report"/>
<big> <xsl:template match="/">
<xsl:apply-templates select="//Record"/>
</xsl:template></big>
<xsl:template match="Record">
<text>
</text>
<xsl:text/><xsl:value-of select="normalize-space(Record)"/><xsl:text/>
<xsl:value-of select="normalize-space(DateTime)"/>,<xsl:text/>
<xsl:value-of select="normalize-space(PointName)"/>,<xsl:text/>
<xsl:value-of select="normalize-space(PointValue)"/>,<xsl:text/>
<text>
</text>
<xsl:text disable-output-escaping = "yes" >
</xsl:text>
</xsl:template>
</xsl:stylesheet>
I'm presuming the use of DateTime, PointTime and PointValue in your XSL is a typo?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi all,
I will be involved in a project where I must translate multiple EDI formats into XML and vice versa? Rather than code all this which I suspect will be impossible as I will be constantly hit with new formats, I was thinking that my app should load an XSLT map with the rules for the translation. I can then create custom XSLT maps on demand. Now my questions before I start:
1. Looking on the web, it seems all articles on XSLT are now quite old so I am wondering if this technology has been superseded in .NET? If so, by what?
2. If I should use XSLT, what would be the best tools to create the maps? I think hand coding will be tough/a bore. By looking the on the web, it seems Stylus Studio is possibly the way to go?
I'm not really ridged in my thoughts here so happy if I need to go off in another direction.
Many thanks for any advice.
|
|
|
|
|
As long as the EDI is an XML format or can be read into an XMl DOM using a custom XML reader, I'd say it's a splendid idea. Declarative programming - lovely!
tig2810 wrote: Looking on the web, it seems all articles on XSLT are now quite old so I am wondering if this technology has been superseded in .NET? If so, by what?
Don't think so.
tig2810 wrote: If I should use XSLT, what would be the best tools to create the maps? I think hand coding will be tough/a bore. By looking the on the web, it seems Stylus Studio is possibly the way to go?
Stylus Studio certainly seems to have strong EDI and XSLT support (looking at their website). Looks good!
I've always hand-coded my XSLT, but I've tended to do more involved stuff than mapping data formats, which has required some slightly out of the ordinary XSLT - it's been closer to functional programming thatn data mapping .
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks very much for the reply. Good to see I am headed in the right direction!
|
|
|
|
|
Hi Experts,
Has anyone tried getting Infopath generated XML file to work on the web and vice versa?
Someone mention using XForms and I am trying to learn how to work with that.
Also, how can this be implemented using php?
Thanks in advance.
|
|
|
|
|
I'll do a refresher on Infopath. It was interconnected with something uniquely Microsoft, which was why I had to reject it. Can't remember more off-hand.
I did a project in XForms. It works, but only in certain browsers. I used a FF add-in, which worked fine. I also tried XSmiles...less stable, but may be better now.
It's worth the effort to understand XForms!!! It's GORGEOUS in it's simplicity. Data and presentation are separate. You're able to do more with XForms than you ever could with XHTML & HTML (multiple submssions and types of submissions, locally or on a server and so on).
Here's a header code sample from my project. You'll see the submission types and the differences I talked about:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"<br />
xmlns:xmml="http://www.myDataModel/xmml"><br />
<head><br />
<title>Shopping List</title><br />
<xf:model id="default" ><br />
<xf:instance><br />
<xmml:data><br />
<xmml:storeName></xmml:storeName><br />
<xmml:productChoice></xmml:productChoice> <br />
</xmml:data><br />
</xf:instance><br />
<xf:submission id="clientList" action="ClientList.xml" <br />
method="put" /><br />
<xf:submission id="tempList" action="file:///c:/tmp/ClientList.xml" <br />
method="put" replace="none"/><br />
<xf:submission id="reloadList" action="file:///c:/tmp/ClientList.xml" <br />
method="get" replace="instance"/><br />
</xf:model>
I've not tried XForms with php and my use is server context only. I only know that php wraps around HTML. HTML is wrapped around XForms.
XForms is still wild west territory. You'll learn as you go. It's worth it though. w3schools.com and their xforms tutorial is a good place to start. I ended up learning more advanced things from xsmiles and w3.org.
|
|
|
|
|
Did a look up on Infopath. The reasons I didn't use it for a class project was due to it's proprietary software. To nutshell Infopath too much, it's just another XML web service and can run async like Ajax.
My thoughts are that it's always better to learn the guts, like XForms and XML web services (using REST & SOAP) before bumping up to proprietary software, like Infopath.
Most likely, Infopath runs async by creating a data model like the XForms example above and submitting it to a service. I'd have to dig much deeper and it wouldn't probably answer your question enough.
Gotta love the details! :LOL:
|
|
|
|
|
For XForms use with every recent browser, have a look at XSLTForms : http://www.agencexml.com/xsltforms
|
|
|
|
|
Hi all!
I am a new one in XML. Now I have a project which need to call GetObject() function with the syntax of JavaScript. The aim of this action is to get an object of a COM. The COM is created by myself. This COM has several interface. One of these interface is named as NetworkClass. And the COM is named as WindowsNetwork.
Now I'm sure that this COM had been registed in windows correctly. I write the code as following:
var WindowsNetwork = GetObject("WindowsNetwork,NetworkClass");
But an error is return. It say that this object is undefined. The variable is invalid. I think this is because of the syntax error of GetObject(). Maybe it shouldn't be written as this if a COM have several interface. So I hope someone could be kind to tell me how to write this code. Thx!
Best Regards!
whiteclouds
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
Try with
var WindowsNetwork = GetObject("WindowsNetwork.NetworkClass");
Also Refer
http://www.c-point.com/javascript_tutorial/jsfncGetObject.htm
Regards
Akhila
|
|
|
|
|
Thx for your reply. My problem had been resolved.
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
Hi,
I have the xml document like,
<?xml version="1.0" encoding="utf-8"?>
<Drive>
<folders>
<folder name="f1">
</folder>
<folder name="f2">
</folder>
</folders>
</Drive>
Please notice that there is no xmlns used and I cannot used xmlns in this xml document.
I have problem creating schema (.xsd) file to validate this xml document.
My schema is like
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.tempuri.com/temp"
elementFormDefault="qualified">
<element name="Drive">
<complexType>
<sequence>
<element ref="folders" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
</element>
<element name ="folders">
<complexType>
<sequence minOccurs ="0" maxOccurs ="unbounded">
<element ref ="folder"/>
</sequence>
</complexType>
</element>
<element name ="folder">
<complexType>
<sequence>
<element ref ="folders" minOccurs ="0" maxOccurs="1" />
</sequence>
<attribute name ="name" type="string" />
</complexType>
</element>
</schema>
But the ref attribute is not working. ie the attribute 'folders' cannot reference the element 'folders'. I am using VS2008 to create/edit xsd file. VS2008 shows warning message
"The 'http://www.w3.org/2001/XMLSchema:folders' element is not declared.". The same exception occurs if I run my c# program to valid the xml.
Could you please suggest me how to refernce element using ref attribute without using namespace? Is there any other workaround?
Thanks.
Prakash
|
|
|
|