|
Oops... sorry, I mis-read your post and thought you were looking for XSL resources.
|
|
|
|
|
Hi...
I have createds a XML document (chart.xml) along with a seperate XML Schema (chart.xsd) document to describe the structure of the XML document and its data types.
My confusion comes in (after trying the w3CSchools explanation unsuccessfully) when namespaces need to be applied.
All I want to do is get the XML document to reference this XSD document (which are located in the same folder) so that value and elements within the XML document are of the correct format (this is what schema is for is it not?).
Also how can I tell its working properly?
Any help/pointers would be very appreicated.
Ta
John
XML CODE----------------------------------------
<chartdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
="" xsi:nonamespaceschemalocation="file:chart.xsd">
<chart name="ttt">
<data_xaxis>
<dataitem>Mon
<dataitem>Tue
<dataitem>Wed
<dataitem>Thu
<dataitem>Fri
<dataitem>Sat
<dataitem>Sun
<data_yaxis>
<dataitem>45
<dataitem>50
<dataitem>30
<dataitem>10
<dataitem>30
<dataitem>50
<dataitem>70
<totalsizex>600
<totalsizey>400
<legend_xaxis>Days of the month
<legend_yaxis>Total man hours
<chart_title>Daily Studio man hours
<xmargin>50
<ymargin>50
<plotstart_leftx>30
<plotstart_topy>20
Schema CODE-------------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<xs:element name="CHART">
<xs:complextype>
<xs:sequence>
<xs:attribute name="name"
="" type="xs:string" use="required">
<xs:element name="DATA_XAXIS">
<xs:complextype>
<xs:sequence>
<xs:element name="DATAITEM"
="" type="xs:string" minoccurs="0" maxoccurs="unbounded">
<xs:element name="DATA_YAXIS">
<xs:complextype>
<xs:sequence>
<xs:element name="DATAITEM"
="" type="xs:string" minoccurs="0" maxoccurs="unbounded">
<xs:element name="TOTALSIZEX" type="xs:integer">
<xs:element name="TOTALSIZEY" type="xs:integer">
<xs:element name="LEGEND_XAXIS" type="xs:string">
<xs:element name="LEGEND_YAXIS" type="xs:string">
<xs:element name="CHART_TITLE" type="xs:string">
<xs:element name="XMARGIN" type="xs:integer">
<xs:element name="YMARGIN" type="xs:integer">
<xs:element name="PLOTSTART_LEFTX" type="xs:integer">
<xs:element name="PLOTSTART_TOPY" type="xs:integer">
|
|
|
|
|
--XML CODE------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<CHARTDATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:chart.xsd">
<CHART NAME="ttt">
<DATA_XAXIS>
<DATAITEM>Mon</DATAITEM>
<DATAITEM>Tue</DATAITEM>
<DATAITEM>Wed</DATAITEM>
<DATAITEM>Thu</DATAITEM>
<DATAITEM>Fri</DATAITEM>
<DATAITEM>Sat</DATAITEM>
<DATAITEM>Sun</DATAITEM>
</DATA_XAXIS>
<DATA_YAXIS>
<DATAITEM>45</DATAITEM>
<DATAITEM>50</DATAITEM>
<DATAITEM>30</DATAITEM>
<DATAITEM>10</DATAITEM>
<DATAITEM>30</DATAITEM>
<DATAITEM>50</DATAITEM>
<DATAITEM>70</DATAITEM>
</DATA_YAXIS>
<TOTALSIZEX>600</TOTALSIZEX>
<TOTALSIZEY>400</TOTALSIZEY>
<LEGEND_XAXIS>Days of the month</LEGEND_XAXIS>
<LEGEND_YAXIS>Total man hours</LEGEND_YAXIS>
<CHART_TITLE>Daily Studio man hours</CHART_TITLE>
<XMARGIN>50</XMARGIN>
<YMARGIN>50</YMARGIN>
<PLOTSTART_LEFTX>30</PLOTSTART_LEFTX>
<PLOTSTART_TOPY>20</PLOTSTART_TOPY>
</CHART>
</CHARTDATA>
--XSD CODE------------------------------------------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<xs:element name="CHART">
<xs:complexType>
<xs:sequence>
<xs:attribute name="name"
type="xs:string"
use="required" />
<xs:element name="DATA_XAXIS">
<xs:complexType>
<xs:sequence>
<xs:element name="DATAITEM"
type="xs:string"
minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DATA_YAXIS">
<xs:complexType>
<xs:sequence>
<xs:element name="DATAITEM"
type="xs:string"
minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TOTALSIZEX" type="xs:integer" />
<xs:element name="TOTALSIZEY" type="xs:integer" />
<xs:element name="LEGEND_XAXIS" type="xs:string" />
<xs:element name="LEGEND_YAXIS" type="xs:string" />
<xs:element name="CHART_TITLE" type="xs:string" />
<xs:element name="XMARGIN" type="xs:integer" />
<xs:element name="YMARGIN" type="xs:integer" />
<xs:element name="PLOTSTART_LEFTX" type="xs:integer" />
<xs:element name="PLOTSTART_TOPY" type="xs:integer" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|
|
|
|
|
Namespaces are used to qualify elements and attributes. They aren't necessary, but are usually a good idea so that you can easily qualify elements and attributes when using XML documents with mixed content. To use them, add the xs:targetNamespace (where xs is the namespace prefix for XMLSchemas) and then use the same namespace to qualify your XML document that you gave first. To use it as the default namespace, use xmlns="....." with no prefix.
When you're using code to access the DOM, you can use any prefix you want, so long as the namespace in the namespace manager (in .NET, this is the XmlNamespaceManager ) matches (case-sensitively) the namespace declared in the document.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
- IXMLDOMDocument2Ptr ObjXMLDoc;
- hresult = ObjXMLDoc.CreateInstance("Msxml2.DOMDocument.4.0");
i then perform the following call:
- ObjXMLDoc->load(Filename);
where Filename is a valid XML file (no scheme is used).
this call takes out memory resources, and when i use the same last call with a different Filename, it takes more of it - without releasing the last one's resources.
is there a way to "Unload" an xml file from memory (to perform something like the opposite of "load" method)?
|
|
|
|
|
To my knowledge, the only way to free the memory used is to release the object containing the held memory. Try the .Release method on the smart pointer to free the pointer, but not the reference. Because *Ptr's are smart pointers (_com_ptr_t), don't get this method mixed up with the ->Release method. If that does not work, try a master/worker approach with one main reference on the object and subsequent QIs on it for "worker" references.
HTH,
Ryan
|
|
|
|
|
i tried to free the memory using .Release method - it did release it, but the memory is still not released.
i tried working with only one reference to the object, but it still used more resources on every call to the .load method.
i also tried using
::CoFreeUnusedLibraries();
::CoUninitialize();
at the end of the function which does all that.
still - the memory is not released.
|
|
|
|
|
The only other thing I can think of it that you are probably running in Debug mode. Debug mode has lots of extra features to help protect running code (Buffering around data structures, holding references, etc). Do you see the problem running in Release mode?
|
|
|
|
|
it's not the debug mode.
i was trying to perform .Release() on the XML IXMLDOMDocument2Ptr object at different places in the code - in order to search for the place that keeps the resources unreleased after that method call.
i found that the method released the resources, until i used a function call, to my own function which one of its parameters is from type IXMLDOMNodePtr.
i could see that a new reference to the object was added, but i wasn't able to release the resources after this function all, even by using "= NULL" on the object in this function plus the original one that was sent.
am i not releasing the object as i should?
can't i send a smart pointer as a parameter to my own function and get rid of the object afterwards (not the object - it's cought resources - the object itself becomes NULL)?
|
|
|
|
|
hi all :
I want to make a solution that have 3 projects ,1-web app 2-win app 3-mobile app , iwant to use asp.net web services to link between them all ,the win app is connected to a local DB server(sql server) ,and connect to the internet 1 time per day,and the web app is connected to a remote DB server (sql server) ,and also the mobile app.
the questions are :
1- how can i use Asp.net web services well to make the solution works well?
2-How can i manage the DB ?and how can i make daily transaction to update the remote server with the new data at the local server?? or what??
3-how can i use the same methods for dealing with the DB ,for the win app , the web app and the mobile app?
hadada
MCDBA, MCSD, MSAD
|
|
|
|
|
I'm using an XML file to hold a bunch of links, each of these links also have a category assigned to them.
Here is an example:
<br />
- <links><br />
<linkNum>57 <br />
<linkType>Business Links <br />
<linkName>Clark County Services <br />
<linkURL>http:
I use this .asp script that loads an XML file with an XSL file.
The beauty of this ASP file was that you could pass the name of the XSL file, and it would load it. Now what I would like to do, is just have 1 xsl file, and use the .asp file to transform only a certain template in the .xsl file. (There would be several different teplates in there...)
Is this possible?
Below is the .asp file I'm using...
<br />
sub dispXML(toCall)<br />
'------ Find out which XSL file needs to be called ------------<br />
<br />
styleFile = Server.MapPath(toCall)<br />
<br />
'------ DISPLAY THE XML DATA ------------<br />
' Linking XML and XSL together<br />
sourceFile = Server.MapPath("linkList.xml")<br />
set source = Server.CreateObject("Microsoft.XMLDOM")<br />
source.async = false<br />
source.load(sourceFile)<br />
set style = Server.CreateObject("Microsoft.XMLDOM")<br />
style.async = false<br />
style.load(styleFile)<br />
Response.Write source.transformNode(style)<br />
<br />
end sub<br />
Any help would be great. Thanks.
|
|
|
|
|
yes use xsl:param
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
ah - yes.
My only problem has been passing something TO an XSL file?
Any ideas? Ideally, I'd call it from a .asp file...
|
|
|
|
|
I have seen this done using xsl:param directly under the xsl:stylesheet declaration to pass in parameters, but I have only seen this work with command-line processors like Saxon, Xalan. Unfortunately, MSXML does not support top-level parameters.
The workaround would be to append the data you want to pass through a parameter in the XML to be transformed and read it into a top-level variable.
|
|
|
|
|
I use Embedded Visual C++ 3.0 (evc) to develop for PocketPC 2002 (PPC).
I plan to do XSLT on PPC.
My plan is to read an XML- and XSL-file and transform the XML-file to HTML with XSLT.
Does anybody know if that is possible on PPC?
Are there any SDKs, librarys, tools or samples?
thx, Daniel
|
|
|
|
|
Ok, I'll keep this as simple as possible. I need to Query an XML file and Return the "DataRow" Nodes that meet some criteria contained in more than one ChildNode of the Row. Keep in mind that I cannot simply make the ID's part of the "DataRow" node, because for every XML file, the IDs are totally different Columns (not by my design).
Here's an example XML data:
<DataTable>
<DataRow>
<DataColumn Name="DatabaseID" Value="1" />
<DataColumn Name="RowID" Value="1" />
</DataRow>
</DataTable>
Ok, what I need to do is Select all "DataRow" nodes where the "DataColumn" matches the following criteria:
@Name='DatabaseID' and @Value='1' and @Name='RowID' and @Value='1'
Here's what I have so far, but I can't seem to match a DataRow to multiple criteria in the DataColumns:
//DataRow/DataColumn[@Name='DatabaseID' and @Value='1']
|
|
|
|
|
//DataRow[ DataColumn/@Name='DatabaseID' and DataColumn/@Value='1' and DataColumn/@Name='RowID' and DataColumn/@Value='1']
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thanks for the Reply, I ended up figuring it out this morning in 15min (after working on it for 10hrs yesterday)...
I ended up with this:
|
|
|
|
|
Hi all,
Do you know how to send XMLdata to exe file ?
This preposion is not to create XML data file.
This situation is the following.
The XML data is send from websever, the browser on client
receive it. This browser install a plugin that have a function
receiving and sending XML data.
When this browser receive it, send it to a exe file.
I think 2 pattern.
1. This browser send XML data at the same time, kick a exe file
by a plug in.
2. A exe file have already performed.
If you have some solutions, please advice me.
Best Regards,
yu-yu
|
|
|
|
|
You could register a specific MIME type in the PC (eg. .myFileExt) to be handled by your exe file,
then send the XML as filename.myFileExt, and when the user opens the file it will be processed by your exe
(The exe will receive the filename as the argument). At least that's what I did with my program.
However, I don't know how to register a MIME type programmatically, maybe someone else can help?
|
|
|
|
|
Hi
thank you for your advice.
About the following
"when the user opens the file it will be processed by your exe"
When XML is sent, have this situation already processed ?
or at the same time exe file received, do exe file process ?
thank you in advance for your kindness.
best Regards,
yu-yu
|
|
|
|
|
I'm not sure what you're asking, so I'll try to explain what I think you're asking .
If the MIME has been registered in the user's PC to be handled by your exe, whenever the user opens the xml file (in this case, filename.myExt) then the exe will be activated.
Therefore,
1. User downloads xmlData.myExt and saves it to the PC.
2. User opens xmlData.myExt (so it has to be opened by user, either by double-clicking on the file or select Open to activate MyProgram.exe)
3. MyProgram.exe runs, and accepts location of xmlData.myExt
4. MyProgram.exe does whatever it needs with xmlData.myExt
I hope that answers your question.
|
|
|
|
|
I'm sorry to luck my explaination, thank you.
Your precondition is to save xml to the PC.
I think about not to save it.
The client's browser( already installed plugin) catch it,
plugin kick exe file and send it to exe file.
To register MIME, in this case, is it possible ?
thank you in advance for your kindness
best regards,
yu-yu
|
|
|
|
|
I've spoken to my colleague, he said you can register the MIME to open the file automatically.
Under the File Types setting, there is an Advanced button where you can untick the "Confirm open after download".
If you want to do it from the registry, he said it corresponds to My Computer\HKEY_CLASSES_ROOT\.myExt and My Computer\HKEY_CLASSES\ROOT\MIME\Database\Content Type
|
|
|
|
|
thank you.
I try it.
Best Regards,
yu-yu
|
|
|
|