|
Thanks Cohen. This is it!
works fine..
|
|
|
|
|
Hi,
I am using typed dataset in my application. Using this typed dataset I need to generate an xml file. I need an element similar to the following
<userID permissions="SCFP" >505050505 </userID>
I tried however I could not achieve above. I could achieve the following
<userID permissions="SCFP" usercode="505050505" />
I used following schema to get the above result.
<xs:element name="userID">
<xs:complexType>
<xs:sequence>
<xs:element name="usercode" type="xs:string" />
</xs:sequence>
<xs:attribute name="permissions" type="xs:string" />
</xs:complexType>
</xs:element>
Please give me a schema which alllow me to generate following XML fragment
<userID permissions="SCFP" >505050505 </userID>
Thanks for your time!!
Sreenath
|
|
|
|
|
Hi..
You could use "mixed="true" attrubute, if your element needs to get a text value beetween tags .
<xs:element name="usercode" type="xs:string" mixed="true" />
|
|
|
|
|
Greetings,
I am trying to only sum up the values from a xml record using a xsl file.
I am currently using msxml 4.0 within a windows xp environment.
Here is my xml data format example:
----------------------------
<?xml version="1.0" encoding="UTF-16"?>
<XML>
<DATA>
<Name>TestName</Name>
<Value>10</Value>
</DATA>
<DATA>
<Name>TestName2</Name>
<Value>15</Value>
</DATA>
<DATA>
<Name>TestName</Name>
<Value>100</Value>
</DATA>
</XML>
What I am trying to do is add all the record's "Value" node where name is equal to "TestName". So I would only add the Value Nodes of "10" and "100" = "110"
(Desired Output
TestName: 110
Thanks in advance for any suggestions!
|
|
|
|
|
I figured it out right after I made the post.
I used "msxsl:node-set" to put my sum data into a variable, and then referenced it from later. For futher information consult the article
"Calculating a Sum of Sums (Final Version)" found in msxml 4.0 help from the sdk.
|
|
|
|
|
Hi
I want to give page breaks using xslt. Also, I want to use next and previous facility using xslt ? Can anyone help me out .
Thanks in advance,
Regards,
Bhagwati Prasad
|
|
|
|
|
I assume you are talking about generating an html content out of XSLT.
While generating the html content out of xslt, just make use of html markup br to get the line break may be you know this already.
Regarding the pagination, the best i can say is to submit the page with the page id and generate html content starting from that page id.
|
|
|
|
|
The problem is that I have many xml records, and I want to separate those
into number of html pages using xsl. One of the answers what I found on internet is xsl-fo, but how to do this in .NET ?
|
|
|
|
|
Do you really want to use XSL for this ? or you thought that is the way ?
If you know the schema already, then you can create a typed dataset and bind an XML to it. This helps you to create any type of file easily and may be fast!! Without getting into trouble of xsl looping.
let me know if this helps you!!
Sri
|
|
|
|
|
no I need to implement using xsl
what I do is, get the data in the dataset, get its xml and then transform it using xslt. The transformation is coming out properly, but now I want to display no of pages, page count etc. using xsl
Can u help ?
Thanks,
Bhagwati
|
|
|
|
|
Bhagwati,
Hope you got enuf information from Parker's messsage.
If not let me know.
bye
Sreenath
|
|
|
|
|
Thanks Srinath and Parker.
I got enough information and it works
Thanks again
Bye
Bhagwati
|
|
|
|
|
|
Hi!
I need to select certain nodes that DON't have specific subnodes, i.e.
Select all nodex x/y where there is no subnode x/y/a or x/y/b
Example:
<x>
<y> <!-- select this one -->
<bla>blup</bla>
</y>
<y> <!-- this one as well-->
<foo>test</foo>
</y>
<y> <!-- this one not: x\y\a -->
<a>bla</a>
</y>
<y> <!-- this one not: x\y\b -->
<b>bla</b>
</y>
</x>
I'd appretiate all suggestions. Thanks in advance!
Regards,
Andre Loker
|
|
|
|
|
Hi Andre. Here's one approach - using a for-each to select only those x/y nodes that don't have a child a or child b node.
<?xml version='1.0' ?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<xsl:for-each select="x/y[not ((descendant::a) or (descendant::b))]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet> I hope that helps.
|
|
|
|
|
Yes, it works great, thanks a lot!
Regards,
Andre Loker
|
|
|
|
|
I'm reading an XML input file using SAX, if I find that some infor is missing from that file (while I'm parsing it), I want to go to another XML file and see if the info is there (again parsing using sax).
It seems to be working after a fashion, but I keep getting access violations in MSXML4. Can you have more than one reader active at a time parsing more than one file using MSXML?
|
|
|
|
|
I have a commemerce server site and an asp site... i want to exchange xml between the two sites but i need to use soap to get through the firewall... any suggestions on where to start... im new to soap
|
|
|
|
|
Hey All,
I have a client built using VC++ running on Windows which sends Soap messages to a web service deployed on Tomcat that uses Axis.
The client is being localized in Japanese as well.
Here comes the problem:
When user enters a lot of doube-byte Japanese characters in the client UI then error occurs while sending the soap request. The error occurs when Finished() is called. This problem does not occur in following cases:
- if user enters lesser number of characters as input
- in English version.
I am using InitWithComposer() method of SoapSerializer30 to compose the soap since the message may contain attachmetns too. DimeComposer30 is used in this method.
Also, I noticed if I use Init() method instead of InitWithComposer. This problem does not occur
Can somebody tell me where the problem is? The code is also listed below for reference.
Soap toolkit 3.0 is being used and UTF-8 encoding is used in XML.
The error returned is given below.
-------------------------------------------------------------
- Exception:
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString: java.io.UTFDataFormatException: Expected byte 3 of 3-byte UTF-8 sequence.
faultActor: null
faultDetail:
stackTrace: java.io.UTFDataFormatException: Expected byte 3 of 3-byte UTF-8 sequence.
at org.apache.xerces.impl.io.UTF8Reader.expectedByte(Unknown Source)
at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:232)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:546)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:304)
.
.
.
Code:
-------------------------------------
HRESULT hr;
ISoapSerializerPtr pSerializer;
ISoapReaderPtr pReader;
hr = pSerializer.CreateInstance(__uuidof(SoapSerializer30));
if(FAILED(hr))
return FALSE;
IMessageComposerPtr Composer;
hr = Composer.CreateInstance(__uuidof(DimeComposer30));
if(FAILED(hr))
return FALSE;
pSerializer->InitWithComposer((IUnknown*)mpConnector->InputStream,Composer);
pSerializer->StartEnvelope("","http://schemas.xmlsoap.org/soap/encoding","");
pSerializer->SoapAttribute("xsi","",
"http://www.w3.org/2001/XMLSchema-instance","xmlns");
pSerializer->SoapAttribute("xsd","","http://www.w3.org/2001/XMLSchema","xmlns");
pSerializer->StartBody("");
pSerializer->StartElement("CheckIn", "",
"http://schemas.xmlsoap.org/soap/encoding/", "ns1");
pSerializer->SoapAttribute("ns1" ,"","urn:OrionService","xmlns");
pSerializer->StartElement("command",_bstr_t(),_bstr_t(),_bstr_t());
pSerializer->SoapAttribute("ns2","",
"http://schemas.xmlsoap.org/soap/encoding/","xmlns");
pSerializer->SoapAttribute("type","","ns2:Array","xsi");
//Format the command string
CFormatter ObjFormat;
if(_tcscmp(pidlData->szTitle, ""))
{
_stprintf(str,"-dis 1 dm_object title C \"%s\" U",pidlData->szTitle);
ObjFormat.AddText(str);
}
//Add the command string array to soap request
TCHAR strID[1000];
_stprintf(strID,"xsd:string[%d]",ObjFormat.GetItemCount());
pSerializer->SoapAttribute("arrayType","",strID,"ns2");
TCHAR *token;
token = _tcstok( ObjFormat.GetString(), "\n");
while( token != NULL )
{
pSerializer->StartElement("item",_bstr_t(),_bstr_t(),_bstr_t());
pSerializer->SoapAttribute("type",_bstr_t(),"xsd:string","xsi");
pSerializer->WriteString(token);
pSerializer->EndElement();
token = _tcstok( NULL, "\n" );
}
pSerializer->EndElement();
//Add file original file names to soap request
pSerializer->StartElement("fileName",_bstr_t(),_bstr_t(),_bstr_t());
pSerializer->SoapAttribute("ns2","",
"http://schemas.xmlsoap.org/soap/encoding/","xmlns");
pSerializer->SoapAttribute("type","","ns2:Array","xsi");
if (cDocumentType == 'R') // registerd
_stprintf(strID,"xsd:string[%d]",0);
else if (cDocumentType == 'S') // storted
_stprintf(strID,"xsd:string[%d]",iDocCount);
else if (cDocumentType == 'M') // multisheet
_stprintf(strID,"xsd:string[%d]",iDocCount);
pSerializer->SoapAttribute("arrayType","",strID,"ns2");
lpFiles= lpFilesList;
if (cDocumentType == 'S') // storted
{
for(i = 0;i<idoccount;i++)
{
="" pserializer-="">StartElement("item",_bstr_t(),_bstr_t(),_bstr_t());
pSerializer->SoapAttribute("type","","xsd:string","xsi");
pSerializer->WriteString((lpFiles->szFileName+lpFiles->iOffset));
lpFiles= lpFiles->pNext;
pSerializer->EndElement();
}
}
pSerializer->EndElement();
//Add files array to soaprequest
pSerializer->StartElement("file",_bstr_t(),_bstr_t(),_bstr_t());
pSerializer->SoapAttribute("soapenc","",
"http://schemas.xmlsoap.org/soap/encoding/","xmlns");
pSerializer->SoapAttribute("type","","soapenc:Array","xsi");
_stprintf(strID,"ns1:DataHandler[%d]",iDocCount);
pSerializer->SoapAttribute("arrayType","",strID,"soapenc");
//DebugBreak();
FileAttach = new IFileAttachmentPtr[iDocCount];
for(i=0;i<idoccount;i++)
{
="" fileattach[i].createinstance(__uuidof(fileattachment30));
="" pserializer-="">StartElement("item",_bstr_t(),_bstr_t(),_bstr_t());
FileAttach[i]->FileName = sFileName[i];
pSerializer->AddAttachmentAndReference(FileAttach[i]);
pSerializer->EndElement();
}
pSerializer->EndElement();
//Locale
pSerializer->StartElement("Locale",_bstr_t(),_bstr_t(),_bstr_t());
pSerializer->SoapAttribute("type","","xsd:string","xsi");
pSerializer->WriteString(msLocale);
pSerializer->EndElement();
pSerializer->EndElement();
pSerializer->EndBody();
pSerializer->EndEnvelope();
pSerializer->Finished();
Hope to see the response soon.
Thanks
Rohit Sethi
|
|
|
|
|
my web service returns Xmlnode. I want to read attribute name and populate Dropdownlist.
Here is what I have been trying .. nothing seems to work ... any suggestions please
Dim SearchResult As MyWebservie = ar.AsyncState
Dim node As XmlNode = TicketSearchResult.EndGetEventList(ar)
//Dim ReadNode As XmlNode = node.SelectSingleNode("DATA") //
Dim Reader As New XmlNodeReader(ReadNode)
//Dim mydataset As New DataSet
//mydataset.ReadXml(Reader)
//Dim resultNodes As XmlNodeList = node.SelectNodes("raw") //node i need attributs from this
// Dim iCount As Integer = 0
// Dim aNode As XmlNode
// For Each aNode In resultNodes
// DropDwonLis1.Item.Add /// Console.WriteLine("Node {0} value: {1}", ++iCount, aNode.InnerText)
'ToDo: Unsupported operator
'ToDo: ++ operator not supported within expressions
Next aNode
here is what web service returns
- <root>
- <methodinfo>
<channelname>Search
<methodname>MyWebservice
<parameters>?APP_ID=1
<processtime type="milliseconds">453.1366
-
<row thisid="2" thisname="Beach ST=" "="">
<row thisid="1" thisname="Playhouse" st="GA">
<row thisid="3" thisname="Arena" st="MD">
<row thisid="4" thisname="Park" st="CA">
I want THISNAME IN DROPDOWNLIST and THISID as option Value in dropdownlist
|
|
|
|
|
Hi,
I couldn't read all your message as the XML is not being displayed as the page is processing the < > tags.
To read attributes of a node, use the following:
XmlNode thisNameNode = aNode.attributes.getNamedItem("thisname");
XmlNode thisIdNode = aNode.attributes.getNamedItem("thisid");
if (thisNameNode != null && thisIdNode != null)
{
string thisNameValue = thisNameNode.text;
string thisIdValue = thisIdNode.text;
System.Web.UI.WebControls.ListItem item = new ListItem(thisNameValue, thisIdValue);
DropDwonLis1.Items.Add(item);
}
Hope this helps,
Andy
|
|
|
|
|
I have some xml document describing our database.
I have an element <value>
in side of that document for empty element, but
when I parse it using DOM in VB
For Each rowElement In xmlDoc.documentElement.childnodes
str_content = rowElement.childnodes(0).nodeValue
Next
when I have NULL in the element I have application error
said "NULL is not properly used". I tried to filter the
NULL by
If rowElement.childnodes(0).nodeValue = NULL then
....
however, vb doesn't recognize this null
do you think i should not use
for empty element in the first place?
there is another solution?
Thanks for help
shin
|
|
|
|
|
How to load XslTransform from data base or just from string? I don't want to load it from file, I keep all the XSL documents in data base and I just want to load them from record.
|
|
|
|
|
Use the Document objects loadXML( string) method
doc.loadXML( string_from_database)
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Apparently I'm having a problem with MS XML libraries.
We're posting an XML doc to an external site which parses the doc and provides an HTTP Response Number.
We also need the XML to be re-posted from the external site to another page of ours and have the XML saved as a doc. In standard ASP we're doing this as follows...
[code]
<%
strABBXMLFile = Server.MapPath("/spider/abb/abbn/" & Day(Now) & "-" & Month(Now) & "-" & Year(Now) & "_" & Hour(Now) & Minute(Now) & "_standardAbbreviation.xml")
Set doc = Server.CreateObject("Msxml2.DOMDocument.4.0")
doc.load(Request)
doc.save(strABBXMLFile)
%>
[/code]
The problem we have is with entity declaration and tags. With entity declarations or a DocType in the XML none of the MS XML libraries can save the XML document. If the <doctype> is removed, they xml is saved fine. Can anyone provide any further information on this issue, or if there's a work-around for it? Or do the .Net XML libraries cope with entity declarations and doctype tags, and can anyone provide any pointers to dot-netting the above?
All help much appreciated, as well as advice.
Cheers!
Rhys
"When one burns one's bridges, what a very nice fire it makes" -- Dylan Thomas
"As to marriage or celibacy, let a man take the course he will. He will be sure to repent" -- Socrates
"Doh!" -- Homer Simpson
|
|
|
|
|