|
I am presently taking a "Crash Course" on XML in a book with that name. It tells me that in order to show a non-xml file in an XML document, I must declare, in the DTD :
1. an empty element; 2. an entity attribute for that element; 3. an entity declaration including an NDATA clause; 4. a notation, and
in the XML document, 5, an empty element consisting of the entity name and another name='filename'
Another book, XML in a Nutshell calls this way of putting a photo in an XML document "a complicated confusing mistake that should never have been included in XML in the first place" (p. 53), a sentiment that makes good sense to me.
Unfortunately, the Nutshell book neglects to explain a less complicated alternative. Can any of you tell me the most efficient manner of doing this?
DJS8
|
|
|
|
|
Can any one help me regarding Cascading Style Sheets(CSS2.0)
I need a CSS2.0 parser WRITTEN IN C++
please help me
Thanks & Regards
Gaurav Bajaj
|
|
|
|
|
I'm using C# (.NET 2.0 framework)..
Is it possible to force an XML file that doesn't reference an XSD schema to be validated against a specified XSD schema?
Here is a code segment I'm using:
XmlSchema schema = XmlSchema.Read(
new StringReader(MySchemaStringTextBox.Text),
ValidationCallback);
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.Schemas.Add(schema);
readerSettings.ValidationType = ValidationType.Schema;
readerSettings.ValidationFlags = XmlSchemaValidationFlags.None;
XmlReader configReader = XmlReader.Create(new StringReader(MyXmlTextBox.Text), readerSettings);
XmlDocument config = new XmlDocument();
config.Load(configReader);
config.Validate(new ValidationEventHandler(ValidationCallback));
ValidationCallback never gets called, unless a schema is actually specified in the XML file.
Thanks in advance!
r -€
|
|
|
|
|
when I put an in an xsl file, the whole page becomes blank.
Please show me how to use this in an *.xsl file, or use a ' '(white space)
for example: this code is inside *.xsl file
....
....
|
|
|
|
|
Hey whenever you want to use HTML entities in your XSLT use attribute disable-output-escaping=YES and then & amp; before nbsp;in tag <XSL:text>.
check this as below:
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
|
|
|
|
|
i have a xml looks like this
(?xml version="1.0" encoding="utf-8"?)
(?xml-stylesheet type="text/xsl" href="style.xsl"?)
(EventLog)
(Log Date="11/6/2005")
(Event)11:50:57 PM : Start Monitoring Machine: dunbshy(/Event)
(Event)11:53:54 PM : System is Successfully Loaded(/Event)
(Event)11:53:55 PM : Start Monitoring Machine: dunbshy(/Event)
(/Log)
(Log Date="11/7/2005")
(Event)12:15:33 AM : System is Successfully Loaded(/Event)
(/Log)
(/EventLog)
how do i use xsl to put all those event into a table according the it's Log Date? something liket this:
Date = 11/6/2005
11:50:57 PM : Start Monitoring Machine: dunbshy
11:53:54 PM : System is Successfully Loaded
11:53:55 PM : Start Monitoring Machine: dunbshy
Date = 11/7/2005
12:15:33 AM : System is Successfully Loaded
|
|
|
|
|
Hope this code will work for you...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="EventLog/Log">
<b>Date =<xsl:value-of select="@*"/></b><br />
<xsl:for-each select="Event">
<xsl:value-of select="."/><br />
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
-- modified at 6:23 Monday 14th November, 2005
|
|
|
|
|
I have two different applications one for each company.
These companies are partners and need to interchange data all time betweent their apps.
Could someone give me a Guideline as to what i need to do make these apps. interchange data using XML
Both apps were created in c#
Thanks
Kourvoisier
|
|
|
|
|
- Figure out the information that needs to get exchanged.
- Write a DTD or schema describing the XML document structure that will hold the data to get exchanged.
- Create objects/methods in the two applications to read/write XML documents conforming to the standard that you developed in the last step.
- Figure out how the applications will communicate with one another: files, messages, TCP/IP sockets, etc.
- Implement the ability for the applications to exchange those XML documents over your chosen channel.
- Profit.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I currently have a bunch of XML files that represent different "file types" in my project. For example, one defines the project heirarchy, another defines a template, etc.
When the user chooses to load a new template, I don't want them to try to load in a project definition file by mistake. I only want them to see template files.
My solution thus far has been to define a unique windows extension for each "file type". Eg. ".tmpml" for template, ".prjml" for project, etc. Using a filter in the OpenFileDialog ensures that the user only sees compatible files.
But these aren't real, registered windows extentions and if a user tries to open one up from Windows Explorer, it will not be recognised as an XML file. There also may be conflicts with other applications that may use the same file extension.
Ideally what I'd like to do is to have all these files stored with the standard ".xml" extension, but have a way of differentiating them in the OpenFileDialog.
I can't think of any way to do this short of writing my own OpenFileDialog, but I don't want to go there... Is there any way to write a custom filter that looks at the file contents rather than just the extension?
|
|
|
|
|
hi,
I have some program in C# like this
XmlDocument XmlDom1 = new XmlDocument();
XmlDocument XmlDom2 = new XmlDocument();
XmlDom1.Load("Test1.xml");
XmlDom1.Load("Test2.xml");
System.Xml.Xsl.XslTransform XslObj = new System.Xml.Xsl.XslTransform();
XslObj.Load("Common.xsl");
System.Xml.Xsl.XsltArgumentList ARG = new System.Xml.Xsl.XsltArgumentList();
//ARG.AddParam("Test","urn:PC",XmlDom2);
ARG.AddExtensionObject("urn:PC",XmlDom2);
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Xml.XPath.XPathNavigator xdNav = XmlDom.CreateNavigator();
XslObj.Transform( xdNav,ARG,sw);
return sw.ToString();
I am passing a xml object XmlDom2 like
ARG.AddExtensionObject("urn:PC",XmlDom2);
Now how will i get this in the xsl(Common.xsl)
|
|
|
|
|
-- Sorry about the poor formatting, but I seem to have problems with XML tags in PRE blocks. --
I was thinking about writing a tiny app to maintain my expenses, and wanted to store the info in an XML file. I want every transaction to have a description and the amount involved. Additionally, I want the date info to be stored. Should I do it like
<transactions>
<year year="2005">
<month month="11">
<day day="7">
<transaction type="expense">
<description>Auto from station</description>
<amount>60.00</amount>
</transaction>
<!-- Other transactions for the same day -->
</day>
<!-- Other transactions for the same month -->
</month>
<!-- Other transactions for the same year -->
</year>
<year year="2006">
<!-- blah blah blah -->
</year>
</transactions>
or is there a better way? ***I don't like having an element which has an attribute with the same name***. Of course, I did come up with the idea of
<transactions>
<transaction year="2005" month="11" date="6" type="expense">
<description>Auto from station</description>
<amount>60.00</amount>
</transaction>
</transactions>
but the year, month and date attributes are ***repeated too often***.
What would you suggest? Should I simply change the nomenclature of #1 somehow, or should I go for something totally different?
Cheers,
Vikram.
|
|
|
|
|
Vikram A Punathambekar wrote: but the year, month and date attributes are ***repeated too often***.
Why? Looks fine to me. Unless you have the need to group other things by year/month/day, i don't see any reason not to use the more succinct syntax.
|
|
|
|
|
I develop web service with extensions that encrypt and compress some parameters of web method.
So I need get certain node("soap:Envelope/soap:Body/SendServiceDataInHeader/Body") in SOAP
message(got by serialization of web method) with XPath expression.
Here is SOAP message:
<?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:Header>
<ProtocolData xmlns="http://tempuri.org/">
<IsEncrypted>true</IsEncrypted>
<IsCompressed>true</IsCompressed>
</ProtocolData>
</soap:Header>
<soap:Body>
<SendServiceDataInHeader xmlns="http://tempuri.org/">
<To>zhornick@mail.ru</To>
<Cc />
<Subject>Subj</Subject>
<Body>Body</Body>
</SendServiceDataInHeader>
</soap:Body>
</soap:Envelope>
I tried with below code snippet but it doesn't work. It may be due to default namespace.
XmlDocument xd = new XmlDocument();
xd.Load("d:\\x.xml");
XmlNamespaceManager nm = new XmlNamespaceManager(xd.NameTable);
nm.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
nm.AddNamespace(String.Empty, "http://tempuri.org/");
XmlNode n =
xd.SelectSingleNode("soap:Envelope/soap:Body/SendServiceDataInHeader/Body", nm);
Of course I can get this node by writing:
XmlNode n =
xd.SelectSingleNode("soap:Envelope/soap:Body",
nm).FirstChild.FirstChild.NextSibling.NextSibling;
but it is not reliable and I want through direct XPath expression.
Help me resolve task please!
Andriy Zhornyk
|
|
|
|
|
I'm am trying to read and write some data from an AutoCad drawing to XML document, using VBA.
Can anyone assist me by providing a tutorial.
Thanks
Steven Houghton
|
|
|
|
|
The Problem: IE will sniff my data file and figure out it's REALLY in XML format, and will just render it as HTML rather than prompting the user to pass it to the application associated with my filename extension.
Description:
I have an C# Winforms application that takes data in a small input file which happens to be in XML format. Prior to this, I gave the file a custom extension (let's call it .mya for example) and associated that extension with my APP, so when someone clicked on the extension, it looked for an app already running, and if it found it, it sent that as an argument, otherwise it loaded the file itself. The app then took the data out of the custom XML file (.mya) and, among other things, sticks the data on a column in a datagrid.
Now, I'd like to set things up so when someone goes to a file like this as an URL in IE or Firefox, it will recognize the extension and call up my app. To do this, I created my own MIME type "application/myapp", had the Apache web server on the other end send the file type as that content type in its HTTP header, and then wrote to the registry under MIME/Database/Content Type my new data. I added the extension string there as .mya I then tried it out with Firefox, and it worked just fine.
It did not work at all with IE. IE sniffs the file and says, "This is actually an XML file" despite the extension and renders it as such in the browser. If I encrypt or encode the file as binary, this may force IE but I'd prefer not to do that if I don't have to.
One possibility is to get this to work with IE, I have to generate a GUID for my app and and add it under my MIME registry key as the CLSID. Then, somehow I go to my app and register this as a COM object, and support the object passing. Trouble is, I'm not sure exactly how to do that in C#.
All this seems quite complicated for something seemingly so simple. Anyone able to help me out -- perhaps there's a better way to do it. Or, perhaps generating the CLSID in the registry and then supporting that in my code is easier than I'm thinking.
Thanks a lot for everyone's help!
|
|
|
|
|
I am maintaining an application that uses the XmlSerializer to import and export data. I would like to make some modifications to the internals of the application, but I need to maintain backward compatibility with older XMLs that customers may have.
Essentially I'm trying to change
[XmlAttribute]
public string CashFlowType;
, which contains the name of the type, to this
[XmlAttribute]
public CashFlowType CashFlowType;
, which would be an object that encapsulates all of the details of the object instead of just the name.
The problem is that the Serializer can't put the complex type CashFlowType into an XmlAttribute, and rightly so.
The ideal solution would be to use [XmlElement] and write out the fields that I need to deserialize, but for the sake of maintaining backward compatibility, I cannot change the attribute to an element.
I have tried setting all of the fields of CashFlowType to [XmlIgnore] and I overrode ToString() in the hopes that the serializer would put the result of ToString in the attribute but it throws an exception just the same.
If anyone has any ideas it would be greatly appreciated.
Thanks, Jason
|
|
|
|
|
when using xml with microsoft visual c++ express edition beta 2 i get a syntax error '<' on the first line:
<?xml version="1.0" encoding="utf-8" ?>
when i include the xml file in my program i get this error.
does anyone know how to fix this problem??
any help would be greatly appreciated.
thank you in advance for the help.
- Kyle
|
|
|
|
|
Sounds like you're including it as a source file.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how am i supposed to include it?
|
|
|
|
|
Why do you want to ? You're not going to compile it, are you ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i want to use the file as the contents of a treeview control
- Kyle
|
|
|
|
|
So it needs to be in the same folder as your exe. It doesn't need to be part of the project.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Am in uni and have 2weeks to finish my assignment...i could just design it and not make it but I want to push myself and learn new things. I want to make an interactive quiz but it has a difference (a very rough story board is on... http://www.lesleytalbot.co.uk/testingwebsite/testingperceptionsgames.htm).
So far I know im going to make an xml doc containing all of my information and then i can import it into flash or director but i do not know which one to use - which would be best! any ideas?
My interactive quiz is about Perceptions - how well we perceive others - e.g. the player will look at a Photograph of someone (and be able to listen to a 15sec clip of their voice). There will be 5 questions asked about the person and the player gets a point for each they get right. Then it moves on to another photograph of someone and the same thing occurs.
I would like to be able to program it to:
* display a photograph and the answers to the 5 questions somewhere inbetween the incorrect ones
* be able to count the score
* to pick out a further 7 photographs from a database of 20, therefore at random would be good
* then after the 8 have been seen and answered an end screen will show with the score of the player
to make things complicated I have 2 games, the second is rather like Pairs except the player matches a photograph to aspects of peoples' characteristics e.g. shy or outgoing. so for this i need:
* to pick 10 photographs at random and have the matching characteristics randomly assembled on the screen
* program needs to know which characteristic matches to what photograph
* program needs to do something when the player matches the correct photograph and characteristic e.g. both disappear
* then when all are matched up the program shows an end screen and the time taken for the game to be completed
I know how to generally go about doing this in both Flash and Director and at the minute would prefer Director because it seems a lot simpler (plus I made a tile based game in Flash and confused the heck out of me for a long time!). But if you guys were to tell me such a think would work better in Flash I would use it!
Any ideas or help would be well appreciated,
thanks,
Lezlea
|
|
|
|
|
hi Lezlea,
Flash would be better option to use with XMl files in my thinking.
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
|
|
|
|