|
Have you tried using createNode(NODE_ELEMENT, "SECOND", "mynamespace") to create the element?
|
|
|
|
|
thanks for your advise! solved.
if (GetDefaultNamespace().IsEmpty())
{
// Create element with no namespace
spNewNode = spXmlDoc->createNode(MSXML2::NODE_ELEMENT, _bstr_t(_T("SECOND")), "");
}
else
{
// Create element with default namespace
spNewNode = spXmlDoc->createNode(MSXML2::NODE_ELEMENT, _bstr_t(_T("SECOND")), _bstr_t(_T("mynamespace")));
}
huikm
|
|
|
|
|
Hey,
This must be SO easy to do and must be documented SOMEWHERE but I haven't been able to find out it.
What I want to do is
<tag attr="<tag1>">hey</tag>
But the attr doesn't work. It just doesn't display in HTML when formatted by XSL because it is converted as a tag.
Hope this makes sense
Robbie G
|
|
|
|
|
So, do:
<tag attr="<tag1>">hey</tag>
Shog9
------
And on the pedestal, these words appear:
"My name is Ozymandias, King of Kings,
Look on my Works, ye Mighty, and despair!"
Nothing beside remains.
|
|
|
|
|
How to convert a string with special caracters to
a string correctly read by XML ?
A special function in VC++ ?
Used a MSXML parser function ?
Thanks for your response !
|
|
|
|
|
Yes, MSXML should work, you can use SetText(), etc.
Shog9
------
No one's immune now, from a world of problems
No one's exempt now, from a world of pain
That's the way that it goes
when you're down here with the rest of us...
|
|
|
|
|
I have objects that I want to save to a file (XML format, generated by serialization). I also want the data to be encrypted. Should I encrypt the objects before they are serialized/saved to XML, or should I serialize and then encrypt the whole XML document? Which method is easier/more efficient, and why?
On a side note, where can I find a good, straight-forward tutorial for encryption using .NET (specifically, C#)? Thanks in advance.
|
|
|
|
|
Traditionally its better to encrypt something that has little redundancy, i.e. with little repetition. This is often why text files are compressed before they are encrypted, then decrypted and decompressed at the other end.
It's difficult to suggest something without a little more info about what it is you're trying to encrypt. Do you mean encrypt individual members of a type, like a string field containing a name or something?
For ease its probably better to just encrypt the XML document, if you want to you could always find some .NET code to compress the document beforehand and then encrypt that.
--
Paul
"I need the secure packaging of Jockeys. My boys need a house!"
- Kramer, in "The Chinese Woman" episode of Seinfeld
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
i introduced a namespace into the XML document and all the Xpath construct did not work. It was working before i introduced the namespace. what is wrong?
<?xml version="1.0" ?>
<ROOT>
<TEST>something 1</TEST>
<TEST>something 2</TEST>
<ROOT>
selectNodes(_bstr_t(_T("//TEST")); // working
with namespace
<?xml version="1.0" ?>
<ROOT xmlns="http://www.mynamespace.com">
<TEST>something 1</TEST>
<TEST>something 2</TEST>
<ROOT>
selectNodes(_bstr_t(_T("//TEST")); // error
i added the namespace cos i am doing xml schema validation using MSXML4 which turned out to be ok.
but with the xmlns..., all the xpath expressions failed.
This is my first encountered with namespace in xml document
appreciate any help advise. thanks
meng
|
|
|
|
|
|
what is the equivalent for NamespaceManager for VC++?
|
|
|
|
|
IMXNamespaceManager , i think... that said, i've no idea how to use it.
However, take a look at this:
reallylongmslink/xml2nd_pro_v4_0tyr.asp[^]
Shog9
------
And on the pedestal, these words appear:
"My name is Ozymandias, King of Kings,
Look on my Works, ye Mighty, and despair!"
Nothing beside remains.
|
|
|
|
|
I'd like to generate an XSL using ASP3.0
I've already written the code to make the XSL, but when loading it in to another ASP-page so that it can style a XML, I get the following error:
msxml3.dll error '80004005'
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document.
This while the beginning of the XSL-page clearly makes a root-element:
<%
Response.ContentType = "text/xml"
Response.Expires = 0
Set result = Server.CreateObject("Microsoft.XMLDOM")
%>
<?xml version="1.0" encoding="ISO-8859-1"?>
<%
'// add a node to the result tree for the stylesheet declaration
Set oNewNode = result.createNode("element","xsl:stylesheet", "http://www.w3.org/1999/XSL/Transform")
oNewNode.setAttribute "version","1.0"
oNewNode.setAttribute "xmlns:xsl","http://www.w3.org/1999/XSL/Transform"
result.appendChild(oNewNode)
'// the stylesheet declaration is the outermost grouping tag. It is the root
'// element and parent to all other elements
Set root = result.documentElement
...
What might be a sollution to fix this?
|
|
|
|
|
Why do you want to do this ? Why not generate it with XSL ?
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
What encoding is typically used with XML when embeded binary data?
Todd Smith
|
|
|
|
|
|
I have a xml file which has to be sent to another system with the node name changed.
eg:
"<emp name="me" id = "30">"
has to changed to
"<employee name="me" id = "30">"
This is a bulk operation where performance is critical. The platform is vb6.0/vb.NET. Can any one help me out
dsk
|
|
|
|
|
dsk wrote:
This is a bulk operation where performance is critical
Honestly I would not even use XSL for this. The change is so simple that just a string-replace function would be best. With XSL you would have far more overhead.
Even RegEx would probably be a better choice.
|
|
|
|
|
1. If the XML Document is large then, using DOM for transformation may not be practical. If that is the case, then under the .NET scenario, you should use the XmlTextReader and XmlTextWriter objects.
2. If the XML Document is not large enough then, you can use the DOM Methods which can be pretty verbose even in .NET.
3. Using an XSLT approach may be convenient if the document generally does not exceed 50 Kb.
the XSLT file is as follows:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy><xsl:apply-templates select="@* | node()" /></xsl:copy>
</xsl:template>
<xsl:template match="emp">
<employee>
<xsl:copy-of select="@* | node()"/>
</employee>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
I write:
<xsd:simpleType name="money">
<xsd:restriction base="xsd:decimal">
<xsd:fractionDigits value="2" />
</xsd:restriction>
</xsd:simpleType> to define a simple type in a schema file.
Then i use <cost>239.00</cost> in an XML file, where cost is of type money .
When i try to validate the XML with MSXML 4.0 it generates this error:
The element cost has an invalid value according to its data type .
If i remove the 9 from 239.00 everything will be ok.
What's wrong here? MSXML 4.0?
The case comes from an XML-Schema tutorial
rechi
|
|
|
|
|
The answer is
xsd:restriction base="xsd:decimal"
Be aware
Be The First
|
|
|
|
|
The wrote:
The answer is
xsd:restriction base="xsd:decimal"
sounds like time...
rechi
|
|
|
|
|
You're right
Be The First
|
|
|
|
|
Try this :
...
<xsd:restriction base='decimal'>
<xsd:totalDigits value='10'/>
<xsd:fractionDigits value='2'/>
<xsd:minInclusive value='0.00'/>
<xsd:maxInclusive value='1000.00'/>
</xsd:restriction
...
And let me know
Be The First
|
|
|
|
|
I've tried. Same story.
But it's not unusual. I had a problem with the pattern facet also. Guess MSXML has to grow up a bit.
If you need the sources i can send them to you.
rechi
|
|
|
|